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

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

 



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

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux