Created attachment 6251 [details] patch to take he LD_RUN_PATH environment variable into account Contrary to the conventional linker, gold doesn't take the LD_RUN_PATH environment variable into account (default runpath). I've reported a bug against Debian here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=660813 and Jonathan Nieder posted a patch, which I've tested and solves the problem I've reported. It is attached. The ld(1) man page should also mention it. The old ld(1) man page says: * For -rpath=dir: If -rpath is not used when linking an ELF executable, the contents of the environment variable "LD_RUN_PATH" will be used if it is defined. * For -rpath-link=dir: On an ELF system, for native linkers, if the -rpath and -rpath-link options were not used, search the contents of the environment variable "LD_RUN_PATH". But it could be better to describe it in an ENVIRONMENT section, where environment variables are usually described.
I applied the patch to binutils-2.22 to build gcc-4.7.0 using gold linker and a non-standard $PREFIX. It worked for me. Thanks for the patch.
The bug is still present in binutils 2.23.52.20130722 (Debian). It can be reproduced by compiling MPFR with the --with-gmp configure option. For instance: ./configure --with-gmp=/usr/local/gmp-debug CFLAGS='-fuse-ld=gold' (/usr/local/gmp-debug being a version different from the /usr one). I got: checking if gmp.h version and libgmp version are the same... (5.0.1/5.1.2) no configure: WARNING: ========================================================== configure: WARNING: 'gmp.h' and 'libgmp' seem to have different versions or configure: WARNING: we cannot run a program linked with GMP (if you cannot configure: WARNING: see the version numbers above). A cause may be different configure: WARNING: GMP versions with different ABI's or the use of --with-gmp configure: WARNING: or --with-gmp-include with a system include directory configure: WARNING: (such as /usr/include or /usr/local/include). configure: WARNING: However since we can't use 'libtool' inside the configure, configure: WARNING: we can't be sure. See 'config.log' for details. configure: WARNING: CC="gcc" configure: WARNING: CFLAGS="-fuse-ld=gold" configure: WARNING: CPPFLAGS=" -I/usr/local/gmp-debug/include" configure: WARNING: LDFLAGS=" -L/usr/local/gmp-debug/lib" configure: WARNING: LIBS="-lgmp " configure: WARNING: Temporary LD_RUN_PATH was "/usr/local/gmp-debug/lib". configure: WARNING: ==========================================================
Shouldn't it be LDFLAGS='-fuse-ld=gold'?
(In reply to Maxim Yegorushkin from comment #3) > Shouldn't it be LDFLAGS='-fuse-ld=gold'? It may work, but using CFLAGS is better (this is specific to MPFR and to the way GMP builds work). Moreover, in the gcc man page, -fuse-ld is listed under "Optimization Options", not "Linker Options".
(In reply to Vincent Lefèvre from comment #4) > (In reply to Maxim Yegorushkin from comment #3) > > Shouldn't it be LDFLAGS='-fuse-ld=gold'? > > It may work, but using CFLAGS is better (this is specific to MPFR and to the > way GMP builds work). Is not whatever works it better? Not trolling.
*** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla.
This is *still* an issue in 2.32! The patch does work but needs applying by hand.
Still reproducible with the binutils 2.38.50.20220629-4 Debian package.