Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 427782 - x11-libs/qt-*-4.8.2: doesn't respect CXXFLAGS
Summary: x11-libs/qt-*-4.8.2: doesn't respect CXXFLAGS
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal QA (vote)
Assignee: Qt Bug Alias
Keywords: InVCS
: 428176 (view as bug list)
Depends on:
Reported: 2012-07-23 18:43 UTC by wbrana
Modified: 2012-09-12 02:59 UTC (History)
1 user (show)

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

build log (x11-libs:qt-gui-4.8.2:20120719-195942.log.xz,60.06 KB, text/plain)
2012-07-23 18:43 UTC, wbrana
fixed build log (x11-libs:qt-gui-4.8.2:20120719-195942.log.xz,60.06 KB, application/x-xz)
2012-07-23 18:48 UTC, wbrana
patch (respect-flags.diff,791 bytes, patch)
2012-07-23 19:29 UTC, wbrana
Details | Diff
qt4-build.eclass.patch (qt4-build.eclass.patch,511 bytes, patch)
2012-07-24 17:54 UTC, Michael Palimaka (kensington)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description wbrana 2012-07-23 18:43:35 UTC
Created attachment 319006 [details]
build log

qt-gui adds -O2 to compiler flags, which disables -O3

Portage (hardened/linux/amd64, gcc-4.5.4, glibc-2.14.1-r3, 3.4.6-4 x86_64)
System uname: Linux-3.4.6-4-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q6600_@_2.40GHz-with-gentoo-2.1
Timestamp of tree: Fri, 20 Jul 2012 00:45:01 +0000
ccache version 3.1.7 [enabled]
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.12
dev-lang/python:          2.7.3-r2, 3.2.3-r1
dev-util/ccache:          3.1.7
dev-util/cmake:           2.8.8-r3
dev-util/pkgconfig:       0.27
sys-apps/baselayout:      2.1-r1
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6, 1.12.2
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.4.7, 4.5.4::x-portage, 4.6.3, 4.7.1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.4-r1 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r3
Repositories: gentoo qt x-portage
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA PUEL dlj-1.1 ETQW RTCW-ETEULA googleearth AdobeFlash-10.3 Oracle-BCLA-JavaSE"
CFLAGS="-O2 -O3 -finline-limit=128 -pipe -march=core2 -mtune=core2 -fomit-frame-pointer -funroll-loops --param max-unrolled-insns=64"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind /var/lib/hsqldb"
CONFIG_PROTECT_MASK="${EPREFIX}/etc/gconf /etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -O3 -finline-limit=128 -pipe -march=core2 -mtune=core2 -fomit-frame-pointer -funroll-loops --param max-unrolled-insns=64"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg ccache config-protect-if-modified distlocks ebuild-locks fixlafiles metadata-transfer news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv webrsync-gpg"
FFLAGS="-O2 -O3 -finline-limit=128 -pipe -march=core2 -mtune=core2 -fomit-frame-pointer -funroll-loops --param max-unrolled-insns=64"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu  -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/var/lib/layman/qt /usr/local/portage"
USE="X a52 aac acpi aio alsa amd64 amr apng berkdb bzip2 cairo caps chm cli consolekit cracklib crypt cxx dbus device-mapper dlz dri dts dvb eix enca exif extensions extras faad ffmpeg flac gcj gdbm glib glibc-omitfp glitz gnutls gold gtk gudev handbook hardened iconv jit jpeg jpeg2k justify lcms lm_sensors logrotate lzma matroska mikmod minizip mmx mng modplug modules mp3 mpeg mudflap multilib mysqli ncurses nodrm nptl nsplugin ogg openal opengl openmp pam pax_kernel pch pcre pcre16 pdf pic png pppd qt qt3support qt4 rar readline rtsp sandbox schroedinger session slang spell sqlite sqlite3 sse sse2 sse3 ssl ssse3 symlink theora threads tiff truetype unicode urandom usb userpriv v4l2 vlc vorbis vpx x264 xcb xcomposite xml xorg xv xvid zlib" ALSA_CARDS="virtuoso" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_GB" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Comment 1 wbrana 2012-07-23 18:48:44 UTC
Created attachment 319008 [details]
fixed build log
Comment 2 wbrana 2012-07-23 19:03:42 UTC
same bug in qt-core
Comment 3 wbrana 2012-07-23 19:29:54 UTC
Created attachment 319020 [details, diff]
Comment 4 Davide Pesavento gentoo-dev 2012-07-24 17:53:51 UTC
The patch is not acceptable, it changes standard upstream behaviour for out-of-portage builds.
Comment 5 Michael Palimaka (kensington) gentoo-dev 2012-07-24 17:54:16 UTC
Created attachment 319104 [details, diff]

Thanks for the report and the patch.

