Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 389869 - sys-devel/gcc-4.6.1-r1 fails to build on prefix due to mpfr problem
Summary: sys-devel/gcc-4.6.1-r1 fails to build on prefix due to mpfr problem
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-08 10:14 UTC by Jordi Paul
Modified: 2011-12-17 14:07 UTC (History)
0 users

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


Attachments
gzipped Build log (build.log.gz,84.59 KB, application/octet-stream)
2011-11-08 10:16 UTC, Jordi Paul
Details
build log with configure error (build.log,9.04 KB, text/plain)
2011-11-30 07:42 UTC, Jordi Paul
Details
Build log for gcc-4.5.3-r1 with mpfr-3.1.0 (build.log,8.87 KB, text/plain)
2011-11-30 14:52 UTC, Jordi Paul
Details
config.log for building gcc-4.5.3-r1 with mpfr-3.1.0 (config.log,22.57 KB, text/plain)
2011-11-30 14:56 UTC, Jordi Paul
Details
build log for mpc-0.9-r1 (build.log,41.40 KB, text/plain)
2011-12-02 07:12 UTC, Jordi Paul
Details
config log for mpc-0.9-r1 (config.log,30.27 KB, text/plain)
2011-12-02 07:13 UTC, Jordi Paul
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jordi Paul 2011-11-08 10:14:17 UTC
Build fails with fortran/arith.c:52: undefined reference to `mpfr_get_z_2exp', so it seems libmpfr related.

Reproducible: Always

Steps to Reproduce:
1. Unmask sys-devel/gcc-4.6.1-r1
2. emerge -1 gcc

Actual Results:  
Build fails.

Expected Results:  
Successful emerge.

My amd64 box at work runs Ubuntu 10.04 and I set up Gentoo Prefix in my home. Due to bug 362315 , I had to enable USE=vanilla for gcc-4.6.1-r1, 

Since this could be libmpfr related (mpfr_get_z_exp has been renamed mpfr_get_z_2exp somewhen in the past): My prefix installation uses def-libs/libmpfr-3.0.1 and dev-libs/mpc-0.9.

emerge --info:
Portage 2.2.01.19572-prefix (prefix/linux/amd64, gcc-4.5.3, unavailable, 2.6.32-34-generic x86_64)
=================================================================
System uname: Linux-2.6.32-34-generic-x86_64-Dual_Core_AMD_Opteron-tm-_Processor_280-with-debian-squeeze-sid
Timestamp of tree: Tue, 08 Nov 2011 06:10:01 +0000
app-shells/bash:      4.2_p10
dev-lang/python:      2.7.2
dev-util/cmake:       2.8.6-r3
dev-util/pkgconfig:   0.26
sys-devel/autoconf:   2.68
sys-devel/automake:   1.11.1
sys-devel/binutils:   2.21.53.0.2
sys-devel/gcc:        4.5.3-r1
sys-devel/gcc-config: 1.4.1-r00.2
sys-devel/libtool:    2.4-r4
sys-devel/make:       3.82
Repositories: gentoo_prefix x-local_ebuilds
Installed sets: 
ACCEPT_KEYWORDS="~amd64 ~amd64-linux"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/portage /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer"
DISTDIR="/home/paul/gentoo/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs collision-protect distlocks ebuild-locks fixlafiles news parallel-fetch preserve-libs protect-owned sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j9"
PKGDIR="/home/paul/gentoo/usr/portage/packages"
PORTAGE_CONFIGROOT="/home/paul/gentoo/"
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/paul/gentoo/var/tmp"
PORTDIR="/home/paul/gentoo/usr/portage"
PORTDIR_OVERLAY="/home/paul/gentoo/local_ebuilds"
SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"
USE="amd64 berkdb blas bzip2 cli cracklib crypt cxx dri fortran gdbm iconv ipv6 mmx modules mudflap ncurses nls nptl nptlonly openmp pcre pdf pppd prefix python readline session sse sse2 ssl sysfs tcpd 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" 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 evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" 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, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Jordi Paul 2011-11-08 10:16:14 UTC
Created attachment 291957 [details]
gzipped Build log

Added gzipped build log (it's 2 MB otherwise)
Comment 2 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-11-16 16:16:16 UTC
We should probably get 3.1.0 in the tree.
Comment 3 Jordi Paul 2011-11-24 07:47:29 UTC
(Please note that I have no clue whatsoever about ebuilds, so what I did may contain stupid mistakes.)

I took the mpfr-3.1.0 ebuild from the main tree and did three trivial changes. Here is the diff:

3c3
< # $Header: /var/cvsroot/gentoo-x86/dev-libs/mpfr/mpfr-3.1.0.ebuild,v 1.1 2011/10/03 17:43:00 vapier Exp $
---
> # $Header: 
19c19
< KEYWORDS="~amd64"
---
> KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
47c47
< 		--docdir=/usr/share/doc/${PF} \
---
> 		--docdir=${EPREFIX}/usr/share/doc/${PF} \
56c56
< 	pushd "${D}"/usr/share/doc/${PF} >/dev/null
---
> 	pushd "${D}"${EPREFIX}/usr/share/doc/${PF} >/dev/null

With this, mpfr emerges just fine (although that pushd looks weird), but the compilation of gcc fails in the configure phase:

checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.

Said libraries are in ${EPREFIX}/usr/lib so I have no clue about this error.
Comment 4 Benda Xu gentoo-dev 2011-11-25 19:39:38 UTC
Hi, Jordi, your modifications are right, just replace "${D}"${EPREFIX} with a shortcut "${ED}".

have a look at my updates at bug 391799
Comment 5 Jordi Paul 2011-11-29 07:34:49 UTC
Thanks for getting 3.1.0 in the tree and patched up!

The configure problem still persists, though. Since this only popped up after the mpfr update, it's most likely libmpfr, but I do not know how to make sure it isn't mpc or gmp that is causing this error.
Comment 6 Fabian Groffen gentoo-dev 2011-11-29 07:51:14 UTC
so, mpfr is now successfully installed, and gcc still claims it cannot find (the right) mpfr/gmp/mpc libs?

Are you using Prefix gcc/ld, or are you attempting to build that one?
Comment 7 Jordi Paul 2011-11-29 08:10:16 UTC
Exactly. I am using the prefix gcc-4.5.3, which was built against the old mpfr-3.0.1. But 4.5.3 also fails with the same configure error when I try to build it with mpfr-3.1.0.
Comment 8 Benda Xu gentoo-dev 2011-11-29 11:01:40 UTC
(In reply to comment #7)
> Exactly. I am using the prefix gcc-4.5.3, which was built against the old
> mpfr-3.0.1. But 4.5.3 also fails with the same configure error when I try to
> build it with mpfr-3.1.0.

Please paste the detailed configure error.

I am using exactly the same versions gcc-4.5.3-r1 with mpfr-3.1.0, gmp-5.0.2_p1 and mpc-0.9-r1 on many servers, including Fedora Core 3 and 10, Red Hat EL 5.[56], and Centos 4.9, x86-linux and amd64-linux. 

Let's see what goes wrong.
Comment 9 Benda Xu gentoo-dev 2011-11-29 11:08:03 UTC
Also, paste "nm -D ${EPREFIX}/usr/lib/libmpfr.so | grep mpfr_get_z_2exp" please.
Comment 10 Fabian Groffen gentoo-dev 2011-11-29 17:53:32 UTC
maybe we should "wild retreat" on mpfr here, due to bug #390425
Comment 11 Jordi Paul 2011-11-30 07:40:13 UTC
The configure error is the one described above. I'll attach the whole build.log.

nm -D ${EPREFIX}/usr/lib/libmpfr.so | grep mpfr_get_z_2exp returns 
    0000000000024ab0 T mpfr_get_z_2exp
so the symbol is there.

For completeness, my emerge --info

emerge --info 
Portage 2.2.01.19572-prefix (prefix/linux/amd64, gcc-4.5.3, unavailable, 2.6.32-35-generic x86_64)
=================================================================
System uname: Linux-2.6.32-35-generic-x86_64-Dual_Core_AMD_Opteron-tm-_Processor_280-with-debian-squeeze-sid
Timestamp of tree: Tue, 29 Nov 2011 06:10:49 +0000
app-shells/bash:      4.2_p10
dev-lang/python:      2.7.2-r3
dev-util/cmake:       2.8.6-r3
dev-util/pkgconfig:   0.26
sys-devel/autoconf:   2.68
sys-devel/automake:   1.11.1
sys-devel/binutils:   2.21.53.0.2
sys-devel/gcc:        4.5.3-r1
sys-devel/gcc-config: 1.4.1-r00.2
sys-devel/libtool:    2.4-r4
sys-devel/make:       3.82
Repositories: gentoo_prefix klumpatsch
Installed sets: 
ACCEPT_KEYWORDS="~amd64 ~amd64-linux"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/portage /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer"
DISTDIR="/home/paul/gentoo/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs collision-protect distlocks ebuild-locks fixlafiles news parallel-fetch preserve-libs protect-owned sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j9"
PKGDIR="/home/paul/gentoo/usr/portage/packages"
PORTAGE_CONFIGROOT="/home/paul/gentoo/"
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/paul/gentoo/var/tmp"
PORTDIR="/home/paul/gentoo/usr/portage"
PORTDIR_OVERLAY="/home/paul/gentoo/local_ebuilds"
SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"
USE="amd64 berkdb blas bzip2 cli cracklib crypt cxx dri fortran gdbm iconv ipv6 mmx modules mudflap ncurses nls nptl nptlonly openmp pcre pdf pppd prefix python readline session sse sse2 ssl sysfs tcpd 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" 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 evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" 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, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 12 Jordi Paul 2011-11-30 07:42:07 UTC
Created attachment 294285 [details]
build log with configure error

This contains the configure error when trying to build gcc with mpfr-3.1.0
Comment 13 Benda Xu gentoo-dev 2011-11-30 09:07:11 UTC
(In reply to comment #12)
> Created attachment 294285 [details]
> build log with configure error
> 
> This contains the configure error when trying to build gcc with mpfr-3.1.0

Hi, Jordi. Does gcc-4.5-3 building (using gcc-4.5.3_mpfr-3.0.1 to build gcc-4.5.3_mpfr-3.1.0) fail with exactly the same error? Could you please paste the build.log and config.log too?

For gcc-4.6, I myself haven't tested on Prefix yet.
Comment 14 Jordi Paul 2011-11-30 14:52:10 UTC
Created attachment 294325 [details]
Build log for gcc-4.5.3-r1 with mpfr-3.1.0

The build of gcc-4.5.3-r1 with mpfr-3.1.0 fails with the same configure error. Before that, I rebuilt mpfr-3.1.0 with FEATURES=test, and it passed all tests:
... snip ...
[tversion] GMP: header 5.0.2, library 5.0.2
[tversion] MPFR tuning parameters from default
PASS: tversion
====================
All 160 tests passed
(1 test was not run)

...snip..
Comment 15 Jordi Paul 2011-11-30 14:56:24 UTC
Created attachment 294327 [details]
config.log for building gcc-4.5.3-r1 with mpfr-3.1.0
Comment 16 Benda Xu gentoo-dev 2011-12-01 03:52:08 UTC
(In reply to comment #15)
> Created attachment 294327 [details]
> config.log for building gcc-4.5.3-r1 with mpfr-3.1.0

Thanks, the clue comes from here in config.log... why is your libmpc linked against /usr/lib64/libmpfr.so.1...

Paste a "ldd ${EPREFIX}/usr/lib/libmpc.so" please.


configure:5665: x86_64-pc-linux-gnu-gcc -o conftest -O2 -pipe   -Wl,-O1 conftest.c  -lmpc -lmpfr -lgmp >&5
/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: warning: libmpfr.so.1, needed by /home/paul/gentoo/usr/lib/libmpc.so, may conflict with libmpfr.so.4
/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: __gmpfr_cache_const_euler: TLS definition in /home/paul/gentoo/usr/lib/libmpfr.so section .tdata mismatches non-TLS definition in /usr/lib64/libmpfr.so.1 section .data
/usr/lib64/libmpfr.so.1: could not read symbols: Bad value
collect2: ld returned 1 exit status
Comment 17 Benda Xu gentoo-dev 2011-12-01 03:55:09 UTC
(In reply to comment #15)
> Created attachment 294327 [details]
> config.log for building gcc-4.5.3-r1 with mpfr-3.1.0

BTW, pasting "readelf -d ${EPREFIX}/usr/lib/libmpc.so" would be helpful, too.
Comment 18 Jordi Paul 2011-12-01 07:07:45 UTC
ldd ${EPREFIX}/usr/lib/libmpc.so                                                                                              

	linux-vdso.so.1 =>  (0x00007fff325ff000)
	libmpfr.so.1 => /usr/lib/libmpfr.so.1 (0x00007f77c4844000)
	libgmp.so.3 => /usr/lib/libgmp.so.3 (0x00007f77c45e3000)
	libm.so.6 => /lib/libm.so.6 (0x00007f77c4360000)
	libc.so.6 => /lib/libc.so.6 (0x00007f77c3fdd000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f77c4cd7000)

So mpc is linked to the system mpfr and gmp instead of the prefix ones. I guess this should not happen, so what might have caused this? Just to be sure I rebuilt mpc, but this problem stays. My impression was that my prefix was a fairly standard one, but something seems seriously broken.

readelf -d ${EPREFIX}/usr/lib/libmpc.so                                                                                       

Dynamic section at offset 0x14db0 contains 27 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libmpfr.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libgmp.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [libmpc.so.2]
 0x000000000000000f (RPATH)              Library rpath: [/home/paul/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc:/home/paul/gentoo/usr/x86_64-pc-linux-gnu/lib:/home/paul/gentoo/lib:/home/paul/gentoo/usr/lib]
 0x000000000000001d (RUNPATH)            Library runpath: [/home/paul/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc:/home/paul/gentoo/usr/x86_64-pc-linux-gnu/lib:/home/paul/gentoo/lib:/home/paul/gentoo/usr/lib]
 0x000000000000000c (INIT)               0x4730
 0x000000000000000d (FINI)               0x12df8
 0x0000000000000004 (HASH)               0x1c8
 0x000000006ffffef5 (GNU_HASH)           0xc88
 0x0000000000000005 (STRTAB)             0x2898
 0x0000000000000006 (SYMTAB)             0x1230
 0x000000000000000a (STRSZ)              3036 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x214fe8
 0x0000000000000002 (PLTRELSZ)           4008 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x3788
 0x0000000000000007 (RELA)               0x3698
 0x0000000000000008 (RELASZ)             240 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x3658
 0x000000006fffffff (VERNEEDNUM)         1
 0x000000006ffffff0 (VERSYM)             0x3474
 0x000000006ffffff9 (RELACOUNT)          1
 0x0000000000000000 (NULL)               0x0
Comment 19 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-12-01 13:03:39 UTC
There is a seemingly related bug out there recently, bug 392655
Comment 20 Benda Xu gentoo-dev 2011-12-01 13:47:36 UTC
(In reply to comment #18)
> ldd ${EPREFIX}/usr/lib/libmpc.so                                                
> 
>     linux-vdso.so.1 =>  (0x00007fff325ff000)
>     libmpfr.so.1 => /usr/lib/libmpfr.so.1 (0x00007f77c4844000)
>     libgmp.so.3 => /usr/lib/libgmp.so.3 (0x00007f77c45e3000)
>     libm.so.6 => /lib/libm.so.6 (0x00007f77c4360000)
>     libc.so.6 => /lib/libc.so.6 (0x00007f77c3fdd000)
>     /lib64/ld-linux-x86-64.so.2 (0x00007f77c4cd7000)
> 
> So mpc is linked to the system mpfr and gmp instead of the prefix ones. I guess
> this should not happen, so what might have caused this? Just to be sure I
> rebuilt mpc, but this problem stays. My impression was that my prefix was a
> fairly standard one, but something seems seriously broken.

Hmmm, interesting... Just played around at my debian Squeeze box (should be the nearest distro to Ubuntu 10.04) I guess during the configure of mpc, it looked into /usr/include first to get gmp.h and mpfr.h.

Just paste 'cpp --verbose' and 'gcc-config -l' and lets see.
Comment 21 Benda Xu gentoo-dev 2011-12-01 15:08:43 UTC
(In reply to comment #19)
> There is a seemingly related bug out there recently, bug 392655

Hmm... Yeah. I am wondering why mpc caused lots of issues recently.

I guess this bug is due to cpp incdir search path, and bug 392655 is due to gcc libdir search path.
Comment 22 Jordi Paul 2011-12-01 15:12:26 UTC
Ok, here we go:

cpp --verbose 
Using built-in specs.
COLLECT_GCC=/home/paul/gentoo/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3/cpp
COLLECT_LTO_WRAPPER=/home/paul/gentoo/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/paul/gentoo/var/tmp/portage/sys-devel/gcc-4.5.3-r1/work/gcc-4.5.3/configure --prefix=/home/paul/gentoo/usr --bindir=/home/paul/gentoo/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3 --includedir=/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include --datadir=/home/paul/gentoo/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3 --mandir=/home/paul/gentoo/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3/man --infodir=/home/paul/gentoo/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3/info --with-gxx-include-dir=/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.5.3/python --enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --with-local-prefix=/home/paul/gentoo/usr --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.3-r1 p1.0, pie-0.4.5'
Thread model: posix
gcc version 4.5.3 (Gentoo 4.5.3-r1 p1.0, pie-0.4.5) 
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
 /home/paul/gentoo/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/cc1 -E -quiet -v - -D_FORTIFY_SOURCE=2 -mtune=generic -march=x86-64
ignoring nonexistent directory "/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/paul/gentoo/usr/include
 /home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include
 /home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include-fixed
 /usr/include
End of search list.

The prefix include paths are listed first, so this looks like it should, right?

gcc-config -l
 [1] x86_64-pc-linux-gnu-4.5.3 *


392655 looks indeed related and mpc REALLY links to the system libmpfr and libgmp during compilation.
Comment 23 Benda Xu gentoo-dev 2011-12-01 16:31:43 UTC
(In reply to comment #22)
> The prefix include paths are listed first, so this looks like it should, right?

Yeah, you are right. 

> 392655 looks indeed related and mpc REALLY links to the system libmpfr and
> libgmp during compilation.

indeed.

Then we will have to look into the config.log and build.log for mpc to figure out where /usr/include/gmp.h comes in. Could you please attach those?

HINT
====
In order to get config.log and build.log for mpc, use ebuild instead of emerge (which will delete tmp build files after a success build):

ebuild ${EPREFIX}/usr/portage/dev-libs/mpc/mpc-0.9-r1.ebuild compile

and get config.log and build.log as usual.
Comment 24 Benda Xu gentoo-dev 2011-12-02 02:15:38 UTC
(In reply to comment #22)

>  /home/paul/gentoo/usr/include

just for a quick verification, do you really have /home/paul/gentoo/usr/include/{gmp.h,mpfr.h} ?

Another possibility is to emerge gcc-4.2.4 and use it to compile mpc, mpfr and gmp, and then gcc-4.5.3 to see if the problem still exists.
Comment 25 Benda Xu gentoo-dev 2011-12-02 02:21:35 UTC
Oh, you are accepting the "~amd64" keyword. Is there a strong reason for that?

ebuild with only ~amd64 has not been confirmed to work with prefix yet. Usually we only accept ~amd64-linux.
Comment 26 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-12-02 04:17:08 UTC
(and a month old tree, which is years in prefix)
Comment 27 Jordi Paul 2011-12-02 07:09:45 UTC
(In reply to comment #24)
> (In reply to comment #22)
> 
> >  /home/paul/gentoo/usr/include
> 
> just for a quick verification, do you really have
> /home/paul/gentoo/usr/include/{gmp.h,mpfr.h} ?
> 
> Another possibility is to emerge gcc-4.2.4 and use it to compile mpc, mpfr and
> gmp, and then gcc-4.5.3 to see if the problem still exists.

Yes, the header files are there.  I'll try the gcc-4.2 route.

The ~amd64 keyword was a copy-paste error and I removed it, but I had nothing installed that was not ~amd64-linux anyway.
Comment 28 Jordi Paul 2011-12-02 07:12:55 UTC
Created attachment 294481 [details]
build log for mpc-0.9-r1
Comment 29 Jordi Paul 2011-12-02 07:13:51 UTC
Created attachment 294483 [details]
config log for mpc-0.9-r1
Comment 30 Benda Xu gentoo-dev 2011-12-02 08:46:15 UTC
(In reply to comment #27)
> (In reply to comment #24)
> > (In reply to comment #22)
> > 
> > >  /home/paul/gentoo/usr/include
> > 
> > just for a quick verification, do you really have
> > /home/paul/gentoo/usr/include/{gmp.h,mpfr.h} ?
> > 
> > Another possibility is to emerge gcc-4.2.4 and use it to compile mpc, mpfr and
> > gmp, and then gcc-4.5.3 to see if the problem still exists.
> 
> Yes, the header files are there.  I'll try the gcc-4.2 route.
> 
> The ~amd64 keyword was a copy-paste error and I removed it, but I had nothing
> installed that was not ~amd64-linux anyway.

Hi Jordi, I could find no clue inside the logs. They look quite normal :(
Comment 31 Jordi Paul 2011-12-12 12:38:27 UTC
(In reply to comment #30)
> (In reply to comment #27)
> > (In reply to comment #24)
> > > (In reply to comment #22)
> > > 
> > > >  /home/paul/gentoo/usr/include
> > > 
> > > just for a quick verification, do you really have
> > > /home/paul/gentoo/usr/include/{gmp.h,mpfr.h} ?
> > > 
> > > Another possibility is to emerge gcc-4.2.4 and use it to compile mpc, mpfr and
> > > gmp, and then gcc-4.5.3 to see if the problem still exists.
> > 
> > Yes, the header files are there.  I'll try the gcc-4.2 route.
> > 
> > The ~amd64 keyword was a copy-paste error and I removed it, but I had nothing
> > installed that was not ~amd64-linux anyway.
> 
> Hi Jordi, I could find no clue inside the logs. They look quite normal :(

I compiled gcc-4.2.4 and used that the rebuild those libraries and gcc-4.5.3 - nothing changed. My situation looks different than the one in bug 392655 , as the prefix paths come before the system paths:

LIBRARY_PATH=/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/:/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/lib/../lib/:/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../lib/:/lib/../lib64/:/usr/lib/../lib64/:/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/lib/:/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../:/lib/:/usr/lib/

Could you check if your libmpc is linked to your prefix libmpfr/libgmp?
Comment 32 Benda Xu gentoo-dev 2011-12-12 13:12:33 UTC
(In reply to comment #31)

> I compiled gcc-4.2.4 and used that the rebuild those libraries and gcc-4.5.3 -
> nothing changed. My situation looks different than the one in bug 392655 , as
> the prefix paths come before the system paths:
> 
> LIBRARY_PATH=/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/:/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/lib/../lib/:/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../lib/:/lib/../lib64/:/usr/lib/../lib64/:/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/lib/:/home/paul/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../:/lib/:/usr/lib/
> 
> Could you check if your libmpc is linked to your prefix libmpfr/libgmp?

sure:

$ ldd ~/gentoo/usr/lib/libmpc.so
        libmpfr.so.4 => /localwork/benda/gentoo/usr/lib/libmpfr.so.4 (0x00002b58ad160000)
        libgmp.so.10 => /localwork/benda/gentoo/usr/lib/libgmp.so.10 (0x00002b58ad3be000)
        libm.so.6 => /lib64/libm.so.6 (0x00002b58ad647000)
        libc.so.6 => /lib64/libc.so.6 (0x00002b58ad8cb000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003ad8e00000)
Comment 33 Fabian Groffen gentoo-dev 2011-12-15 16:41:07 UTC
Can you please try without USE=vanilla?  That's supposed to break on Prefix, and a likely cause of this.
Comment 34 Jordi Paul 2011-12-17 14:07:41 UTC
(In reply to comment #33)
> Can you please try without USE=vanilla?  That's supposed to break on Prefix,
> and a likely cause of this.

I was not aware of this. Indeed, gcc-4.6.1 now compiles fine, even though libmpc is still linked to the system libmpfr and libgmp, I thought this was the main problem and did not try to compile gcc again after the automatic fortify patches were disabled for host with an old glibc, making USE=vanilla unnecessary.

So thanks for all the help!