Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 398825 - dev-util/valgrind fails to compile due to -m64 in CFLAGS and CCASFLAGS
Summary: dev-util/valgrind fails to compile due to -m64 in CFLAGS and CCASFLAGS
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-13 23:40 UTC by Thomas Sachau
Modified: 2012-02-26 13:40 UTC (History)
2 users (show)

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


Attachments
build.log (dev-util:valgrind-3.7.0-r2:20120113-221544.log,136.75 KB, text/plain)
2012-01-13 23:40 UTC, Thomas Sachau
Details
new build.log for 3.7.0-r3 (dev-util:valgrind-3.7.0-r3:20120218-185344.log,135.40 KB, text/plain)
2012-02-18 19:47 UTC, Thomas Sachau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Sachau gentoo-dev 2012-01-13 23:40:02 UTC
This bug is reveiled by the addition of -m64 to CFLAGS_amd64 to profiles and multilib-portage adding CFLAGS_${target_abi} to CFLAGS (and some other vars).

emerge --info:


Portage 2.2.0_alpha84-r1 (hardened/linux/amd64/10.0, gcc-4.5.3, glibc-2.14.1-r2, 2.6.32-gentoo-r39 x86_64)
=================================================================
System uname: Linux-2.6.32-gentoo-r39-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q6600_@_2.40GHz-with-gentoo-2.1
Timestamp of tree: Sa 3. Dez 16:06:39 CET 2011
app-shells/bash:          4.2_p20
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.6.7-r2, 2.7.2-r3
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1
sys-apps/openrc:          0.9.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.2
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.5.3-r2
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r2
Repositories: gentoo enlightenment sunrise multilib Meins
Installed sets: @enlightenment, @fonts, @system
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/home/thomas/daten/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going"
FEATURES="assume-digests binpkg-logs collision-protect distlocks ebuild-locks fixlafiles metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
FFLAGS=""
GENTOO_MIRRORS="http://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/ ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo"
LANG="de_DE.UTF-8@euro"
LDFLAGS="-Wl,--as-needed -Wl,--hash-style=gnu"
LINGUAS="de"
MAKEOPTS="-j5 --load-average=8"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
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="/home/thomas/daten"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/enlightenment /usr/local/portage/layman/sunrise /usr/local/portage/layman/multilib-portage /usr/local/portage"
SYNC="cvs://tommy@cvs.gentoo.org:/var/cvsroot"
USE="3dnow X alsa amd64 berkdb cli cracklib crypt cups custom-cflags custom-cxxflags custom-optimization cxx dri gpm hardened java5 java6 justify mmx modules mudflap multilib ncurses nls nptl nptlonly nsplugin ogg openmp pam pax_kernel pppd readline scanner session sse sse2 ssl sysfs tcpd unicode urandom v4l vorbis xorg zlib" ALSA_CARDS="hda-intel" 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 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" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" MULTILIB_ABIS="amd64 x86" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" 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" multilib_abi="amd64 x86"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Thomas Sachau gentoo-dev 2012-01-13 23:40:45 UTC
Created attachment 298899 [details]
build.log
Comment 2 Anthony Basile gentoo-dev 2012-02-11 23:15:05 UTC
Tommy, sorry for taking a while to come back to this, but I was investigating  the related question of what the -mx32 flag does.  This lead me down a long path of what the x32 abi looks like.  Long story short, it leads to breakage.

Anyhow, back to just -m64.  I'm having trouble reproducing this despite the addition of CFLAGS_amd64="-m64" to arch/amd64/make.defaults.  First let's make sure we're on the same page.  I tested on two profiles:

    1) hardened/linux/amd64

    2) default/linux/amd64/10.0

In both cases =dev-util/valgrind-3.7.0-r2 emerged fine.  Here are the differences between these and what you did:

    1) You used a deprecated profile hardened/linux/amd64/10.0
    2) I used portage-2.1.10.44, you used 2.2.0_alpha84-r1
    3) I used glibc-2.13-r4, you used glibc-2.14.1-r2

There are other differences, but they are unconsequential.

I know that if -m64 makes it in there we have problems, see bug #398447, but that is a different issue.