Unfortunately, we cannot patch the mkspecs files because some people do not like changing the default behaviour (see bug #352778).

Attached is a new patch (not yet properly tested) that mimics the behaviour of qt4-r2
Comment 6 Davide Pesavento gentoo-dev 2012-07-24 17:56:52 UTC
(In reply to comment #5)
> Created attachment 319104 [details, diff] [details, diff]
> qt4-build.eclass.patch
> Attached is a new patch (not yet properly tested) that mimics the behaviour
> of qt4-r2

Yes, that's what I had in mind.
Comment 7 Michael Palimaka (kensington) gentoo-dev 2012-07-25 14:57:29 UTC
I have pushed the patch[1] as well as a second patch for building qmake[2] to the overlay for now.

Comment 8 Davide Pesavento gentoo-dev 2012-07-27 07:02:48 UTC
*** Bug 428176 has been marked as a duplicate of this bug. ***
Comment 9 Davide Pesavento gentoo-dev 2012-08-06 07:37:26 UTC
(In reply to comment #7)
> I have pushed the patch[1] as well as a second patch for building qmake[2]
> to the overlay for now.
> [1]:
> h=3ea37eb3aa1424cca91cbcb03d742d74f1f2a9a2

ACK for this one.

> [2]: 
> h=f6d5e4c8af8db3e84cac7cac719b8383c4247d64

What happens if we replace all the seds in qt-core ebuild with just the following?

sed -i -e '/^CPPFLAGS =/s/-g//' \
        -e "/^CXXFLAGS =/s:$: ${CXXFLAGS}:" \
        -e "/^LFLAGS =/s:$: ${LDFLAGS}:" \
Comment 10 Michael Palimaka (kensington) gentoo-dev 2012-08-06 09:05:17 UTC
(In reply to comment #9)
> What happens if we replace all the seds in qt-core ebuild with just the
> following?
> sed -i -e '/^CPPFLAGS =/s/-g//' \
>         -e "/^CXXFLAGS =/s:$: ${CXXFLAGS}:" \
>         -e "/^LFLAGS =/s:$: ${LDFLAGS}:" \
>         "${S}"/qmake/Makefile.unix

Portage reports that all merged binaries respect *FLAGS, but qmake used during build does not:

Creating qmake. Please wait...
x86_64-pc-linux-gnu-g++ -c -o project.o -pipe -DQMAKE_OPENSOURCE_EDITION -O2 -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian -Igenerators/integrity -I/var/tmp/portage/x11-libs/qt-core-4.8.2/work/qt-everywhere-opensource-src-4.8.2/include -I/var/tmp/portage/x11-libs/qt-core-4.8.2/work/qt-everywhere-opensource-src-4.8.2/include/QtCore -I/var/tmp/portage/x11-libs/qt-core-4.8.2/work/qt-everywhere-opensource-src-4.8.2/src/corelib/global -I/var/tmp/portage/x11-libs/qt-core-4.8.2/work/qt-everywhere-opensource-src-4.8.2/src/corelib/xml -I/var/tmp/portage/x11-libs/qt-core-4.8.2/work/qt-everywhere-opensource-src-4.8.2/tools/shared -DQT_NO_PCRE -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS -I/var/tmp/portage/x11-libs/qt-core-4.8.2/work/qt-everywhere-opensource-src-4.8.2/mkspecs/linux-g++ -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DEPRECATED  -march=native -pipe -frecord-gcc-switches project.cpp

where CFLAGS="-march=native -pipe -frecord-gcc-switches"
Comment 11 Davide Pesavento gentoo-dev 2012-08-06 18:11:29 UTC
(In reply to comment #10)

Your CFLAGS *are* respected (they come last in gcc command line), but qmake building also uses -O2 by default (unless overridden by a later -On flag)... and that was expected actually.
Comment 12 Michael Palimaka (kensington) gentoo-dev 2012-08-06 18:43:48 UTC
(In reply to comment #11)
> but qmake building also uses -O2 by default (unless overridden by a later -On flag)...
That (and -pipe) was what I meant by not respecting, and was the reason for setBootstrapVariable. Apart from that issue(?), your sed in comment #9 covers all objects that are actually merged.
Comment 13 Davide Pesavento gentoo-dev 2012-08-13 04:55:14 UTC
So... I'm fine with merging the first patch (the eclass patch) into portage.

As far as qmake is concerned, it needs more thought IMO. For instance, what's the purpose of "optimized-qmake" USE flag? Should we remove it then?
Comment 14 Michael Palimaka (kensington) gentoo-dev 2012-08-14 13:22:57 UTC
(In reply to comment #13)
> what's the purpose of "optimized-qmake" USE flag? Should we remove it then?
I am no Qt expert, but a superficial look seems to indicate that it effectively just adds -O2 to CFLAGS. Since user CFLAGS are now passed, I suggest dropping the USE flag and configuring with -no-optimized-qmake.

I also note that even with -no-optimized-qmake, -pipe is still forced for qmake only.
Comment 15 Michael Palimaka (kensington) gentoo-dev 2012-09-06 08:32:00 UTC
Committed the eclass patch to portage.

+  06 Sep 2012; Michael Palimaka <> qt4-build.eclass:
+  Improve respect for *FLAGS. Fixes part of bug #427782.
Comment 16 Davide Pesavento gentoo-dev 2012-09-12 02:59:11 UTC
Closing this one. Fixing qmake bootstrap will be handled in bug 434780.