Message: previous - next
Month: February 2012

Howto prevent LDFLAGS --sort-common,--as-needed,<snip>,--hash-style=gnu

From: "David C. Rankin" <drankinatty@...>
Date: Tue, 28 Feb 2012 09:50:01 -0600

  This is a follow up from an issue Jay and I are trying to solve with
twin-style-crystal. I have also posted this to the Arch list in case it is gcc
version related, but someone smarter than I on autotools may see the problem
from what is described below.

  I have patched acinclude.m4, aclocal.m4 and configure to remove references to
--as-needed, but when I run configure, I still get the three unwanted LDFLAGS
put back in the makefile somehow? Example:

Makefile:LDFLAGS = -Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu

  I just want it to read:

Makefile:LDFLAGS = -Wl,-O1,-z,relro

  What magic autotool does this and how do I fix it? The flags show up in the
Makefiles and the config.status file. I have completely searched the source code
with grep -r and after patching none of the unwanted flags are present before
starting the build. When the build craters, I check the Makefiles and
config.status and the unwanted flags are back. This results in the build failing

/bin/sh ../libtool --silent --mode=link --tag=CXX g++  -march=x86-64
-mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4
-Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu -o embedtool
-L/opt/trinity/lib -L/opt/qt3/lib     -L/opt/trinity/lib/trinity embedtool.o
-lqt-mt  -lz -lpng -lz -lm -lXext -lX11  -lSM -lICE -lpthread
g++: error: unrecognized option '--sort-common'
g++: error: unrecognized option '--as-needed'
g++: error: unrecognized option '--hash-style=gnu'

  What's the trick? Thanks.

Extra info:

  For those interested, the source is:

  and the patch I'm applying to try and get rid of the flags is:

David C. Rankin, J.D.,P.E.