I'm having a weird problem with the linker I cannot explain. Before filing it as a possible bug, I'd like to have your opinion on that.
Brief description:
I'm building an executable (command-line) that requires some external libraries.
Let's say I need to link (statically) with:
/usr/local/lib/libfoo.a
/usr/local/lib/libbar.a
/usr/local/lib/libfoo++.a
/usr/local/lib/libbar++.a
The external libraries (are given (to ld) by XCode using the form:
-lfoo -lbar -lfoo++ -lbar++
The problem: ld reports a bunch of unresolved symbols.
If I invoke by hand ld by specifying the static libs directly as input files instead of libraries everything works fine:
ld ... /usr/local/lib/libfoo.a /usr/locallib/libbar.a /usr/local/lib/libfoo++.a /usr/local/lib/libbar++.a
Interested?
If you want to reproduce it, download the xmlrpc-c library from Sourceforge
(xmlrpc-c.sourceforge.net), build it and install it under /usr/local and try to build one of the example first using the form that uses the -l<lib> flag, and then with the other form.
In my case I also discovered that ONLY ONE library needs to be listed using /usr/local/lib/<blah>.a...
To be more specific, this is *NOT* working:
ld <...> -lxmlrpc++ -lxmlrpc_server_abyss++ -lxmlrpc_server++ -lxmlrpc_server_abyss -lxmlrpc_server -lxmlrpc_abyss -lxmlrpc_util -lxmlrpc_xmlparse -lxmlrpc_xmltok -lxmlrpc
and this IS WORKING:
-lxmlrpc++ -lxmlrpc_server_abyss++ -lxmlrpc_server++ -lxmlrpc_server_abyss -lxmlrpc_server -lxmlrpc_abyss -lxmlrpc_util -lxmlrpc_xmlparse -lxmlrpc_xmltok /usr/local/lib/xmlrpc.a
Weird isn't it?
Am I missing something?
Is it really a bug ?
Thanks for your opinion.
Fab
Brief description:
I'm building an executable (command-line) that requires some external libraries.
Let's say I need to link (statically) with:
/usr/local/lib/libfoo.a
/usr/local/lib/libbar.a
/usr/local/lib/libfoo++.a
/usr/local/lib/libbar++.a
The external libraries (are given (to ld) by XCode using the form:
-lfoo -lbar -lfoo++ -lbar++
The problem: ld reports a bunch of unresolved symbols.
If I invoke by hand ld by specifying the static libs directly as input files instead of libraries everything works fine:
ld ... /usr/local/lib/libfoo.a /usr/locallib/libbar.a /usr/local/lib/libfoo++.a /usr/local/lib/libbar++.a
Interested?
If you want to reproduce it, download the xmlrpc-c library from Sourceforge
(xmlrpc-c.sourceforge.net), build it and install it under /usr/local and try to build one of the example first using the form that uses the -l<lib> flag, and then with the other form.
In my case I also discovered that ONLY ONE library needs to be listed using /usr/local/lib/<blah>.a...
To be more specific, this is *NOT* working:
ld <...> -lxmlrpc++ -lxmlrpc_server_abyss++ -lxmlrpc_server++ -lxmlrpc_server_abyss -lxmlrpc_server -lxmlrpc_abyss -lxmlrpc_util -lxmlrpc_xmlparse -lxmlrpc_xmltok -lxmlrpc
and this IS WORKING:
-lxmlrpc++ -lxmlrpc_server_abyss++ -lxmlrpc_server++ -lxmlrpc_server_abyss -lxmlrpc_server -lxmlrpc_abyss -lxmlrpc_util -lxmlrpc_xmlparse -lxmlrpc_xmltok /usr/local/lib/xmlrpc.a
Weird isn't it?
Am I missing something?
Is it really a bug ?
Thanks for your opinion.
Fab