Compiling using gcc 3.2.3 on RHE 5.3
Some work I'm doing for a client requires me to build using a very old version of gcc on Red Hat Enterprise. We recently shifted from 4.x to 5.3 and I'm hitting some compile errors when I try to build simple example:
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
return 0;
}
I get the following:
bash-3.2$ g++ -o hello hello.cpp
In file included from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_alloc.h:90,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/memory:55,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/string:48,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/bits/localefwd.h:49,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/ios:48,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/ostream:45,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/iostream:45,
from hello.cpp:1:
/opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_threads.h: In
constructor开发者_Python百科 `std::_Refcount_Base::_Refcount_Base(unsigned int)':
/opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_threads.h:74: error: `
__LOCK_INITIALIZER' undeclared (first use this function)
/opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_threads.h:74: error: (Each
undeclared identifier is reported only once for each function it appears
in.)
__LOCK_INITIALIZER
is a pthreads macro, but clearly I'm not using it directly here. Has anyone seen this kind of problem before or can offer any possible suggestions as tyo why this is happening?
What's your LD_LIBRARY_PATH set to? In particular gcc relies on libgcc* and libstdc++* (although if you've statically linked it that shouldn't be an issue). If it is an issue try setting your LD_LIBRARY_PATH to /opt/ext/gcc-3.2.3.34rh/lib:$LD_LIBRARY_PATH.
精彩评论