I've also tried going back to the basics. I've installed glib via MacPorts, then simply executed a make and make install on the libmimic source, the resulting dylib in /usr/local/lib. I linked THIS one to my project and still get those darn duplicate symbol link errors.
I do not think this problem is really in Xcode, but more at the UNIX level and examining some of the glib header files where g_bit_nth_lsf appears I'd say that it has something to do with inline functions.
Seeing that code compiled on Tiger as well as on Leopard both gives me these error when linked on Leopard, I'm starting to suspect that it's not the way these libraries were compiled, but rather something in the glib header files that I have to include in my project (libmimic needs them).
gutils.h ---------- /* Bit tests */ G_INLINE_FUNC gint g_bit_nth_lsf (gulong mask, gint nth_bit) G_GNUC_CONST; G_INLINE_FUNC gint g_bit_nth_msf (gulong mask, gint nth_bit) G_GNUC_CONST; G_INLINE_FUNC guint g_bit_storage (gulong number) G_GNUC_CONST; . . . /* inline function implementations */ #if defined (G_CAN_INLINE) || defined (__G_UTILS_C__) G_INLINE_FUNC gint g_bit_nth_lsf (gulong mask, gint nth_bit) { if (G_UNLIKELY (nth_bit < -1)) nth_bit = -1; while (nth_bit < ((GLIB_SIZEOF_LONG * 8) - 1)) { nth_bit++; if (mask & (1UL << nth_bit)) return nth_bit; } return -1; } . . .
On 28-Oct-07, at 10/28/07 6:15 PM, Ryan Homer wrote: Just to be clear, the project compiles with no problems, it's the linking stage that I get this. However, I'm thinking that it's during the compile stage that something has to change so those symbols don't end up in the object files.
I just re-built my libmimic framework under Leopard, which went well, and used the freshly built framework to try to re-build the main project, but I still get the same error.
Help! :-)
R
On 28-Oct-07, at 10/28/07 5:06 PM, Ryan Homer wrote:
Hi all,
I just upgraded to Leopard and am trying to build a Tiger project in Leopard. During the Leopard Betas I've tried building my project and have successfully done so several times. Two major changes since the last trial are 1) the addition of a new library 2) i386 only to Universal build. The error is:
ld: duplicate symbol _g_bit_nth_lsf in /Users/.../Objects-normal/i386/CamDirectConnection.o and /Users/.../Objects-normal/i386/AVController.o
This comes from the glib library which I have inside a framework bundle. The framework is libmimic, which I've built myself into a Universal binary. Each of the .o files referenced above does call some of the libmimic functions, which in turn calls the glib functions. Using 'nm' on each file, I do see _g_bit_nth_lsf in both of them
.
.
.
00000000 T _g_bit_nth_lsf
00000049 T _g_bit_nth_msf
00000098 T _g_bit_storage
0000012d T _g_trash_stack_height
00000114 T _g_trash_stack_peek
000000e2 T _g_trash_stack_pop
000000bc T _g_trash_stack_push
.
.
.
If I do the same to the .o files from the Tiger build, I do not see these lines anywhere, not even in one of the two files. Does anybody have any idea of what going on here?
Thanks in advance.
|