Summary: | gcc-config doesn't correctly switch between gcc-3.3.3 and gcc-3.4.0 | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | John Shaw <jtshaw> |
Component: | [OLD] Development | Assignee: | Please assign to toolchain <gcc-porting> |
Status: | RESOLVED DUPLICATE | ||
Severity: | critical | CC: | langthang |
Priority: | High | ||
Version: | 1.4 | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
John Shaw
2004-05-26 04:38:55 UTC
the problem is env-update does not correctly re-ordering gcc path in /etc/ld.so.conf
# gcc-config -l
[1] i686-pc-linux-gnu-3.3.3
[2] i686-pc-linux-gnu-3.4.0
# gcc-config -c
i686-pc-linux-gnu-3.4.0
# grep LDPATH /etc/env.d/05
# grep LDPATH /etc/env.d/05gcc
LDPATH="/usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.0:/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3"
# mv /etc/ld.so.conf /etc/ld.so.conf.bak
# env-update
>>> Regenerating /etc/ld.so.cache...
* Caching service dependencies...
# grep gcc /etc/ld.so.conf
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.0
# source /etc/profile
# gcc --version
gcc (GCC) 3.4.0 20040519 (Gentoo Linux 3.4.0-r4, ssp-3.4-1, pie-8.7.6)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# cat hello.cpp
#include <stdio.h>
main (int argc, char** argv)
{
printf ("Hello World!\n");
return 0;
}
# g++ hello.cpp
gentoo testing # ldd a.out
linux-gate.so.1 => (0xffffe000)
libstdc++.so.6 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.0/libstdc++.so.6 (0x4002e000)
libm.so.6 => /lib/libm.so.6 (0x400f9000)
libgcc_s.so.1 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libgcc_s.so.1 (0x4011b000)
libc.so.6 => /lib/libc.so.6 (0x40125000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
now, I re-order gcc path in /etc/ld.so.conf mannually
# grep gcc /etc/ld.so.conf
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.0
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3
# /sbin/ldconfig
# g++ hello.cpp
# ldd a.out tc/ld.so.conf
linux-gate.so.1 => (0xffffe000)
libstdc++.so.6 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.0/libstdc++.so.6 (0x4002e000)
libm.so.6 => /lib/libm.so.6 (0x400f9000)
libgcc_s.so.1 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.0/libgcc_s.so.1 (0x4011b000)
libc.so.6 => /lib/libc.so.6 (0x40124000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
looks like that it links correct now.
Now, let switch to gcc-3.3.3
# gcc-config 1
* Switching to i686-pc-linux-gnu-3.3.3 compiler... [ ok ]
* If you intend to use the gcc from the new profile in an already
* running shell, please remember to do:
* # source /etc/profile
# source /etc/profile
# gcc --version
gcc (GCC) 3.3.3 20040412 (Gentoo Linux 3.3.3-r5, ssp-3.3-7, pie-8.7.5.3)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# grep LDPATH /etc/env.d/05gcc
LDPATH="/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3:/usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.0"
note that the order is correct, but
# grep gcc /etc/ld.so.conf
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.0
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3
stay the same, so I manually re-order it.
# grep gcc /etc/ld.so.conf
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.0
# ldconfig
# source /etc/profile
# g++ hello.cpp
# ldd a.out
linux-gate.so.1 => (0xffffe000)
libstdc++.so.5 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5 (0x4002e000)
libm.so.6 => /lib/libm.so.6 (0x400df000)
libgcc_s.so.1 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libgcc_s.so.1 (0x40101000)
libc.so.6 => /lib/libc.so.6 (0x4010b000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
So, do you think it is env-update fault?
It looks like this bug is related with bug #44028 Prob rather is when libtool is involved - the path's in libtool linker scripts (.la files) is hardcoded for 3.4.0 or your setup if my guess is correct. Especially if you compiled libs with 3.4, and now try to link 3.3 compiled apps to them ... which is a very bad idea btw. I should note here that I am talking about C++ libs, etc. |