|
[Rivet] --no-as-needed only exists for ELF linkersAndy Buckley andy.buckley at cern.chTue Jul 23 15:26:41 BST 2013
Here's a useful description/illustration of what the GNU ld --as-needed flag does, along with how it can fail to get properly applied with libtool (I don't think this issue affects us because we're not using pkg-config to detect system libs): http://sigquit.wordpress.com/2011/02/16/why-asneeded-doesnt-work-as-expected-for-your-libraries-on-your-autotools-project/ A bit of digging indicates that the OS X equivalent is -dead_strip_dylibs, described at https://developer.apple.com/library/mac/documentation/darwin/reference/manpages/man1/ld.1.html as: Remove dylibs that are unreachable by the entry point or exported symbols. That is, suppresses the generation of load command commands for dylibs which supplied no symbols during the link. This option should not be used when linking against a dylib which is required at runtime for some indirect reason such as the dylib has an important initializer. Anyway, enough background (i.e. this email is a reference for when *I* forget this in future)... I decided that we perhaps don't want to use --no-as-needed on the whole libRivet build, so I've added a check to the rivet-buildplugin script to try and first work out whether the compiler will understand it: ## Detect whether the linker accepts the --no-as-needed flag and prepend the linker flag with it if possible if (cd /tmp && echo -e 'int main() { return 0; }' > $$.cc; $mycxx -Wl,--no-as-needed $$.cc -o $$ 2> /dev/null); then myldflags="-Wl,--no-as-needed $myldflags" fi Ok? Andy On 22/07/13 22:39, Hendrik Hoeth wrote: > Thus spake Andy Buckley (andy.buckley at cern.ch): > >> the -as-needed flag (implicitly switched on?) > > At least on Ubuntu boxes, yes. > >> allows the linker to be selective about what symbols it imports from a >> linked library, which presumably was overzealous at doing so when >> encountering the fastjettools plugin... > > Yes it was. :-/ > -- Dr Andy Buckley, Royal Society University Research Fellow Particle Physics Expt Group, University of Edinburgh / PH Dept, CERN
More information about the Rivet mailing list |