View previous topic :: View next topic |
Author |
Message |
stiller n00b
Joined: 13 Mar 2010 Posts: 3
|
Posted: Wed Jun 30, 2010 9:23 am Post subject: [solved] g++ cannot found std template lib with -L/usr/lib64 |
|
|
Hello,
I discovered this bug since several ebuilds fail on my computer. whenever the additional libflag -L/usr/lib64 is given to g++ and using a std-template, the build will fail with e.g. the following error message:
Quote: |
/tmp/cccxDZe5.o: In function `main':
hworld.cpp:(.text+0x56): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
hworld.cpp:(.text+0x65): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage'
collect2: ld gab 1 als Ende-Status zurück
|
I've prepared a minimal example for the bug. I tried this code on several other platforms and it always works with the gcc compiler. Only my gentoo box seems to be broken. does anyone have a clue, why this happens? If you need more info, please let me know...
Thanks
Andreas
hworld.cpp:
Code: |
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
string hworld("Hello World\n");
cout << hworld;
return 0;
};
|
Makefile:
Code: |
FILE=hworld.cpp
CXX=g++
LIBFLAGS_OK=
LIBFLAGS_FAIL=-L/usr/lib64
CXXFLAGS=-O -v
LIBFLAGS=
LIBS=
all: hworld_ok hworld_fail
hworld_ok: LIBFLAGS+=$(LIBFLAGS_OK)
hworld_ok: $(FILE)
$(CXX) -o $@ $(CXXFLAGS) $(LIBFLAGS) $< $(LIBS)
hworld_fail: LIBFLAGS+=$(LIBFLAGS_FAIL)
hworld_fail: $(FILE)
$(CXX) -o $@ $(CXXFLAGS) $(LIBFLAGS) $< $(LIBS)
|
Last edited by stiller on Wed Jun 30, 2010 10:45 am; edited 2 times in total |
|
Back to top |
|
|
stiller n00b
Joined: 13 Mar 2010 Posts: 3
|
Posted: Wed Jun 30, 2010 10:44 am Post subject: |
|
|
Ok, digging a little bit deeper (-v -Wl,--verbose), it seems like the compiler search path is changed such that with -L/usr/lib64 the stdc++ library in /usr/lib64 are found first bevor the one in /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/
succeding run:
Quote: | attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/libstdc++.so succeeded |
failing run:
Quote: | attempt to open /usr/lib64/libstdc++.so succeeded |
It seems like the /usr/lib64/libstdc++.so belongs to sys-libs/libstdc++ package.
Quote: |
$ equery belongs /usr/lib64/libstdc++.so.5.0.7
[ Searching for file(s) /usr/lib64/libstdc++.so.5.0.7 in *... ]
sys-libs/libstdc++-v3-3.3.6 (/usr/lib64/libstdc++.so.5.0.7)
|
Ok, found the cause of the problem. The older compat libraries where dragged in by the emu-linux-x86-compat package. And they don't have certain symbols defined, used in the >newer< c++ headers.
Problem solved.
Andreas |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|