On Fri, 18 Mar 2011, LRN wrote:
Since gcc 4.6.0 it is no longer possible to use
LDFLAGS=-no-undefined
gcc now says something like this:
gcc.exe: error: unrecognized option '-no-undefined'
Before 4.6.0 it was possible to do that, and gcc said only this:
gcc.exe: unrecognized option '-no-undefined'
That is, unrecognized option was not considered a show-stopper,
and everything worked just fine - the option, being part of
LDFLAGS, eventually reached libtool, and libtool were taking the
clue to disallow undefined symbols. Not anymore. Now i have to
pass LDFLAGS=-Wl,-no-undefined. Which is ok from gcc' point of
view, but libtool is unable to recognize this argument in such
form and simply refuses to build shared libraries outright.
Not sure if it's a bug or a feature, and how to work through that
without making groundbreaking changes in software packages that
use libtool.
I think that you have to pass -no-undefined to the ***_LDFLAGS
variable of your library:
lib_LTLIBRARIES = libproject.la
libproject_la_LDFLAGS = -no-undefined
or, globally:
AM_LDFLAGS = -no-undefined
it has always worked for me, without gcc warning.