autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Autotools, g++ linking errors, and the --no-as-needed option


From: Joseph Wakeling
Subject: Autotools, g++ linking errors, and the --no-as-needed option
Date: Wed, 12 Oct 2011 16:20:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1

Hello,

I've been having linking problems with a C++ project after an update to
more recent g++ versions (post-4.5).  Here's an example, where the
building of an executable fails:

*************************************************************************
/bin/bash ../libtool --tag=CXX   --mode=link g++ -I.. -g -O2 -lgsl
-lgslcblas -lm    -o minga minga.o libminga.la
libtool: link: g++ -I.. -g -O2 -o .libs/minga minga.o  -lgsl -lgslcblas
-lm ./.libs/libminga.so
./.libs/libminga.so: undefined reference to `gsl_rng_uniform_int'
./.libs/libminga.so: undefined reference to `gsl_rng_uniform'
collect2: ld returned 1 exit status
*************************************************************************

The linking problem does not occur if the order of arguments called by
g++ is altered to

  g++ -I.. -g -O2 -o .libs/minga minga.o ./.libs/libminga.so -lgsl
  -lgslcblas -lm

... but the call to g++ is autogenerated by the autotools, and I don't
know if/how I can ask for the order of arguments to be re-ordered.

A workaround I have found is to add a line to configure.ac,

   CXXFLAGS="$CXXFLAGS -Wl,--no-as-needed"

... but I'd like to know if there is any more elegant solution to this
problem from an autoconf/autotools point of view.

Can anyone advise?

Thanks and best wishes,

    -- Joe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]