Hello, 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 libqsqlmysql.so .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/libqsqlmysql.so] Error 1
Created attachment 266015 [details] build.log
Created attachment 266017 [details] environment
Created attachment 266019 [details] emerge --info
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.
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.
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?
(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.
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 http://bugreports.qt.nokia.com/ and report your findings there. Thank you!
*** Bug 425392 has been marked as a duplicate of this bug. ***