View previous topic :: View next topic |
Author |
Message |
Cadynum Tux's lil' helper
Joined: 15 Apr 2007 Posts: 122
|
Posted: Sat Jul 21, 2007 8:07 pm Post subject: [SOLVED] -O broken in gcc 4.2? |
|
|
Hi, i followed this guide to upgrade gcc from 4.1.2 to 4.2.0: http://www.gentoo.org/doc/en/gcc-upgrading.xml
When I had "emerge -e system" i wanted to compile and try an easy program before emerging the entire world.
However, using -O2 or -O3, the program will generate this error message if I try to run it:
Code: | ./gcc: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./gcc) |
This happens to every program compiled with -O2, -O3.
(-Os still works)
Any idea what i did wrong?
Edit: Sorry for being unclear, but this happens to every c++ program I have tried this far.
Thanks,
Cadynum
Last edited by Cadynum on Thu Jul 26, 2007 2:52 pm; edited 2 times in total |
|
Back to top |
|
|
Arfrever Bodhisattva
Joined: 29 Apr 2006 Posts: 2463 Location: 異世界
|
Posted: Sat Jul 21, 2007 8:21 pm Post subject: |
|
|
Post the output of: Code: | emerge --info
gcc-config -l |
Perduodu linkėjimus
Arfrever |
|
Back to top |
|
|
Cadynum Tux's lil' helper
Joined: 15 Apr 2007 Posts: 122
|
Posted: Sat Jul 21, 2007 8:58 pm Post subject: |
|
|
Arfrever wrote: | Post the output of: Code: | emerge --info
gcc-config -l |
Perduodu linkėjimus
Arfrever |
Code: |
$ emerge --info
Portage 2.1.3_rc8 (default-linux/amd64/2007.0, gcc-4.2.0, glibc-2.6-r0, 2.6.22-gentoo-r1 x86_64)
=================================================================
System uname: 2.6.22-gentoo-r1 x86_64 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz
Gentoo Base System release 1.12.10
Timestamp of tree: Sat, 21 Jul 2007 14:00:01 +0000
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python: 2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox: 1.2.18.1
sys-devel/autoconf: 2.13, 2.61-r1
sys-devel/automake: 1.4_p6, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils: 2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool: 1.5.24
virtual/os-headers: 2.6.22-r1
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=nocona -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US.UTF-8"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/enlightenment /usr/portage/local/layman/xeffects /usr/portage/local/layman/custom-kernels /usr/portage/local/layman/vmware /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aac acl alsa amd64 berkdb bitmap-fonts bzip2 cairo cli cracklib crypt cups d dbus dri fastcgi fcgi firefox flac fortran gdbm gdc gif glitz gpm gtk gtk2 hal hashstyle iconv ipv6 isdnlog joystick jpeg libg++ lighttpd midi mmx mp3 mpd mudflap mysql ncurses nls nptl nptlonly nvidia ogg openal opengl openmp pcre perl php png pppd python readline recode reflection sdl session spell spl sse sse2 ssl svg tcpd theora threads tiff truetype truetype-fonts type1-fonts unicode usb vim-syntax vorbis x264 xorg xv 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 mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nvidia nv vesa"
Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
|
Code: |
$ gcc-config -l
[1] x86_64-pc-linux-gnu-4.1.2
[2] x86_64-pc-linux-gnu-4.2.0 *
|
|
|
Back to top |
|
|
Arfrever Bodhisattva
Joined: 29 Apr 2006 Posts: 2463 Location: 異世界
|
Posted: Sat Jul 21, 2007 9:14 pm Post subject: |
|
|
Cadynum wrote: | i wanted to compile and try an easy program |
What program?
Also post the output of: Code: | portageq has_version / app-portage/portage-utils || emerge portage-utils &>/dev/null
q -r &>/dev/null
qfile /usr/lib/libstdc++.so.6
ls -aFhn /usr/lib/libstdc++.so.6 |
Perduodu linkėjimus
Arfrever |
|
Back to top |
|
|
Cadynum Tux's lil' helper
Joined: 15 Apr 2007 Posts: 122
|
Posted: Sat Jul 21, 2007 9:53 pm Post subject: |
|
|
Arfrever wrote: | Cadynum wrote: | i wanted to compile and try an easy program |
What program?
Also post the output of: Code: | portageq has_version / app-portage/portage-utils || emerge portage-utils &>/dev/null
q -r &>/dev/null
qfile /usr/lib/libstdc++.so.6
ls -aFhn /usr/lib/libstdc++.so.6 |
Perduodu linkėjimus
Arfrever |
Program:
Quote: |
#include <iostream>
int main()
{
std::cout << "hello";
return 0;
}
|
Code: |
# portageq has_version / app-portage/portage-utils || emerge portage-utils &>/dev/null
# q -r &>/dev/null
# qfile /usr/lib/libstdc++.so.6
# ls -aFhn /usr/lib/libstdc++.so.6
-rwxr-xr-x 1 0 0 921K 2007-06-06 21:22 /usr/lib/libstdc++.so.6*
|
|
|
Back to top |
|
|
Arfrever Bodhisattva
Joined: 29 Apr 2006 Posts: 2463 Location: 異世界
|
Posted: Sun Jul 22, 2007 3:42 pm Post subject: |
|
|
It seems that "/usr/lib/libstdc++.so.6" doesn't belong to any package.
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/libstdc++.so.6" should be used.
Move "/usr/lib/libstdc++.so.6" to e. g. ~: Code: | # mv /usr/lib/libstdc++.so.6 ~ |
Next compile this simple program again.
Perduodu linkėjimus
Arfrever |
|
Back to top |
|
|
scharlach n00b
Joined: 18 Oct 2004 Posts: 5
|
Posted: Sun Jul 22, 2007 5:22 pm Post subject: |
|
|
Not necessarily so. Could be some "relics" in /usr/lib/gcc/x86_64-pc-linux-gnu/ as well [probably (soft)linked]. What's the output of
Code: |
ls /usr/lib/gcc/x86_64-pc-linux-gnu/
|
? |
|
Back to top |
|
|
ToeiRei Veteran
Joined: 03 Jan 2005 Posts: 1191 Location: Austria
|
Posted: Sun Jul 22, 2007 9:13 pm Post subject: |
|
|
btw... check /etc/env.d/05compiler... this was a problem here.
after altering that file, env-update _________________ Please stand by - The mailer daemon is busy burning your messages in hell... |
|
Back to top |
|
|
Cadynum Tux's lil' helper
Joined: 15 Apr 2007 Posts: 122
|
Posted: Thu Jul 26, 2007 2:52 pm Post subject: |
|
|
Arfrever wrote: | It seems that "/usr/lib/libstdc++.so.6" doesn't belong to any package.
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/libstdc++.so.6" should be used.
Move "/usr/lib/libstdc++.so.6" to e. g. ~: Code: | # mv /usr/lib/libstdc++.so.6 ~ |
Next compile this simple program again.
Perduodu linkėjimus
Arfrever |
Sorry for the delay, but when I linked /usr/lib/libstdc++.so.6 to /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/libstdc++.so.6 it started to work, thanks! |
|
Back to top |
|
|
Arfrever Bodhisattva
Joined: 29 Apr 2006 Posts: 2463 Location: 異世界
|
Posted: Thu Jul 26, 2007 3:02 pm Post subject: |
|
|
Cadynum wrote: | I linked /usr/lib/libstdc++.so.6 to /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 |
There should be no "/usr/lib/libstdc++.*". ld.so can use "libstdc++.so" from "/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0".
Post the output of: Code: | cat /etc/ld.so.conf |
Perduodu linkėjimus
Arfrever |
|
Back to top |
|
|
Cadynum Tux's lil' helper
Joined: 15 Apr 2007 Posts: 122
|
Posted: Thu Jul 26, 2007 3:26 pm Post subject: |
|
|
Arfrever wrote: | Cadynum wrote: | I linked /usr/lib/libstdc++.so.6 to /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0 |
There should be no "/usr/lib/libstdc++.*". ld.so can use "libstdc++.so" from "/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0".
Post the output of: Code: | cat /etc/ld.so.conf |
Perduodu linkėjimus
Arfrever |
Code: |
$ cat /etc/ld.so.conf
# ld.so.conf autogenerated by env-update; make all changes to
# contents of /etc/env.d directory
/usr/local/lib
/usr/lib32/opengl/nvidia/lib
/usr/lib64/opengl/nvidia/lib
/lib
/usr/lib
/lib64
/usr/lib64
/usr/local/lib64
/lib32
/usr/lib32
/usr/local/lib32
/usr/x86_64-pc-linux-gnu/lib
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/32
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/32
/usr/lib64/nspr
/usr/lib64/nss
/usr/lib32/openmotif-2.2
/usr/lib/qt4
/usr/lib64/qt4
/usr/lib32/qt4
/usr/games/lib
/usr/games/lib32
|
|
|
Back to top |
|
|
Arfrever Bodhisattva
Joined: 29 Apr 2006 Posts: 2463 Location: 異世界
|
Posted: Thu Jul 26, 2007 3:45 pm Post subject: |
|
|
Cadynum wrote: | Code: |
$ cat /etc/ld.so.conf
# ld.so.conf autogenerated by env-update; make all changes to
# contents of /etc/env.d directory
/usr/local/lib
/usr/lib32/opengl/nvidia/lib
/usr/lib64/opengl/nvidia/lib
/lib
/usr/lib
/lib64
/usr/lib64
/usr/local/lib64
/lib32
/usr/lib32
/usr/local/lib32
/usr/x86_64-pc-linux-gnu/lib
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0/32
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/32
/usr/lib64/nspr
/usr/lib64/nss
/usr/lib32/openmotif-2.2
/usr/lib/qt4
/usr/lib64/qt4
/usr/lib32/qt4
/usr/games/lib
/usr/games/lib32
|
|
As you see, ld.so is configured to use "/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0" directory, so it's safe to delete "/usr/lib/libstdc++.so.6*".
Perduodu linkėjimus
Arfrever |
|
Back to top |
|
|
Cadynum Tux's lil' helper
Joined: 15 Apr 2007 Posts: 122
|
Posted: Thu Jul 26, 2007 4:18 pm Post subject: |
|
|
Arfrever wrote: |
As you see, ld.so is configured to use "/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0" directory, so it's safe to delete "/usr/lib/libstdc++.so.6*".
Perduodu linkėjimus
Arfrever |
You're right, thanks. |
|
Back to top |
|
|
|