This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
library dependencies and --as-needed
- From: Brian Gough <bjg at gnu dot org>
- To: binutils at sourceware dot org
- Cc: bug-gsl at gnu dot org, Sébastien Fabbro <bicatali at gentoo dot org>
- Date: Thu, 29 Jan 2009 15:26:19 +0000
- Subject: library dependencies and --as-needed
Hello,
I'd like to ask for advice on library dependencies and the --as-needed
linker flag in the GSL project (GNU Scientific Library).
Our main lib file needs to call an external library (BLAS) for vector
operations. We want people to be able to choose different BLAS
libraries when they link their applications, e.g.
$ gcc main.c -lgsl -lcblas -lm # "cblas" can be ATLAS, Intel, AMD, etc
Thefore we don't specify any dependency on the external BLAS with
libtool, since its location would get hard-coded in the GSL shared
library.
This works fine except when the user links their application
--as-needed, which misses the BLAS functions as they are only used in
libgsl.so and (typically) not in the user's object file.
Is there a recommended way to handle this situation?
It seems like it would work if the search with --as-needed was
recursive, is there any conceptual reason for it not to do that?
Thanks.
--
Brian Gough
(GSL Maintainer)