Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.4.0 RC
-
None
-
Arch Linux x86-64, binutils 2.24
-
fd3e12e7a6c71a244650415a86e98d910a011ebe
Description
When compiling Qt 5.4-rc I have the following error:
/usr/bin/ld.gold -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,--gc-sections -Wl,-O1 -fuse-ld=gold -o ../../../bin/rcc .obj/rcc.o .obj/main.o -L/D/QT/qt-everywhere-opensource-src-5.4.0-rc/qtbase/lib -lQt5Bootstrap -lz -lpthread /usr/bin/ld.gold: -Wl,-O1,--sort-common,--as-needed,-z,relro: unknown option
Binutils 2.24 Arch Linux x86-64
As I understand Qt uses QMAKE_LFLAGS
This variable contains a general set of flags that are passed to the linker.
But somehow system LDFLAGS (that are passed to the compiler) are transformed to QMAKE_LFLAGS, that breaks compilation. QMAKE_LFLAGS passes options to the linker, LDFLAGS passes options to the compiler. The lines of options are not interchangeable.
But qtbase/configure simply converts both:
for varname in $SYSTEM_VARIABLES; do qmakevarname="${varname}" # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS if [ "${varname}" = "LDFLAGS" ]; then qmakevarname="LFLAGS" elif [ "${varname}" = "LD" ]; then qmakevarname="LINK" fi cmd=`echo \ 'if [ -n "\$'${varname}'" ]; then QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}'" fi'`
ld exits when you use -Wl option:
ld -Wl
ld: unrecognized option '-Wl'
The same situation with qtbase/mkspecs/common/g++-unix.conf:
QMAKE_LFLAGS_RELEASE += -Wl,-O1
This options also pass directly to the linker, that breaks compilation.
ld -Wl
ld: unrecognized option '-Wl'
Attachments
Issue Links
- relates to
-
QTBUG-32530 CFLAGS picked up from environment are overridden by mkspecs
-
- Closed
-