On my system with qt-core-4.6.3 qmake not append option "-g" to CFLAGS. This is because in /usr/share/qt4/mkspecs/common/g++.conf missing that option. Sorry, my English is bad. Reproducible: Always Steps to Reproduce: 1. emerge =qt-core-4.6.3 2. grep ^QMAKE_CFLAGS_DEBUG /usr/share/qt4/mkspecs/common/g++.conf Actual Results: QMAKE_CFLAGS_DEBUG += Expected Results: QMAKE_CFLAGS_DEBUG += -g ~ $ emerge --info Unavailable repository 'gnome' referenced by masters entry in '/mnt/localrep/overlays/layman/keruspe/metadata/layout.conf' Portage 2.2_rc67 (default/linux/amd64/10.0/desktop, gcc-4.4.3, glibc-2.11.2-r0, 2.6.34-zen2-git x86_64) ================================================================= System uname: Linux-2.6.34-zen2-git-x86_64-Pentium-R-_Dual-Core_CPU_E6300_@_2.80GHz-with-gentoo-2.0.1 Timestamp of tree: Fri, 23 Jul 2010 01:45:03 +0000 distcc 3.1 x86_64-pc-linux-gnu [enabled] ccache version 2.4 [disabled] app-shells/bash: 4.0_p37 dev-java/java-config: 2.1.11 dev-lang/python: 2.6.5-r2, 3.1.2-r3 dev-util/ccache: 2.4-r7 dev-util/cmake: 2.8.1-r2 sys-apps/baselayout: 2.0.1 sys-apps/openrc: 0.6.1-r1 sys-apps/sandbox: 2.2 sys-devel/autoconf: 2.13, 2.65 sys-devel/automake: 1.7.9-r2, 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1 sys-devel/binutils: 2.20.1-r1 sys-devel/gcc: 4.3.4, 4.4.3-r2, 4.5.0 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 2.2.10 virtual/os-headers: 2.6.34 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-D_FORTIFY_SOURCE=2 -march=core2 -mcx16 -msahf --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=core2 -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-D_FORTIFY_SOURCE=2 -march=core2 -mcx16 -msahf --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=core2 -O2 -pipe" DISTDIR="/mnt/localrep/distfiles" FEATURES="assume-digests distcc distlocks fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch" GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles/" LANG="ru_RU.UTF-8" LC_ALL="ru_RU.UTF-8" LDFLAGS="-Wl,--as-needed" LINGUAS="ru" MAKEOPTS="-j12" PKGDIR="/home/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/package.skip" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/mnt/localrep/overlays/layman/x11 /mnt/localrep/overlays/layman/rion /mnt/localrep/overlays/layman/java-overlay /mnt/localrep/overlays/layman/keruspe /mnt/localrep/overlays/local /mnt/localrep/overlays/NavSystem" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="3gp 7zip X a52 aac acl acpi ads alsa amd64 amr apache2 apm assistant bash-completion berkdb bineditor bluetooth branding bzip2 cairo cdr cleartype cli clucene cluster consolekit cracklib crypt cups cxx dbus debugger dirac directfb djvu dri dts dvd dvdr dvi emboss emerald encode eps exif fam fbcon fbcondecor fbsplash ffmpeg fftw firefox flac fortran ftdi fts3 gallium gd gdbm gif glitz gnutls gpm gsm gstreamer handbook hdf5 iconv icq ipv6 ithreads jabber jpeg kde kerberos lame laptop latex lcms ldap lib32 libnotify lm_sensors lzma mad maps matroska melt midi mikmod mmx mng modules mozilla mp3 mp4 mpeg mssql mudflap multilib mysql ncurses nls nptl nptlonly objc objc++ odbc ogg opengl openmp pam pango pcre pdf perl png policykit postgres ppds pppd ps python qt qt3support qt4 quicktime radio rar rdp readline reflection samba sasl sdl secure-delete semantic-desktop session smb spell spl sql sqlite sqlite3 sse sse2 sse3 ssl ssse3 startup-notification svg sysfs system-libvncserver tcpd threads thunar thunderbird tiff tk truetype type1 udev unicode usb userlocales v4l v4l2 virtuoso vorbis webkit winbind wxwidgets x264 xcb xcomposite xml xorg xulrunner xv xvid xvmc zeroconf zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="ru" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="vesa intel radeon i915 i965 r100 r200 r300 r600" 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" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
It shouldn't as far as I am aware. -g should be added through CFLAGS as a general Gentoo policy, and never through USE=debug.
I should explain. This is manifested during the development on Qt4. For example I create simple project: eegorov@egorov-ey /tmp/123 $ cat main.cpp #include <stdio.h> int main() { return 5+4; } eegorov@egorov-ey /tmp/123 $ cat main.pro CONFIG+=debug CONFIG-=gui SOURCES += main.cpp TARGET = test1 eegorov@egorov-ey /tmp/123 $ qmake && make && gdb test1 GNU gdb (Gentoo 7.1 p1) 7.1 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". For bug reporting instructions, please see: <http://bugs.gentoo.org/>... Reading symbols from /tmp/123/main...(no debugging symbols found)...done. (gdb) So I can not carry out debugging of my application. The reason for this - lack of key "-g" in Makefile: eegorov@egorov-ey /tmp/123 $ grep ^CFLAGS Makefile CFLAGS = -pipe -Wall -W -D_REENTRANT $(DEFINES) Should be: eegorov@egorov-ey /tmp/123 $ grep ^CFLAGS Makefile CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
(In reply to comment #1) > It shouldn't as far as I am aware. -g should be added through CFLAGS as a > general Gentoo policy, and never through USE=debug. > Exactly. qt4-build.eclass strips C{,XX}FLAGS from mkspecs for that reason. This bug is invalid IMHO.
(In reply to comment #2) That's not an issue at all. Just put: QMAKE_CXXFLAGS_DEBUG += -g (or -ggdb) in your .pro file. http://doc.qt.nokia.com/4.6/qmake-manual.html
If this is not a bug, it is necessary to document this feature in Gentoo, IMHO, because http://doc.qt.nokia.com/4.6/qmake-manual.html says: QMAKE_CFLAGS_DEBUG This variable contains the flags for the C compiler in debug mode.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
(In reply to comment #4) > (In reply to comment #2) > > That's not an issue at all. Just put: > QMAKE_CXXFLAGS_DEBUG += -g (or -ggdb) > in your .pro file. > > http://doc.qt.nokia.com/4.6/qmake-manual.html > Adding this to .pro not allowed because this project will not be cross-platform
Use conditional scopes...
(In reply to comment #7) > Use conditional scopes... > I do not think this idea reasonable. Qt4 itself well does this work. In my opinion, portage did not have to rebuild Qt4 to fit your needs. He has to use Qt4 as he has. Now the algorithm of the qmake on Gentoo differs from the algorithm on any other platforms. We must not forget that qmake used not only for the Portage.
No, the algorithm hasn't been modified. We just changed some configuration details. You can't rely on such things anyway, since they may be different on different machines.
(In reply to comment #9) > No, the algorithm hasn't been modified. We just changed some configuration > details. You can't rely on such things anyway, since they may be different on > different machines. > qmake CONFIG+=debug && make on all platforms should compile the project with debug http://doc.qt.nokia.com/4.6/qmake-variable-reference.html#config
Could you show me the point where it says that CONFIG+=debug adds -g to CFLAGS please?
Note that "compiling in debug mode" is very different from "compiling with debug info".
(In reply to comment #11) > Could you show me the point where it says that CONFIG+=debug adds -g to CFLAGS > please? > Could you show me the point where it say that QMAKE_CFLAGS_DEBUG need be redefined? http://doc.qt.nokia.com/4.6/qmake-tutorial.html#making-an-application-debuggable
(In reply to comment #12) > Note that "compiling in debug mode" is very different from "compiling with > debug info". > No comment.
http://bugs.gentoo.org/show_bug.cgi?id=312689 @Davide Pesavento You'll continue to say that everything is OK?
I've never said that everything is OK. The only thing I know is that qmake sucks (and SIP is even worse wrt bug #312689). Anyway, you're making the problem bigger than it is and that's not helping us. If you want complete control over which CFLAGS are used in your project, you should be prepared to do that. I've seen a lot of projects doing so. Or you could suggest a solution that works for both portage builds and "personal" use.
(In reply to comment #16) > The only thing I know is that qmake > sucks (and SIP is even worse wrt bug #312689). This is a topic for separate discussion. > If you want complete control over which CFLAGS are used in your project, you > should be prepared to do that. I've seen a lot of projects doing so. Agreed. But this does not negate the fact that qmake in Gentoo does not operate as intended. > Or you could suggest a solution that works for both portage builds and > "personal" use. I think about it. And I'm ready to help as I can. However, I beg to acknowledge that a problem exists.
I propose an alternative. Create a new mkspec: egorov-ey usr # ls -l /usr/share/qt4/mkspecs/gentoo_portage итого 0 -rw-r--r-- 1 root root 143 Июл 28 16:51 qmake.conf lrwxrwxrwx 1 root root 26 Июл 28 16:52 qplatformdefs.h -> ../default/qplatformdefs.h egorov-ey usr # cat /usr/share/qt4/mkspecs/gentoo_portage/qmake.conf include(../default/qmake.conf) QMAKE_CFLAGS_RELEASE = QMAKE_CFLAGS_DEBUG = QMAKE_CXXFLAGS_RELEASE = QMAKE_CXXFLAGS_DEBUG = load(qt_config) Fixes qt4-r2.eclass: - "${EPREFIX}"/usr/bin/qmake -makefile -nocache \ + "${EPREFIX}"/usr/bin/qmake -makefile -spec gentoo_portage -nocache \ In the case of PyQt4 fixes configure.py: - return args + return "-spec gentoo_portage %s" % (args) What do you say?
...оr just in qt4-r2.eclass to determine variable QMAKESPEC=gentoo_portage
(In reply to comment #18) > I propose an alternative. > > Create a new mkspec: > egorov-ey usr # ls -l /usr/share/qt4/mkspecs/gentoo_portage > итого 0 > -rw-r--r-- 1 root root 143 Июл 28 16:51 qmake.conf > lrwxrwxrwx 1 root root 26 Июл 28 16:52 qplatformdefs.h -> > ../default/qplatformdefs.h This sounds good to me. qmake is not only a tool for allowing portage to portage to generate makefiles for its own packages. It is also a valid application for any user to use outside of portage and as such I would hope for it to behave like qmake on pretty much every other platform - which is to add suitable compiler flags when building debug or release builds. If portage needs something different than the widely accepted default behaviour, then portage should be the thing to jump through the extra hoops, not the users. Having said that, Egor's solution does not require much hoop jumping at all for portage and so seems a good way forwards to me. Tracking this down has cost me a whole day of debugging - I was getting mislead due to having the same package installed on two systems one which behaved as expected and one which has the new broken (IMHO) behaviour due to the qt4-build.eclass file change.
Created attachment 240641 [details] traceback
(In reply to comment #18) I had that idea too, but I'm afraid it wouldn't work. A lot of qmake project files use conditional scopes based on the currently active mkspec tuple [1]. Therefore passing '-spec gentoo_portage' would break virtually every build system out there. [1] http://doc.qt.nokia.com/4.6/qmake-advanced-usage.html#platform-scope-values
(In reply to comment #22) > (In reply to comment #18) > > I had that idea too, but I'm afraid it wouldn't work. > A lot of qmake project files use conditional scopes based on the currently > active mkspec tuple [1]. Therefore passing '-spec gentoo_portage' would break > virtually every build system out there. > > [1] http://doc.qt.nokia.com/4.6/qmake-advanced-usage.html#platform-scope-values > And if you do so? sed "s/linux-g++/gentoo_portage/g" -i "${S}/*.pro"
(In reply to comment #23) No, I don't like that: too hackish and too fragile. What I propose is to partially revert the C(XX)FLAGS stripping currently performed by qt4-build.eclass and just remove the flags from QMAKE_C{,XX}FLAGS_RELEASE variables, thus leaving debug variables as shipped by upstream.
(In reply to comment #24) > (In reply to comment #23) > > No, I don't like that: too hackish and too fragile. > > What I propose is to partially revert the C(XX)FLAGS stripping currently > performed by qt4-build.eclass and just remove the flags from > QMAKE_C{,XX}FLAGS_RELEASE variables, thus leaving debug variables as shipped by > upstream. > That's reasonable. However, I think the question should be left open.
Created attachment 240803 [details] qt-core-4.6.3-add-ignore-predefined-cflags-options.patch Please, test this patch for qt-core-4.6.3 If environment variable QMAKE_IGNORE_PREDEFINED_CFLAGS defined and not empty, qmake will ignore the predefined CFLAGS in mkspec.
That doesn't solve the issues with SIP-based packages.
(In reply to comment #27) > That doesn't solve the issues with SIP-based packages. > Why? SIP does not see the environment variables?
Not without patching I guess...
How many SIP-based packages in the portage? Maybe there is such a way to fix SIP... Now I'll see what it was...
Created attachment 240841 [details] sip-4.10.5-add-ignore-predefined-cflags-options.patch Please test. This path allow make QMAKE_IGNORE_PREDEFINED_CFLAGS=yes CFLAGS="-g -O0" CXXFLAGS="-g -O0" ebuild /usr/portage/dev-python/PyQt4/PyQt4-4.7.3.ebuild clean compile right
Created attachment 240845 [details] qt-core-4.6.3-add-ignore-predefined-cflags-options.patch The variable QMAKE_IGNORE_PREDEFINED_CFLAGS is no longer obliged to be non-empty
Created attachment 240943 [details] qt-core-4.6.3-add-ignore-predefined-cflags-options.patch Sorry. In the previous patch error.
The patch sip-4.10.5-add-ignore-predefined-cflags-options.patch has been tested by me on all versions of SIP in portage. I think this is a better solution than the one that exists now.
The Qt team decided to implement what I proposed in comment #24.
Created attachment 245844 [details, diff] proposed patch Davide, how about this patch?
(In reply to comment #36) > Created an attachment (id=245844) [details] > proposed patch > > Davide, how about this patch? > Perfect!
Patch applied You need to rebuild qt-core for these changes to take effect