Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 49120

Summary: QT ignoring CFLAGS and fails to compile on gcc-3.4
Product: Gentoo Linux Reporter: Ahmed Farid <afw2000>
Component: [OLD] KDEAssignee: Gentoo KDE team <kde>
Status: RESOLVED DUPLICATE    
Severity: enhancement CC: gcc-porting, kde
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Ahmed Farid 2004-04-26 20:54:37 UTC
in short QT-3.3.1 needs -DQT_CLEAN_NAMESPACE in C[XX]FLAGS to be able to compile, and since QT doesn't use user's CFLAGS it just breaks.

fix :
echo "QMAKE_CFLAGS += ${CFLAGS} -DQT_CLEAN_NAMESPACE" >> .qmake.cache
echo "QMAKE_CXXFLAGS += ${CXXFLAGS} -DQT_CLEAN_NAMESPACE" >> .qmake.cache

before the emake line.

Reproducible: Always
Steps to Reproduce:



Expected Results:
Comment 1 Caleb Tennis (RETIRED) gentoo-dev 2004-04-27 04:28:23 UTC
I got it to compile here using gcc 3.4 and it worked fine.  I even got it to use PCH.  Are you sure this is necessary?
Comment 2 Caleb Tennis (RETIRED) gentoo-dev 2004-04-27 05:12:45 UTC
(this was 3.3.2 I was trying)
Comment 3 Travis Tilley (RETIRED) gentoo-dev 2004-04-27 08:07:24 UTC
can you include the output of emerge info? i'm curious as to your arch and cflags.
Comment 4 Caleb Tennis (RETIRED) gentoo-dev 2004-04-27 08:10:02 UTC
ignored cflags is a known bug, or feature, depending on how you look at it.
Comment 5 Ahmed Farid 2004-04-27 09:41:33 UTC
I'm sorry, yet another bug report while i'm semi-asleep.
QT ignoring CFLAGS is a bug if you ask me..

Portage 2.0.51_pre7 (2004.0, gcc-3.4.0, glibc-2.3.3_pre20040207-r0,2.3.3_pre20040420-r0, 2.6.5-Speedy4)
=================================================================
System uname: 2.6.5-Speedy4 i686 Intel(R) Pentium(R) 4 CPU 2.20GHz
Gentoo Base System version 1.4.10
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="no"
CFLAGS="-march=pentium4 -O2 -ftracer -pipe -fomit-frame-pointer -mfpmath=sse -ffast-math   -fweb"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /etc/X11/xorg.conf /etc/fstab /etc/make.conf /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/kde/cvs/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium4 -O2 -ftracer -pipe -fomit-frame-pointer -mfpmath=sse -ffast-math   -fweb"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache psyco"
GENTOO_MIRRORS="ftp://ftp.easynet.nl/mirror/gentoo/ http://www.zentek-international.com/mirrors/gentoo/ http://ftp.easynet.nl/mirror/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/bmg-portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="X aalib alsa apache2 applypatches arts atm avi chroot crypt cups curl directfb encode fbcon flash foomaticdb gd gdbm gif gpm gtk gtk2 imlib javascript jpeg kde libwww maildir md5sum mmx mozilla mozinterfaceinfo moznoirc moznomail mozp3p mozsvg mpeg mysql ncurses nptl offensive oggvorbis opengl pam pdflib perl php pic png ppds python qt quicktime readline sasl sdl spell sse ssl threads tiff truetype x86 xml xml2 xmms xosd xv xvid zlib"

I can't get the exact error right now, but it was something about stuff redfined twice.
Comment 6 Joshua Kinard gentoo-dev 2004-04-27 15:18:55 UTC
qt's ignoring of CFLAGS is a problem for mips as well.  Mips needs -Wa,-relax-branch passed to both CC and CXX during compile.  Editing mkspecs/linux-g++/qmake.conf, one would think that adding the desired flags to QMAKE_CFLAGS_* would be sufficient, but even changes to those specific files on those specific lines are ignored.  The only way the mips patch was applied successfully was by attaching -Wa,-relax-branch to QMAKE_CC and QMAKE_CXX in that file.  

To be utterly honest, I'm not an X/KDE/Qt user, but I think qmake's system is horribly broken as far as honoring CFLAGS for linux goes, and the Qt guys should be bothered about it so they fix it.  The ideal solution for mips would've been a properly placed append-flags call in the ebuild, not the less elegant solution of applying a patch that alters the QMAKE_CC[XX] lines directly.
Comment 7 Imad R. Faiad 2004-04-29 02:27:06 UTC
to have qt honor your compiler flags edit the ebuild as below.
don't bother with -O3, also be sensible with your compiler
flags, otherwise you will end up with an unstable system.
tested with the followings:
CFLAGS="-march=pentium4 -mfpmath=sse -msse2 -O2 -fomit-frame-pointer"
CXXFLAGS=${CFLAGS}
is "-DQT_CLEAN_NAMESPACE" needed for gcc-3.4??
src_unpack() {
	unpack ${A}

	export QTDIR=${S}
	cd ${S}

	cp configure configure.orig
	sed -e 's:read acceptance:acceptance=yes:' configure.orig > configure
	replace-flags "-O3" "-O2"
	sed -i "s:= -O2:= ${CFLAGS}:g" ${S}/mkspecs/linux-g++/qmake.conf
	echo QMAKE_CFLAGS += ${CFLAGS} >> ${S}/tools/designer/editor/editor.pro
	echo QMAKE_CXXFLAGS += ${CXXFLAGS} >> ${S}/tools/designer/editor/editor.pro
Comment 8 Caleb Tennis (RETIRED) gentoo-dev 2004-05-18 16:02:44 UTC
gcc 3.4 works fine here, but the cflags issue is a dup.

*** This bug has been marked as a duplicate of 25551 ***