Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 346707 - media-libs/libreplaygain-465: CFLAGS ignored (breaking multilib/etc... builds)
Summary: media-libs/libreplaygain-465: CFLAGS ignored (breaking multilib/etc... builds)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Sound Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: portage-multilib
  Show dependency tree
 
Reported: 2010-11-24 23:07 UTC by stefan.demharter
Modified: 2011-11-22 15:24 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description stefan.demharter 2010-11-24 23:07:05 UTC
I'm using the MULTILIB overlay with MULTILIB_ABI="amd64 x86" and FEATURES="ccache"

When compiling e.g. libreplaygain-465 the compilation fails in the x86 step.
Reason:
- First ccache caches the object files for the amd64 architecture
- When compiling the code for the x86 architecture at some point the direct mode of ccache detects a hit with the amd64-object (that's bad!)
- The link afterwards fails because of the wrong architecture of the object file

Reproducible: Always

Steps to Reproduce:
1. Use the multilib overlay with MULTILIB_ABI="amd64 x86"
2. Install ccache-3.1.2
3. "CCACHE_DIR=/tmp/ccache_tmp ccache -c; rm /tmp/ccache_log" to get a clean ccache directory and log file
4. FEATURES="ccache" CCACHE_DIR="/tmp/ccache_tmp" CCACHE_LOGFILE="/tmp/ccache_log" emerge =libreplaygain-465
Actual Results:  
Linking C shared library libreplaygain.so
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.1/../../../../x86_64-pc-linux-gnu/bin/ld: i386:x86-64 architecture of input file `CMakeFiles/replaygain-shared.dir/gain_analysis.o' is incompatible with i386 output

Corresponding entry in /tmp/ccache_tmp for the generated object file:
=== CCACHE STARTED =========================================
Hostname: xxx
Working directory: /var/tmp/portage/media-libs/libreplaygain-465/work/libreplaygain-465_build/src
Source file: /var/tmp/portage/media-libs/libreplaygain-465/work/libreplaygain-465/src/gain_analysis.c
Object file: CMakeFiles/replaygain-shared.dir/gain_analysis.o
Trying direct lookup
Looking for object file hash in /tmp/ccache_tmp/3/d/82fa0a32f6149049e3a89e469f5a54-16642.manifest
Got object file hash from manifest
Unlink CMakeFiles/replaygain-shared.dir/gain_analysis.o via CMakeFiles/replaygain-shared.dir/gain_analysis.o.xxx.2588.rmXXXXXX
Copying /tmp/ccache_tmp/4/b/a1ec540a7d45cb6efd16993b13de93-131721.o to CMakeFiles/replaygain-shared.dir/gain_analysis.o via CMakeFiles/replaygain-shared.dir/gain_analysis.o.xxx.2588.XXXXXX (uncompressed)
Created CMakeFiles/replaygain-shared.dir/gain_analysis.o from /tmp/ccache_tmp/4/b/a1ec540a7d45cb6efd16993b13de93-131721.o
Succeded getting cached result
Acquired lock /tmp/ccache_tmp/4/stats.lock
Releasing lock /tmp/ccache_tmp/4/stats.lock
Unlink /tmp/ccache_tmp/4/stats.lock (as-tmp)
Result: cache hit (direct)             


Expected Results:  
No error.
Ccache shouldn't use the object file of the wrong architecture from the cache. 

As a workaround you can disable the direct mode of ccache by setting CCACHE_NODIRECT=1

emerge --info:
Portage 2.2.0_alpha2-r1 (default/linux/amd64/10.0, gcc-4.5.1, glibc-2.12.1-r3, 2.6.36 x86_64)
=================================================================
System uname: Linux-2.6.36-x86_64-Intel-R-_Core-TM-_i5_CPU_M_430_@_2.27GHz-with-gentoo-2.0.1
Timestamp of tree: Wed, 24 Nov 2010 19:00:01 +0000
ccache version 3.1.2 [enabled]
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r2
dev-lang/python:     2.6.6-r1, 3.1.2-r4
dev-util/ccache:     3.1.2
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1-r1
sys-apps/openrc:     0.6.5
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.5.1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.4
sys-devel/make:      3.82
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
Repositories: gentoo gentoo-quebec multilib kde gentoo-china x11 local
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -msse -msse2 -msse3 -msse4 -mcx16 -mpopcnt -msahf -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /var/lib/hsqldb"
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.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core2 -msse -msse2 -msse3 -msse4 -mcx16 -mpopcnt -msahf -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs ccache distlocks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j1"
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="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/gentoo-quebec /var/lib/layman/multilib /var/lib/layman/kde /var/lib/layman/gentoo-china /var/lib/layman/x11 /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X accessibility acl alsa amd64 bash-completion berkdb bluetooth bzip2 cli cracklib crypt cups cxx dbus dri fortran gdbm gnome gpm iconv ipv6 jpeg libnotify llvm mmx modules mp3 mudflap multilib multilib_abi_amd64 multilib_abi_x86 ncurses nls nodep nptl nptlonly openal opengl openmp pam pch pcre perl png pppd pulseaudio python readline session sse sse2 ssl ssse3 sysfs tcpd udev unicode xorg 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" 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="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" MULTILIB_ABIS="amd64 x86" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel radeon i965 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, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 SpanKY gentoo-dev 2010-11-27 21:22:44 UTC
show the actual compile lines failing.  the multilib cflags must be passed to gcc via the cmdline and not through the env/gcc-config.
Comment 2 stefan.demharter 2010-11-27 22:48:20 UTC
The problematic compile line, which fetches the 64-bit object from ccache instead of creating a new 32-bit one (obtained with MAKEOPTS="VERBOSE=1" emerge =libreplaygain-465):

cd /var/tmp/portage/media-libs/libreplaygain-465/work/libreplaygain-465_build/src && /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc  -Dreplaygain_shared_EXPORTS   -DNDEBUG -O3 -fomit-frame-pointer -pipe -fPIC -I/var/tmp/portage/media-libs/libreplaygain-465/work/libreplaygain-465/include   -o CMakeFiles/replaygain-shared.dir/gain_analysis.o -c /var/tmp/portage/media-libs/libreplaygain-465/work/libreplaygain-465/src/gain_analysis.c

CFLAGS env variable (obtained with strace):
CFLAGS=-march=core2 -msse -msse2 -msse3 -msse4 -mcx16 -mpopcnt -msahf -O2 -pipe -m32
Comment 3 SpanKY gentoo-dev 2010-11-28 01:30:27 UTC
that gcc is not being executed with -m32.  not a bug in ccache.
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-11-28 02:07:52 UTC
sound herd:
you need to fix libreplaygain to pass -m32 for the 32-bit multilib compile.
Comment 5 stefan.demharter 2010-11-28 11:35:19 UTC
I don't understand why the problem should be with libreplaygain.
As mentioned in my first post a workaround is to use CCACHE_NODIRECT=1. With that flag set libreplaygain builds correctly. So there is a problem with the direct mode of ccache, isn't it?
Comment 6 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2011-01-11 17:57:03 UTC
(In reply to comment #5)
> I don't understand why the problem should be with libreplaygain.
> As mentioned in my first post a workaround is to use CCACHE_NODIRECT=1. With
> that flag set libreplaygain builds correctly. So there is a problem with the
> direct mode of ccache, isn't it?

The problem was that libreplaygain was ignoring users' CFLAGS. I tried to reproduce this bug, but it was fixed by http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-libs/libreplaygain/libreplaygain-465.ebuild?r1=1.2&r2=1.3 .

Please close this bug against libreplaygain and fix the summary to show that the problem was libreplaygain not respecting users' CFLAGS.

The reason that this worked without ccache, as mike pointed out in comment 1, is that for ABI=x86, gcc was producing 32-bit code even though -m32 was not being passed to gcc. This is done through mysterious (and deprecated?) mechanisms in gcc-config/binutils-config. The reason that this didn't work with ccache is that ccache does not see these mysterious mechanisms through which gcc-config adds CFLAGS to gcc's command-line because the invocation order is ccache-wraper -> gcc-config -> gcc. For this bug to be ``fixed'' in the way that the reporter requested it to be fixed, the invocation order would have to be gcc-config -> ccache-wraper -> gcc -- which makes no sense to me and probably would cause more trouble.