Trouble compiling libbe/app/Message.cpp

Hi everyone,

I’ve just checked-out the Haiku source code for the first time, and am having some trouble building it. I’m running on OSX, building on a disk image with HFS+ and case-sensitivity, using the following commands:

./configure --build-cross-tools-gcc4 x86 ../buildtools/
jam -j2 haiku-vmware-image

There seems to be a problem with this bit of the build (the bit saying “malloc.h: No such file or directory”):

In file included from headers/build/BeOSBuildCompatibility.h:7,
                 from :1:
headers/build/os/support/Errors.h:399:1: warning: "ENOATTR" redefined
In file included from /usr/include/errno.h:23,
                 from headers/build/os/support/Errors.h:15,
                 from headers/build/BeOSBuildCompatibility.h:7,
                 from :1:
/usr/include/sys/errno.h:227:1: warning: this is the location of the previous de
finition
src/build/libbe/app/Message.cpp:28:20: error: malloc.h: No such file or director
y
headers/build/os/storage/Statable.h:34: warning: 'class BStatable' has virtual f
unctions but non-virtual destructor
headers/build/os/storage/Statable.h:34: warning: 'class BStatable' has virtual f
unctions but non-virtual destructor
src/build/libbe/app/Message.cpp: In member function 'void BMessage::_PrintToStre
am(const char*) const':
src/build/libbe/app/Message.cpp:429: warning: format '%ld' expects type 'long in
t', but argument 2 has type 'dev_t'
src/build/libbe/app/Message.cpp:429: warning: format '%lld' expects type 'long l
ong int', but argument 3 has type 'ino_t'
C++ generated/objects/darwin/x86/release/build/libbe/app/Messenger.o 
In file included from headers/build/BeOSBuildCompatibility.h:7,
                 from :1:
headers/build/os/support/Errors.h:399:1: warning: "ENOATTR" redefined
In file included from /usr/include/errno.h:23,
                 from headers/build/os/support/Errors.h:15,
                 from headers/build/BeOSBuildCompatibility.h:7,
                 from :1:
/usr/include/sys/errno.h:227:1: warning: this is the location of the previous de
finition
headers/build/os/storage/Statable.h:34: warning: 'class BStatable' has virtual f
unctions but non-virtual destructor
src/build/libbe/app/Messenger.cpp: In member function 'bool BMessenger::IsValid(
) const':
src/build/libbe/app/Messenger.cpp:152: warning: unused variable 'info'

I’ve got the latest revision checked out from the svn repo (21534) – anyone had the same problem, or know how to fix it?

Thanks,
:wink: james.

Don’t use gcc4 to build it. I tried a few months back with gcc4 and it didn’t work.

Gcc4 might work with Haiku Release 1, it should work with Release 2, but best to stick with gcc2.95 for now.

I use gcc 4 to build and it works just fine and have done so for a long time. That’s under linux, might be a problem under other systems.

I think GCC4 is required under OS X anyway - I don’t think the gcc2.95.3 toolchain compiles under OS X.

Also, this is a “build” version that is being built, to it must use the host compiler.

BTW, what does -j2 do again? Doesn’t that tell it to use two threads? does it work without that option?

My guess is that mmlr’s updates of the “build” version of Message.cpp have broken the build on OSX (and possibly other platforms).

I would revert back to something prior to r21514 (I think that’s when he changed it) and try again. If it works prior to that, then I would definitely file a bug at http://dev.haiku-os.org

Ok, can’t say if gcc4 toolchain ( cross compiler ) works because I haven’t tried it in awhile. Few months back it didn’t - only gcc2.95.3 cross compiler would get Haiku to compile.

Original poster, Check that you have installed and are using latest
Gcc4.x, Bison v2.3, Flex v2.54.

Some extra help here:

http://haiku-os.org/documents/dev/getting_linux_developer_tools

Someone says in there that you should have installed:
autoconf, automake, texinfo, flex, bison, gawk

Thanks everyone for your help!

