newsGNU Scientific Library - News: GNU Scientific Library dependencies and linking with --as-needed

 
 
Latest News
GNU Scientific Library 2.2.1 released posted by psa, Wed Aug 31 15:14:10 2016 - 0 replies
GNU Scientific Library 2.2 released posted by psa, Mon Aug 29 16:00:10 2016 - 0 replies
GNU Scientific Library 2.1 released posted by psa, Thu Nov 12 00:51:14 2015 - 0 replies
GNU Scientific Library 2.0 released posted by psa, Sat Oct 31 19:32:02 2015 - 0 replies
GNU Scientific Library 1.15 released posted by bjg, Sat May 7 21:46:23 2011 - 0 replies
[Submit News]
[16 news in archive]

GNU Scientific Library dependencies and linking with --as-needed

Item posted by -Deleted Account- <bjg> on Mon Feb 9 17:57:54 2009.

Many distributions are starting to link every application with the GNU Linker's --as-needed flag, to avoid loading libraries that are specified on the command-line but not actually used.

While this is a good thing, it caused a problem for applications using GSL because the main library needs to call an external library for vector operations (BLAS). These BLAS functions are typically not called from the user's object file directly, and they were being discarded by --as-needed causing numerous "unresolved reference" errors. The problem arises because --as-needed does not follow references recursively, except for direct shared library dependencies specified by the ELF DT_NEEDED field (i.e libraries explicitly defined as a dependency in libtool).

In the case of GSL we are not able to specify the dependency on the external library explicitly--we do not know which BLAS library will be used. We want people to be able to choose different BLAS libraries when they link their applications.

Now thanks to Alan Modra there is a enhancement to binutils [1,2] which allows --as-needed to search recursively, ensuring that libraries which are used both directly and indirectly will be linked, and only those with no references at all will be discarded. The next release of binutils should resolve the problems encountered using GSL with --as-needed.

[1] http://sourceware.org/ml/binutils/2009-01/msg00399.html
[2] http://sourceware.org/ml/binutils/2009-01/msg00413.html

Comments:

No messages in GNU Scientific Library dependencies and linking with --as-needed

 

Back to the top


Powered by Savane 3.1-cleanup