« One-step installation script | Main | State of the Project, 2011 »
Friday
Apr012011

New library linking in Linux

It seems like Linux is changing its build policies and forcing us to be more explicit in our linkage. This does not seem to have affected any of the current stable releases of the main Linux distros, but apparently, the next versions of the big ones are going to start enforcing this. This includes  Ubuntu 11.04, Debian 7, and the next releases of Fedora. Others too, probably, if I went and looked.

In the end, I think this is probably a good thing since it forces us to be more explicit about what we link against.

I am currently going through and figuring out the various places that require this fix and trying to think if there is an elegent way to handle this in our build structure. But honestly, and this might just be in light of it being late, I think we just need to make sure that when we create a target program to build, we make sure to iinclude the necessary libraries in LDADD.

For instance, in Gruel we build the program test_gruel, so we set it up as:

   noinst_PROGRAMS = test_gruel

   test_gruel_LDADD = pmt/libpmt-qa.lib libgruel.la

Now, the trick was that libgruel already knew their linkage to the necessary libraries, so we didn't pass these on to test_gruel. Under the new way, we have to specify all of the libraries, and so the LDADD line looks like:

    test_gruel_LDADD = $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) pmt/libpmt-qa.lib libgruel.la

Which allows it to build against these specific Boost libraries (the variables having been set during the configuration process).

This is an overly simplistic explination of what's really happening, but it's the basics of how it is affectig GNU Radio. Here's some more info on the change: http://wiki.debian.org/ToolChain/DSOLinking

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.