Quantcast
Viewing all articles
Browse latest Browse all 8

ld: duplicate symbol _g_bit_nth_lsf Mac OSX Leopard/Darwin

I have had some problems installing software from source on my Max OS X Leopard machine. I should thank Martin Szomszor for his help on getting this working, but after some time faffing we finally got it sorted out.

I found that I was having problems making software on Leopard, which I could build fine on my linux (fedora) machines. The error I was getting was:

ld: duplicate symbol _g_bit_nth_lsf in foo.o and bar.o

I am running Leopard 10.5.3. I was using glib2, installed via Fink, version number: 2.12.0-103. After spending lots of time googling I found the following article to be of the most use, “Wireshark with Macports”, where Anders Brownworth pointed out that the error was due to a “extern inline bug in glib/gutils.h which is easily fixed“.

So to fix this:

  • I located gutils.h, which I found here:

    /sw/include/glib-2.0/glib/gutils.h
  • I then replaced these lines:

    #ifdef G_IMPLEMENT_INLINES

    # define G_INLINE_FUNC

    # undef G_CAN_INLINE

    #elif defined (__GNUC__)

    # define G_INLINE_FUNC extern inline

    #elif defined (G_CAN_INLINE)

  • With this:

    #ifdef G_IMPLEMENT_INLINES

    # define G_INLINE_FUNC

    # undef G_CAN_INLINE

    #elif defined (__APPLE__)

    # define G_INLINE_FUNC static inline

    #elif defined (__GNUC__)

    # define G_INLINE_FUNC extern inline

    #elif defined (G_CAN_INLINE)

  • By adding these two middle lines:

    #elif defined (__APPLE__)

    # define G_INLINE_FUNC static inline
  • The start of the fragment of code was at line number 96 in my gutils.h file

Here is a link to my edited and working gutils.h file.

Note 1: I would make sure I get a copy of my original gutils.h file, as this may come in handy

Note 2: There is a patch which one could apply to make the same changes which I have just described here. This patch follows this ticket. I didn’t know what to do with the patch file, so I ended up editing the file by hand:). I am guessing that is something todo with macports, mmm, nevermind, its working now.


Viewing all articles
Browse latest Browse all 8

Trending Articles