Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 359081 - x11-libs/qt-sql-4.7.2 fails to build with --param in flags
Summary: x11-libs/qt-sql-4.7.2 fails to build with --param in flags
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Qt Bug Alias
: 425392 (view as bug list)
Depends on:
Reported: 2011-03-15 19:57 UTC by Andrew Savchenko
Modified: 2012-07-09 13:41 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

build.log (build.log,58.85 KB, text/plain)
2011-03-15 20:01 UTC, Andrew Savchenko
environment (environment,137.67 KB, text/plain)
2011-03-15 20:01 UTC, Andrew Savchenko
emerge --info (emerge-info,7.46 KB, text/plain)
2011-03-15 20:03 UTC, Andrew Savchenko

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Savchenko gentoo-dev 2011-03-15 19:57:29 UTC

with --param l1-cache-size=64 in LDFLAGS qt-sql-4.7.2 fails to build due to wrongly stripped "duplicated" --param argument:

i686-pc-linux-gnu-g++ -march=athlon-xp -m32 --param l1-cache-line-size=64 --param l1-cache-size=64 --param l2-cache-size=512 -O2 -funswitch-loops -fpredictive-commoning -fgcse-after-reload -ftree-vectorize -mstackrealign -ftree-loop-linear -ftree-loop-im -fweb -frename-registers -fomit-frame-pointer -mfpmath=sse -fexcess-precision=fast -pipe -Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,-rpath,/usr/lib/qt4 -Wl,-rpath,/usr/lib/qt4 -shared -o .obj/release-shared/main.o .obj/release-shared/qsql_mysql.o .obj/release-shared/moc_qsql_mysql.o   -L/usr/lib/mysql -L/var/tmp/portage/x11-libs/qt-sql-4.7.2/work/qt-everywhere-opensource-src-4.7.2/lib -L/usr/lib/qt4 -march=athlon-xp -m32 --param l1-cache-line-size=64 l1-cache-size=64 l2-cache-size=512 -O2 -funswitch-loops -fpredictive-commoning -fgcse-after-reload -ftree-vectorize -mstackrealign -ftree-loop-linear -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -ftree-loop-im -fweb -frename-registers -fomit-frame-pointer -mfpmath=sse -fexcess-precision=fast -pipe -Wl,-O1 -Wl,--as-needed -rdynamic -L/usr/lib/mysql -lmysqlclient_r -L/usr//lib -lz -lcrypt -lnsl -lm -L/usr/lib/ -lssl -lcrypto -lQtSql -L/var/tmp/portage/x11-libs/qt-sql-4.7.2/work/qt-everywhere-opensource-src-4.7.2/lib -lQtCore -lgthread-2.0 -lrt -lglib-2.0 -lpthread
i686-pc-linux-gnu-g++: l1-cache-size=64: No such file or directory
i686-pc-linux-gnu-g++: l2-cache-size=512: No such file or directory
distcc[7953] ERROR: compile (null) on localhost failed
make[1]: *** [../../../../plugins/sqldrivers/] Error 1
Comment 1 Andrew Savchenko gentoo-dev 2011-03-15 20:01:04 UTC
Created attachment 266015 [details]
Comment 2 Andrew Savchenko gentoo-dev 2011-03-15 20:01:53 UTC
Created attachment 266017 [details]
Comment 3 Andrew Savchenko gentoo-dev 2011-03-15 20:03:22 UTC
Created attachment 266019 [details]
emerge --info
Comment 4 Andrew Savchenko gentoo-dev 2011-03-15 21:57:12 UTC
Hmm, I removed --param val=arg from CFLAGS/CXXFLAGS/LDFLAGS, but problem still persists. It looks like qmake takes them from some system wide config or pc file, but at this moment I can't figure out its whereabouts.
Comment 5 Andrew Savchenko gentoo-dev 2011-03-15 23:58:37 UTC
Problem was triggered by mysql_config --libs_r call, which returned full set of LDFLAGS used to compile mysql, and consequent removal of "duplicated" --param argument by qmake.

As a temporary workaround, mysql may be recompiled with reduced LDFLAGS, or just mysql_config script may be tuned manually. 

But the proper solution will be to fix mishappen qmake function for the removing of duplicates.
Comment 6 Davide Pesavento gentoo-dev 2011-03-16 13:59:21 UTC
From your emerge --info:
LDFLAGS="-march=athlon-xp -m32 --param l1-cache-line-size=64 --param l1-cache-size=64 --param l2-cache-size=512 -O2 -funswitch-loops -fpredictive-commoning -fgcse-after-reload -ftree-vectorize -mstackrealign -ftree-loop-linear -ftree-loop-im -fweb -frename-registers -fomit-frame-pointer -mfpmath=sse -fexcess-precision=fast -pipe -Wl,-O1 -Wl,--as-needed"

wtf? Compiler flags in LDFLAGS? Are there any valid reasons for this? Can you reproduce with saner LDFLAGS?
Comment 7 Andrew Savchenko gentoo-dev 2011-03-16 15:16:43 UTC
(In reply to comment #6)
> wtf? Compiler flags in LDFLAGS? Are there any valid reasons for this?

Yes, according to the gcc manual, further optimizations may take place when linking with gcc/g++. The most prominent example is -flto which is required to be present on both object compilation and linking stages. Of course, at this moment -flto is unsupported, because it is too unstable, but its support is just a matter of time.

> Can you reproduce with saner LDFLAGS?

As I wrote in comment #4, reduced flags does not help. In fact I used LDFLAGS="-Wl,-O1 -Wl,--as-needed" and got the same error.

As I wrote in comment #5, I investigated this problem further and found out that dev-db/mysql saves all LDFLAGS to its /usr/bin/mysql_config script and reports them to qmake during `mysql_config --libs_r` call. Afterwards, qmake strips out from an obtained list all duplicated arguments, which leads to the compilation error.

Thus with "fixed" mysql_config and even with original complicated LDFLAGS qt-sql-4.7.2 builds well. Of course, the real fix will be make qmake's argument stripper more intelligent.

I understand, that using CFLAGS in LDFLAGS is uncommon, but it is not illegal as long as you are linking with gcc and not plain ld.
Comment 8 Davide Pesavento gentoo-dev 2011-04-07 20:11:17 UTC
I believe that only a very limited subset of compiler flags are valid at link time (e.g. -flto as you said).

Anyway, qmake indeed mishandles --param flags in LDFLAGS, that's a bug that should be fixed, but there's little we can do about it. You're encouraged to open a bug in upstream tracker at and report your findings there.

Thank you!
Comment 9 Davide Pesavento gentoo-dev 2012-07-09 13:41:52 UTC
*** Bug 425392 has been marked as a duplicate of this bug. ***