Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 395619 - sys-libs/glibc-2.14.1-r2 fails to compile with portage-multilib, LDFLAGS=-m64 confuses ./configure
Summary: sys-libs/glibc-2.14.1-r2 fails to compile with portage-multilib, LDFLAGS=-m64...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: portage-multilib
  Show dependency tree
 
Reported: 2011-12-22 00:09 UTC by Thomas Sachau
Modified: 2017-08-23 20:11 UTC (History)
2 users (show)

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


Attachments
build.log for glibc-2.14.1-r1 (sys-libs:glibc-2.14.1-r1:20111221-234010.log.xz,83.14 KB, application/x-xz)
2011-12-22 11:13 UTC, Thomas Sachau
Details
sys-libs:glibc-2.14.1-r2:20120110-004035.log.gz (sys-libs:glibc-2.14.1-r2:20120110-004035.log.gz,123.89 KB, text/plain)
2012-01-10 00:59 UTC, Nathan Phillip Brink (binki) (RETIRED)
Details
config.log (config.log,54.70 KB, text/plain)
2012-01-10 01:00 UTC, Nathan Phillip Brink (binki) (RETIRED)
Details
environment.gz (environment.gz,38.35 KB, text/plain)
2012-01-10 01:15 UTC, Nathan Phillip Brink (binki) (RETIRED)
Details
glibc-ldflags-multilib.patch (glibc-ldflags-multilib.patch,3.15 KB, text/plain)
2012-01-10 01:21 UTC, Nathan Phillip Brink (binki) (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Sachau gentoo-dev 2011-12-22 00:09:34 UTC
This happens on a re-compile of an already installed glibc-2.14.1-r1, it originally installed fine.

emerge --info:

Portage 2.2.0_alpha81-r1 (hardened/linux/amd64/10.0, gcc-4.5.3, glibc-2.14.1-r1, 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.6-r1, 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.7
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1-r1
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.5.3-r1
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-r1
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/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 SpanKY gentoo-dev 2011-12-22 02:32:41 UTC
full build log is ... ?
Comment 2 Thomas Sachau gentoo-dev 2011-12-22 11:13:22 UTC
Created attachment 296641 [details]
build.log for glibc-2.14.1-r1

sorry, seems like i missed the attachment
Comment 3 Thomas Sachau gentoo-dev 2011-12-23 21:42:00 UTC
This error seems to be related to the addition of CFLAGS_amd64 and LDFLAGS_amd64 to the amd64 profile.

When i compile glibc with 'CFLAGS_amd64="" LDFLAGS_amd64="" emerge -1 glibc', it compiles fine.

There might be some similar issue like bug 395615 for wine, since multilib-portage does add the mentioned flags to the user flags.
Comment 4 SpanKY gentoo-dev 2011-12-27 00:50:12 UTC
you need to sort this out.  the availability of the env vars should not break your build style.
Comment 5 Thomas Sachau gentoo-dev 2011-12-27 21:24:29 UTC
You would get the exact same result, if a user on amd64 adds -m64 to C{,XX}FLAGS. This should not change the behaviour at all, since it does just explicitly specify the flag for amd64.
Anything building for a different target should specify it explicitly and in a place, where it does overwrite especially the user settings for target flags. This means, the e.g. -m32 to build for x86 should be AFTER $C{,XX}FLAGS in the compiler lines.
This part is broken for wine (bug 395615) and probably also broken for multilib glibc.
Comment 6 SpanKY gentoo-dev 2012-01-02 23:59:51 UTC
i don't think that is true.  the glibc ebuild explicitly filters out things like -m64 from user CFLAGS.  although i'd be inclined to tell such a user to stop being stupid and putting useless things like -m64 in their CFLAGS.
Comment 7 Thomas Sachau gentoo-dev 2012-01-03 18:34:55 UTC
I did some further compile tests and it seems, like the addition of CFLAGS_amd64=-m64 to profiles together with the addition of CFLAGS_${target_abi} to LDFLAGS in multilib-portage does cause this failure.

Looking at the ebuild, it does filter -m64 from CFLAGS, CXXFLAGS and some other vars with the filter-flags function. But this function does not filter LDFLAGS.

So with LDFLAGS=".... -m64", the build seems to fail, also this flag does not occur anywhere in the build.log, so might be some changed behaviour because of this environment var.
Comment 8 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2012-01-10 00:59:00 UTC
Created attachment 298437 [details]
sys-libs:glibc-2.14.1-r2:20120110-004035.log.gz
Comment 9 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2012-01-10 01:00:50 UTC
Created attachment 298439 [details]
config.log
Comment 10 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2012-01-10 01:14:53 UTC
As tommy said, portage-multilib's method of multilib -- putting ${CFLAGS_${ABI}} into CFLAGS, CCASFLAGS, CXXFLAGS, etc., and LDFLAGS -- is causing the above error. I think that you can see that some gcc calls done by ./configure from attachment 298439 [details] have -m64 after -m32 for the x86 ABI compilation and other places where -m32 is the only flag. I'm certain this must cause the error in pthread_kill_other_threads.c because reworking the sys-libs/glibc eblits to override LDFLAGS fixes this compilation error and results in a working glibc.

I know that users should not be doing things like `CFLAGS=-m64 LDFLAGS=-m64 CXXFLAGS=-m64 emerge glibc', but for _most_ packages in portage this works great when portage-multilib manages these flags in this way. Also, LDFLAGS is necessary here because, as discussed elsewhere, buildsystem writers are unwilling to respect CFLAGS at linking time. Thus I think it is necessary to use this method as it covers generally everything. Crazy LDFLAGS is just something which the glibc ebuild did not anticipate. Secondly, filtering out -m32 and -m64 (and how about -mx32? ;-)) is not the way to fix this problem in the glibc ebuild. Setting both CC="${CHOST}-gcc ${CFLAGS_${ABI}}" _and_ CFLAGS="${CFLAGS} ${CFLAGS_${ABI}}" (and so-on for LDFLAGS, CXXFLAGS, etc.) works without filtering out flags. The ugly thing about it is that you might see the following in your build.log for the ABI=x86 portion:

  x86_64-pc-linux-gnu-gcc -m32 -o version.o version.c -Wall -pipe -O2 -m64 -m32

and in other places (where glibc ignores CFLAGS and friends, rendering insertion of CFLAGS_${ABI} into CC necessary):

  x86_64-pc-linux-gnu-gcc -m32 -o version.o version.c

But at least in the above cases the 32-bit code is properly compiled.
Comment 11 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2012-01-10 01:15:42 UTC
Created attachment 298443 [details]
environment.gz
Comment 12 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2012-01-10 01:21:46 UTC
Created attachment 298445 [details]
glibc-ldflags-multilib.patch

This is not the most organized patch.

- It adds CPPFLAGS and LDFLAGS to the verbose output of what flags are
  used during glibc's compilation.

- It adds LDFLAGS to the list of envvars which are filtered for -m32
  and friends, as well as the list which is saved and preserved for
  reuse.

- It starts appending CFLAGS_${ABI} to LDFLAGS, CFLAGS, CXXFLAGS, and
  ASFLAGS so as to override portage-multilib's appended
  CFLAGS_${PORTAGE_MULTILIB_ABI}.

- It adds -mx32 to the list of -m32 and -m64 which are filtered out of
  flags... even though that whole line of filtering flags is pointless
  except for creating more aesthetic/readable build.logs.

Thanks for any suggestions and criticisms in advance :-).
Comment 13 SpanKY gentoo-dev 2012-01-10 20:56:09 UTC
Comment on attachment 298445 [details]
glibc-ldflags-multilib.patch

+	LDFLAGS=${LDFLAGS_BASE:=${LDFLAGS}}

pretty sure that's wrong

-	filter-flags -m32 -m64 -mabi=*
+	filter-flags -m32 -m64 -mx32 -mabi=*
+	filter-ldflags -m32 -m64 -mx32 -mabi=*

i think it makes more sense to update filter-flags in flag-o-matic to implicitly operate on LDFLAGS

 	: ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})}
-	export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+	CFLAGS="${CFLAGS} ${!VAR}"
+	CXXFLAGS="${CXXFLAGS} ${!VAR}"
+	ASFLAGS="${ASFLAGS} ${!VAR}"
+       <more stuff>

i'm not sure about this hunk.  this has been carefully curated in the past to deal with cross-compiling and such.  it'll need verification with multiple crossdev runs.

--- files/eblits/src_compile.eblit
+++ files/eblits/src_compile.eblit

changes to this file look fine regardless of anything else
Comment 14 SpanKY gentoo-dev 2012-01-13 22:44:49 UTC
filter-flags now operates on LDFLAGS too:
http://sources.gentoo.org/eclass/flag-o-matic.eclass?r1=1.163&r2=1.164

the compile output now includes more *FLAGS variables, and LDFLAGS is reset when building up the headers:
http://sources.gentoo.org/sys-libs/glibc/files/eblits/src_compile.eblit?r1=1.21&r2=1.22
Comment 15 Andreas K. Hüttel archtester gentoo-dev 2017-08-23 20:11:50 UTC
The mentioned versions are long gone. Please reopen if this is still an issue.