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

Re: [xmlblaster] Compiling cpp client in mac osx



Ricardo Jorge Jota wrote:
Hello,

I'm having some troubles compiling xmlBlaster c++ client in Mac OS X 10.4 and was wondering if anyone
had successfully compiled the c++ client in Mac OS X. I ran into several troubles, some of then I managed to solve.


Prior to the compilation I installed the required libraries and edited the build.properties:

- Zlib was already installed in osx (/usr )
- Using fink I installed both xerces-c_2.6.0 and sqlite 2.8.16 (/sw)

- Build.properties:
XMLBLASTER_ZLIB=1
zlib.include.dir=/usr/include
zlib.lib.dir=/usr/lib
# On Windows you have to choose the name, usually 'zlib' or 'zlib1' (defaults to 'z' for UNIX):
zlib.lib.name=zlib


#SQLITE
XMLBLASTER_PERSISTENT_QUEUE=1
sqlite.include.dir=/sw/include
sqlite.lib.dir=/sw/lib

#XERCES
xerces.include.dir=/sw/include/xercesc
xerces.lib.dir=/sw/lib
xerces.lib.name=xerces-c_2

XMLCPP_HOME = /sw/lib


--------- During the compilation i got the following errors:

- First malloc.h wasn't being found. This was easily solved editing the #include in source code.
What was the change you made?
Did the C client compile well without changes (build c), where the problems in C++ only?

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


ld: Undefined symbols:
_gethostbyname_r
_sqlite_bind
_sqlite_close
_sqlite_compile
_sqlite_decode_binary
_sqlite_encode_binary
_sqlite_error_string
_sqlite_exec
_sqlite_finalize
_sqlite_freemem
_sqlite_last_statement_changes
_sqlite_open
_sqlite_reset
_sqlite_step
_deflate
_deflateEnd
_deflateInit_
_inflate
_inflateEnd
_inflateInit_
_zError
/usr/bin/libtool: internal link edit command failed


Most of these undefined symbols were solved by removing the -prebind and including the right libraries, thus the new command looked like :
gcc -g -dynamiclib -L/usr/lib -L/sw/lib -lsqlite -lz -lpthread /* The rest of the command was removed */
Looks like the cpptasks (http://sourceforge.net/projects/ant-contrib/)
has problems with Mac OS X. Probably you should ask for this issue
on the ant-contrib mailing list.

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).


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().


Please give us feedback/pathes of all changes you have added so we
can add support for MAC,

regards
Marcel


Any help would be really appreciated, Ricardo Jota