'emerge dev-libs/mpc' fails. I'm running an amd64 prefix on a CentOS 5 host. It seems that the failure is a result of the mpc build attempting to link against a libmpfr.a that is not inside $EPREFIX. Reproducible: Always Steps to Reproduce: 1. emerge dev-libs/mpc Actual Results: I get the following error: /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linu x-gnu/bin/ld: /usr/lib/../lib64/libmpfr.a(exceptions.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPI C /usr/lib/../lib64/libmpfr.a: could not read symbols: Bad value collect2: ld returned 1 exit status Expected Results: The build should not fail. Linking $EPREFIX/usr/lib -> $EPREFIX/usr/lib64 makes the mpc build pick up the correct libmpfr.a library. A conversation on the IRC has convinced me that this link is wrong.
Created attachment 294365 [details] emerge --oneshot dev-libs/mpc --jobs 1 Attaching the entire build output, in case that's useful for anyone.
Created attachment 294379 [details] emerge sys-devel/gcc --oneshot --jobs 1 sys-devel/gcc-4.5.3 has a similar error when I try to build it /scratch/gentoo/usr/x86_64-pc-linux-gnu/bin/ld: __gmpfr_default_rounding_mode: TLS definition in /scratch/gentoo/usr/lib/libmpfr.so.4 section .tbss mismatches non-TLS definition in /usr/lib/../lib64/libmpfr.a(set_rnd.o) section .bss /scratch/gentoo/usr/lib/libmpfr.so.4: could not read symbols: Bad value collect2: ld returned 1 exit status this error is not fixed by linking lib -> lib64. The entire build log is attached (note that it's 1.7M uncompressed, so I attached the compressed version).
Checked on my CentOS 5 amd64: no problem This is strange.. for all the messes of mpc... passing --with-mpfr --with-gmp explicitly to configure would be a dirty fix.
Hi, Palmer, Please paste gcc -print-search-dirs | grep libraries | cut -c13- | tr -s ":" "\n" | xargs realpath inside prefix.
oh the previous one is "gcc -print-search-dirs | grep libraries | cut -c13- | tr -s ":" "\n" | xargs realpath", without line break. also "cpp --verbose" please.
I do not have the whole build log, but the relevant part is: libtool: link: x86_64-pc-linux-gnu-gcc -shared .libs/abs.o .libs/acos.o .libs/acosh.o .libs/add.o .libs/add_fr.o .libs/add_si.o .libs/add_ui.o .libs/arg.o .libs/asin.o .libs/asinh.o .libs/atan.o .libs/atanh.o .libs/clear.o .libs/cmp.o .libs/cmp_si_si.o .libs/conj.o .libs/cosh.o .libs/div_2exp.o .libs/div.o .libs/div_fr.o .libs/div_ui.o .libs/exp.o .libs/fma.o .libs/fr_div.o .libs/fr_sub.o .libs/get.o .libs/get_prec2.o .libs/get_prec.o .libs/get_str.o .libs/get_version.o .libs/imag.o .libs/init2.o .libs/init3.o .libs/inp_str.o .libs/log.o .libs/mem.o .libs/mul_2exp.o .libs/mul.o .libs/mul_fr.o .libs/mul_i.o .libs/mul_si.o .libs/mul_ui.o .libs/neg.o .libs/norm.o .libs/out_str.o .libs/pow.o .libs/pow_fr.o .libs/pow_ld.o .libs/pow_d.o .libs/pow_si.o .libs/pow_ui.o .libs/pow_z.o .libs/proj.o .libs/real.o .libs/urandom.o .libs/set.o .libs/set_prec.o .libs/set_str.o .libs/set_x.o .libs/set_x_x.o .libs/sin_cos.o .libs/sinh.o .libs/sqr.o .libs/sqrt.o .libs/strtoc.o .libs/sub.o .libs/sub_fr.o .libs/sub_ui.o .libs/swap.o .libs/tan.o .libs/tanh.o .libs/uceil_log2.o .libs/ui_div.o .libs/ui_ui_sub.o /usr/lib/libmpfr.so /usr/lib/libgmp.so -lm -Wl,-O1 -Wl,-soname -Wl,libmpc.so.2 -o .libs/libmpc.so.2.0.0 So this really links to the system libraries instead of the prefix ones.
(In reply to comment #6) > I do not have the whole build log, but the relevant part is: > > libtool: link: x86_64-pc-linux-gnu-gcc -shared .libs/abs.o .libs/acos.o > .libs/acosh.o .libs/add.o .libs/add_fr.o .libs/add_si.o .libs/add_ui.o > .libs/arg.o .libs/asin.o .libs/asinh.o .libs/atan.o .libs/atanh.o .libs/clear.o > .libs/cmp.o .libs/cmp_si_si.o .libs/conj.o .libs/cosh.o .libs/div_2exp.o > .libs/div.o .libs/div_fr.o .libs/div_ui.o .libs/exp.o .libs/fma.o > .libs/fr_div.o .libs/fr_sub.o .libs/get.o .libs/get_prec2.o .libs/get_prec.o > .libs/get_str.o .libs/get_version.o .libs/imag.o .libs/init2.o .libs/init3.o > .libs/inp_str.o .libs/log.o .libs/mem.o .libs/mul_2exp.o .libs/mul.o > .libs/mul_fr.o .libs/mul_i.o .libs/mul_si.o .libs/mul_ui.o .libs/neg.o > .libs/norm.o .libs/out_str.o .libs/pow.o .libs/pow_fr.o .libs/pow_ld.o > .libs/pow_d.o .libs/pow_si.o .libs/pow_ui.o .libs/pow_z.o .libs/proj.o > .libs/real.o .libs/urandom.o .libs/set.o .libs/set_prec.o .libs/set_str.o > .libs/set_x.o .libs/set_x_x.o .libs/sin_cos.o .libs/sinh.o .libs/sqr.o > .libs/sqrt.o .libs/strtoc.o .libs/sub.o .libs/sub_fr.o .libs/sub_ui.o > .libs/swap.o .libs/tan.o .libs/tanh.o .libs/uceil_log2.o .libs/ui_div.o > .libs/ui_ui_sub.o /usr/lib/libmpfr.so /usr/lib/libgmp.so -lm -Wl,-O1 > -Wl,-soname -Wl,libmpc.so.2 -o .libs/libmpc.so.2.0.0 > > So this really links to the system libraries instead of the prefix ones. Yeah, this is the same as build.log for mpc you have attached. Please have a look at Comment 5 and paste the two outputs. I suspect that gcc does not have a correct default search path.
Sorry for the slow reply (In reply to comment #5) > oh the previous one is "gcc -print-search-dirs | grep libraries | cut -c13- | > tr -s ":" "\n" | xargs realpath", without line break. pdabbelt ld-8 ~ $ gcc -print-search-dirs | grep libraries | cut -c13- | > tr -s ":" "\n" | xargs realpath /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3 /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/lib/x86_64-pc-linux-gnu/4.5.3/: No such file or directory /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/lib/../lib64/: No such file or directory /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../x86_64-pc-linux-gnu/4.5.3/: No such file or directory /scratch/gentoo/usr/lib /lib/x86_64-pc-linux-gnu/4.5.3/: No such file or directory /lib64 /usr/lib/x86_64-pc-linux-gnu/4.5.3/: No such file or directory /usr/lib64 /scratch/gentoo/usr/x86_64-pc-linux-gnu/lib /scratch/gentoo/usr/lib /lib /usr/lib > also "cpp --verbose" please. "cpp --verbose" seems to want something on stdin and gives move info when I ^D, so I did this pdabbelt ld-8 ~ $ echo "" | cpp --verbose Using built-in specs. COLLECT_GCC=/scratch/gentoo/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3/cpp COLLECT_LTO_WRAPPER=/scratch/gentoo/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /scratch/gentoo/var/tmp/portage/sys-devel/gcc-4.5.3-r1/work/gcc-4.5.3/configure --prefix=/scratch/gentoo/usr --bindir=/scratch/gentoo/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3 --includedir=/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include --datadir=/scratch/gentoo/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3 --mandir=/scratch/gentoo/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3/man --infodir=/scratch/gentoo/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.3/info --with-gxx-include-dir=/scratch/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 --disable-libmudflap --disable-libssp --disable-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++ --enable-shared --enable-threads=posix --with-local-prefix=/scratch/gentoo/usr --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.3-r1' Thread model: posix gcc version 4.5.3 (Gentoo 4.5.3-r1) COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64' /scratch/gentoo/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/cc1 -E -quiet -v - -mtune=generic -march=x86-64 ignoring nonexistent directory "/scratch/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: /scratch/gentoo/usr/include /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include-fixed /usr/include End of search list. # 1 "<stdin>" # 1 "<built-in>" # 1 "<command-line>" # 1 "<stdin>" COMPILER_PATH=/scratch/gentoo/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/:/scratch/gentoo/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/:/scratch/gentoo/usr/libexec/gcc/x86_64-pc-linux-gnu/:/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/:/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/:/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ LIBRARY_PATH=/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/:/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/lib/:/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
(In reply to comment #6) > I do not have the whole build log, but the relevant part is: > > libtool: link: x86_64-pc-linux-gnu-gcc -shared .libs/abs.o .libs/acos.o > .libs/acosh.o .libs/add.o .libs/add_fr.o .libs/add_si.o .libs/add_ui.o > .libs/arg.o .libs/asin.o .libs/asinh.o .libs/atan.o .libs/atanh.o .libs/clear.o > .libs/cmp.o .libs/cmp_si_si.o .libs/conj.o .libs/cosh.o .libs/div_2exp.o > .libs/div.o .libs/div_fr.o .libs/div_ui.o .libs/exp.o .libs/fma.o > .libs/fr_div.o .libs/fr_sub.o .libs/get.o .libs/get_prec2.o .libs/get_prec.o > .libs/get_str.o .libs/get_version.o .libs/imag.o .libs/init2.o .libs/init3.o > .libs/inp_str.o .libs/log.o .libs/mem.o .libs/mul_2exp.o .libs/mul.o > .libs/mul_fr.o .libs/mul_i.o .libs/mul_si.o .libs/mul_ui.o .libs/neg.o > .libs/norm.o .libs/out_str.o .libs/pow.o .libs/pow_fr.o .libs/pow_ld.o > .libs/pow_d.o .libs/pow_si.o .libs/pow_ui.o .libs/pow_z.o .libs/proj.o > .libs/real.o .libs/urandom.o .libs/set.o .libs/set_prec.o .libs/set_str.o > .libs/set_x.o .libs/set_x_x.o .libs/sin_cos.o .libs/sinh.o .libs/sqr.o > .libs/sqrt.o .libs/strtoc.o .libs/sub.o .libs/sub_fr.o .libs/sub_ui.o > .libs/swap.o .libs/tan.o .libs/tanh.o .libs/uceil_log2.o .libs/ui_div.o > .libs/ui_ui_sub.o /usr/lib/libmpfr.so /usr/lib/libgmp.so -lm -Wl,-O1 > -Wl,-soname -Wl,libmpc.so.2 -o .libs/libmpc.so.2.0.0 > > So this really links to the system libraries instead of the prefix ones. Sorry, Jordi, I thought you were Palmer in my last reply. This is different from Palmer's build.log quoted below. And I couldn't reproduce the errors on my box. I am wondering if we need to look into libtool. x86_64-pc-linux-gnu-gcc -shared .libs/abs.o .libs/acos.o .libs/acosh.o .libs/add.o .libs/add_fr.o .libs/add_si.o .libs/add_ui.o .libs/arg.o .libs/asin.o .libs/asinh.o .libs/atan.o .libs/atanh.o .libs/clear.o .libs/cmp.o .libs/cmp_si_si.o .libs/conj.o .libs/cosh.o .libs/div_2exp.o .libs/div.o .libs/div_fr.o .libs/div_ui.o .libs/exp.o .libs/fma.o .libs/fr_div.o .libs/fr_sub.o .libs/get.o .libs/get_prec2.o .libs/get_prec.o .libs/get_str.o .libs/get_version.o .libs/imag.o .libs/init2.o .libs/init3.o .libs/inp_str.o .libs/log.o .libs/mem.o .libs/mul_2exp.o .libs/mul.o .libs/mul_fr.o .libs/mul_i.o .libs/mul_si.o .libs/mul_ui.o .libs/neg.o .libs/norm.o .libs/out_str.o .libs/pow.o .libs/pow_fr.o .libs/pow_ld.o .libs/pow_d.o .libs/pow_si.o .libs/pow_ui.o .libs/pow_z.o .libs/proj.o .libs/real.o .libs/urandom.o .libs/set.o .libs/set_prec.o .libs/set_str.o .libs/set_x.o .libs/set_x_x.o .libs/sin_cos.o .libs/sinh.o .libs/sqr.o .libs/sqrt.o .libs/strtoc.o .libs/sub.o .libs/sub_fr.o .libs/sub_ui.o .libs/swap.o .libs/tan.o .libs/tanh.o .libs/uceil_log2.o .libs/ui_div.o .libs/ui_ui_sub.o -lmpfr -lgmp -lm -Wl,-O1 -Wl,-soname -Wl,libmpc.so.2 -o .libs/libmpc.so.2.0.0
(In reply to comment #8) > Sorry for the slow reply > > (In reply to comment #5) > > oh the previous one is "gcc -print-search-dirs | grep libraries | cut -c13- | > > tr -s ":" "\n" | xargs realpath", without line break. > > pdabbelt ld-8 ~ $ gcc -print-search-dirs | grep libraries | cut -c13- | > > tr -s ":" "\n" | xargs realpath > /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3 > /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/lib/../lib64/: > No such file or directory This directory in my CentOS 5 amd64 box resolve into ${EPREFIX}/usr/x86_64-pc-linux-gnu/lib Don't know if this is the problem. > /scratch/gentoo/usr/lib This one comes before /usr/lib64, really couldn't understand why in the actually linking /usr/lib64 comes before /scratch/gentoo/usr/lib and after /scratch/gentoo/usr/lib64 (not listed at all) > /lib64 > /usr/lib64 > /scratch/gentoo/usr/x86_64-pc-linux-gnu/lib > /scratch/gentoo/usr/lib > /lib > /usr/lib > > > also "cpp --verbose" please. > > "cpp --verbose" seems to want something on stdin and gives move info when I ^D, > so I did this > > pdabbelt ld-8 ~ $ echo "" | cpp --verbose Cool, actually "echo | cpp --verbose" will also do ;-) > #include "..." search starts here: > #include <...> search starts here: > /scratch/gentoo/usr/include > /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include > /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include-fixed > /usr/include > End of search list. > # 1 "<stdin>" > # 1 "<built-in>" > # 1 "<command-line>" > # 1 "<stdin>" This looks correct. > LIBRARY_PATH=/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/:/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/lib/:/scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../:/lib/:/usr/lib/ wait... this translate into... /scratch/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/ /scratch/gentoo/usr/lib64/ /lib /usr/lib (###I guess this is a link to /usr/lib64####) /scratch/gentoo/usr/x86_64-pc-linux-gnu/lib/ /scratch/gentoo/usr/lib/ /lib /usr/lib which exactly explains the problem! The question is... 1) where is /scratch/gentoo/usr/lib64/ from? 2) why cpp LIBRARY_PATH and gcc -print-search-dirs gives different result? On my side they are all the same.
(In reply to comment #10) > The question is... 1) where is /scratch/gentoo/usr/lib64/ from? That's probably the link I added in the original report? I'm building a clean prefix right now to rule out any error on my end, and to (maybe) help with reproducing things.
Palmer, did you use a symlink in your EPREFIX?
(In reply to comment #12) > Palmer, did you use a symlink in your EPREFIX? In order to workaround the original mpc build failure, I ran cd $EPREFIX/usr ln -s lib lib64 I then left that in place and tried to do a "emerge -e world" (as this was part of updating gcc), which is when I got the gcc build failure. Currently the lib64 symlink still exists. Unfortunately I'm unable to reproduce the bug myself in an new prefix, so I'm not really sure what caused the bad LIBRARY_PATH. It's possible that it's somehow related to <https://bugs.gentoo.org/show_bug.cgi?id=289757>, as I was trying to work around that problem in the old install. Using profile.bashrc as suggested fixed the GCC problem for me.
(In reply to comment #13) > Unfortunately I'm unable to reproduce the bug myself in an new prefix, so I'm > not really sure what caused the bad LIBRARY_PATH. Closing then. Reopen, or open a new bug if necessary.
(In reply to comment #14) > (In reply to comment #13) > > Unfortunately I'm unable to reproduce the bug myself in an new prefix, so I'm > > not really sure what caused the bad LIBRARY_PATH. > > Closing then. Reopen, or open a new bug if necessary. Yes. Thanks for all the help!