Tommy anything more to shed light on this?
Comment 3 Anthony Basile gentoo-dev 2012-02-11 23:18:53 UTC
(In reply to comment #2)

> 
> I know that if -m64 makes it in there we have problems, see bug #398447, but
> that is a different issue.
> 

Sorry, I meant bug #398463
Comment 4 Thomas Sachau gentoo-dev 2012-02-13 20:31:53 UTC
(In reply to comment #2)
>     2) I used portage-2.1.10.44, you used 2.2.0_alpha84-r1

This is the main difference, since 2.2.0_alpha84-r1 is not simply portage-2.2, but multilib-portage, which does add CFLAGS_$target_abi to $CFLAGS and some other vars, which in this case does mean -m64.

Unless you want to use/test multilib-portage yourself (ebuild is in the multilib-portage overlay), the easiest way to reproduce those issues for you is to add (on amd64) -m64 to CFLAGS, CXXFLAGS and LDFLAGS
Comment 5 Anthony Basile gentoo-dev 2012-02-14 01:26:18 UTC
(In reply to comment #4)
> (In reply to comment #2)
> >     2) I used portage-2.1.10.44, you used 2.2.0_alpha84-r1
> 
> This is the main difference, since 2.2.0_alpha84-r1 is not simply portage-2.2,
> but multilib-portage, which does add CFLAGS_$target_abi to $CFLAGS and some
> other vars, which in this case does mean -m64.
> 
> Unless you want to use/test multilib-portage yourself (ebuild is in the
> multilib-portage overlay), the easiest way to reproduce those issues for you is
> to add (on amd64) -m64 to CFLAGS, CXXFLAGS and LDFLAGS

Okay now I understand how those flags make it into the build.  Both -m64 and -mx32 are a problem so I filter-flag-ed them.

Note: I rev bumped to -r3 rather than just adding to -r2 because ppc64 is thinking of stabilizing -r2, see bug #403355.  In case these filters cause problems, its better to separate them out for more testing.

Closing resolved.  Reopen if there's still a problem with valgrind-3.7.0-r3.
Comment 6 Thomas Sachau gentoo-dev 2012-02-18 19:47:02 UTC
Created attachment 302431 [details]
new build.log for 3.7.0-r3

Seems like something still adds -m64, since the build still fails.
Comment 7 Anthony Basile gentoo-dev 2012-02-19 03:11:53 UTC
(In reply to comment #6)
> Created attachment 302431 [details]
> new build.log for 3.7.0-r3
> 
> Seems like something still adds -m64, since the build still fails.

filter-flags does not work with the multilib portage as it does with mainline:

1) On a vanilla amd64 gentoo, I added -m64 to my CFLAGS in /etc/make.conf.  Then valgrind-3.7.0-r2 fails while valgrind-3.7.0-r3 works.  The difference between the two is 'filter-flags -m64 -mx32' in src_configure().

2) On a multilib system (I used experimental/amd64/qemu/multilib-amd64-qemu-2012-01-04.tar.lzma), both valgrind-3.7.0-r2 and valgrind-3.7.0-r3 fail.  The failing compiling line is:

x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVGPV_x86_linux_vanilla=1 -I../coregrind -DVG_LIBDIR="\"/usr/lib64/valgrind"\" -DVG_PLATFORM="\"x86-linux\""  -I.. -I../include -I../VEX/pub -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVGPV_x86_linux_vanilla=1 -I../coregrind -DVG_LIBDIR="\"/usr/lib64/valgrind"\" -DVG_PLATFORM="\"x86-linux\"" -m32 -g -O2 -march=nocona -pipe -m64 -c -o libcoregrind_x86_linux_a-m_cpuid.o `test -f 'm_cpuid.S' || echo './'`m_cpuid.S

Note the last flag -m64 is appended after filter-flags.


This brings up an important question in the whole multilib approach: do we want the user or build system to override the abi flag?
Comment 8 Anthony Basile gentoo-dev 2012-02-19 15:26:42 UTC
> Note the last flag -m64 is appended after filter-flags.
> 
> 
> This brings up an important question in the whole multilib approach: do we want
> the user or build system to override the abi flag?

binki noticed that the -m64 is added to the CCASFLAGS.  A quick peek at flag-o-matic.eclass shows that these flags are not filtered.  I added CCASFLAGS to the flags that fitler-flags does filter and that fixed the problem.

The fix is a trivial patch, but it should be passed by the gentoo-dev@ email list.  I'll do that after a chance to comment on the bug.

Here's the patch:

--- flag-o-matic.eclass.orig	2012-01-16 21:03:32.000000000 +0100
+++ flag-o-matic.eclass	2012-02-19 11:24:12.000000000 +0100
@@ -17,7 +17,7 @@
 
 # Return all the flag variables that our high level funcs operate on.
 all-flag-vars() {
-	echo {C,CPP,CXX,F,FC,LD}FLAGS
+	echo {C,CPP,CXX,CCAS,F,FC,LD}FLAGS
 }
 
 # {C,CXX,F,FC}FLAGS that we allow in strip-flags
Comment 9 Anthony Basile gentoo-dev 2012-02-26 13:40:55 UTC
(In reply to comment #8)
> > Note the last flag -m64 is appended after filter-flags.
> > 
> > 
> > This brings up an important question in the whole multilib approach: do we want
> > the user or build system to override the abi flag?
> 
> binki noticed that the -m64 is added to the CCASFLAGS.  A quick peek at
> flag-o-matic.eclass shows that these flags are not filtered.  I added CCASFLAGS
> to the flags that fitler-flags does filter and that fixed the problem.
> 
> The fix is a trivial patch, but it should be passed by the gentoo-dev@ email
> list.  I'll do that after a chance to comment on the bug.
> 
> Here's the patch:
> 
> --- flag-o-matic.eclass.orig    2012-01-16 21:03:32.000000000 +0100
> +++ flag-o-matic.eclass    2012-02-19 11:24:12.000000000 +0100
> @@ -17,7 +17,7 @@
> 
>  # Return all the flag variables that our high level funcs operate on.
>  all-flag-vars() {
> -    echo {C,CPP,CXX,F,FC,LD}FLAGS
> +    echo {C,CPP,CXX,CCAS,F,FC,LD}FLAGS
>  }
> 
>  # {C,CXX,F,FC}FLAGS that we allow in strip-flags

This has been committed to the tree.  filter-flags() should now include CCASFLAGS.

@Tommy, its working at my end with the multilib portage and valgrind-3.7.0-r3.  Please reopen this if it is still a problem, but I think we nailed it.  Thanks for the report!