[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] Compiling cpp client in mac osx



Hi,
What was the change you made?
Did the C client compile well without changes (build c), where the problems in C++ only?
The problems is in the #include<malloc.h> (./src/c/util/queue/ SQLiteQueue.c:#include <malloc.h>).

Now, in Mac - using Fink - you have two include locations : /sw/lib and /usr/lib. The sw is the Fink one, the usr is the os x system one.
The include malloc.h is in /usr/lib/malloc/malloc.h. In linux the right path is: /usr/lib/malloc.h. In order to solve this I changed the source code, but i'm not sure the best way to do this.




After this problem was solved the following command (the ./build - verbose cpp showed me the command)
gcc -g -prebind -dynamiclib -o libxmlBlasterClientCD.dylib ../ build.tmp/objCD/helper.o ../build.tmp/objCD/ XmlBlasterAccessUnparsed.o ../build.tmp/objCD/ CallbackServerUnparsed.o ../build.tmp/objCD/ XmlBlasterConnectionUnparsed.o ../build.tmp/objCD/msgUtil.o ../ build.tmp/objCD/xmlBlasterSocket.o ../build.tmp/objCD/ SQLiteQueue.o ../build.tmp/objCD/Properties.o ../build.tmp/objCD/ xmlBlasterZlib.old: warning prebinding disabled because of undefined symbols

This is the C shared lib linking output on my Linux box:

gcc -g -shared -o libxmlBlasterClientCD.so ../build.tmp/objCD/ helper.o ../build.tmp/objCD/XmlBlasterAccessUnparsed.o ../build.tmp/ objCD/CallbackServerUnparsed.o ../build.tmp/objCD/ XmlBlasterConnectionUnparsed.o ../build.tmp/objCD/msgUtil.o ../ build.tmp/objCD/xmlBlasterSocket.o ../build.tmp/objCD/ SQLiteQueue.o ../build.tmp/objCD/Properties.o ../build.tmp/objCD/ xmlBlasterZlib.o -L/opt/sqlite-bin/lib -lsqlite -L/opt/zlib-bin/lib -lz

I wonder why cpptasks leaves away the sqlite and zlib in your case (pthread is not needed explicitly on Linux).
I think the problem lies within the -prebind flag. From what I could gather this allows you to remove the gcc -L and -l flags. Although i'm not sure about this it seams that the /sw/lib path -the fink path - isn't prebound (OSX prebind all their dylib.). I'm not sure if you can disable -prebind in the cpp-tasks when the MAC OSX system is found.


Unfortunately _gethostbyname_r doesn't get solved and after "googling" it seems that this symbols doesn't exist in OS X.
This is just the thread safe variant of gethostbyname().
Please add your own gethostbyname_r() variant in your code and implement it using
gethostbyname().



I'd love to implement a new one. But I have some questions about you code. First and foremost i'd like to test the ones already coded. Now if I read you code correctly you use #defines to select the correct one. As the darwin - the osx "kernel"- is mostly bsd maybe the bsd implementation works. But I don't know how to find the correct #define value for osx. Can you shed some light on this ?


Thank in advance,
Ricardo Jota