Yep, I tried first with 2.95.3 (as checked out from the Haiku svn repo), and I couldn’t get it to compile properly, so I switched over to gcc4 (also from the repo).

Yep, it’s the same as ‘-j2’ passed to make, it builds two things at once. I dropped it from the jam arguments and tried again, but still no luck.

[quote=umccullough]My guess is that mmlr’s updates of the “build” version of Message.cpp have broken the build on OSX (and possibly other platforms).

I would revert back to something prior to r21514 (I think that’s when he changed it) and try again. If it works prior to that, then I would definitely file a bug at http://dev.haiku-os.org[/quote]

Thanks. I did an ‘svn up -r21514’ and it compiled successfully, so I’ll log a bug. Thanks again everyone.

Good to see that you were able to find the problem.

Now that you got it to build with gcc4. Did you also want to try with gcc2.95 to see if that’ll work too? I’m just curious.

He can’t compile with GCC 2.95.3 because it isn’t supported as a cross-compiler on OS X (it won’t even build on that platform).

In any case, looks like Ingo fixed the problem in r21546 - so you can update to the latest rev again and build.

Edit: I might be thinking that GCC2.95.3 won’t build on PPC version of OS X - maybe it does build on intel version - I dunno.

Actually you’re right Urias. Just found it. Mac OSX Intel only supports gcc4 cross compile.

http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk/ReadMe.cross-compile

Linux, BSD and BeOS/Zeta are the only OSes that can do 2.95 build.

Good to know.

Yep, updating to r21546 fixes it, thanks for pointing that out.

Now I’m getting this when I build:

C++ generated/objects/darwin/x86/release/tools/vmdkheader/vmdkheader.o 
src/tools/vmdkheader/vmdkheader.cpp: In function 'int main(int, char**)':
src/tools/vmdkheader/vmdkheader.cpp:41: warning: format '%u' expects type 'unsig
ned int', but argument 3 has type 'long unsigned int'
src/tools/vmdkheader/vmdkheader.cpp:100: warning: format '%u' expects type 'unsi
gned int', but argument 3 has type 'long unsigned int'
Link generated/objects/darwin/x86/release/tools/vmdkheader/vmdkheader 
/usr/bin/ld: Undefined symbols:
___gxx_personality_v0
collect2: ld returned 1 exit status

cc  -o "generated/objects/darwin/x86/release/tools/vmdkheader/vmdkheader"   "gen
erated/objects/darwin/x86/release/tools/vmdkheader/vmdkheader.o"  -lgcc_s.1  ;

...failed Link generated/objects/darwin/x86/release/tools/vmdkheader/vmdkheader 
...

I’m about to go off and see if I can fix this too, but has anyone seen this before, have any idea about what it could be? Maybe something else that I should link against? Thanks!

I think that vmdk header code was ported from somewhere by Marcus - so I’m not sure of the origins.

If you just want the image built, you can use “jam haiku-image” and then convert it to vmdk separately (qemu-img can do it well - I used to do that prior to the haiku-vmware-image target)

On the other hand, if you’re willing to track down the issue and submit a patch (I recommend either submitting it in Trac, or via the haiku development mailing list) - then by all means go for it!

Great, I’m happy to have a crack at it. I noticed that at least some of the stuff in src/tools builds with the host’s ‘cc’ or ‘c++’ compilers. Is that right? Also, it looks like vmdkheader might just be linking against the wrong libraries (it’s a c++ source file, but it links with the ‘cc’ command, so I’m guessing change the linker line to ‘c++’ which should be more platform-independant, or append the correct c++ libraries to link against), but I’m having trouble figuring out the Jamfile. What’s the normal way to convince it to link using c++ instead of cc (or is it normal in the Haiku build system to always link with cc?)

yeah, many of the tools are for build purposes.

You should take you questions to the haiku dev list - most of the hardcore haiku devs don’t use the forums and you’d get better answers there :slight_smile:

I’m not much of a developer really.

see here:

http://haiku-os.org/community/ml