tags:

views:

35

answers:

1

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 /sw/external/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_alloc.h:90,
                 from /sw/external/gcc-3.2.3.34rh/include/c++/3.2.3/memory:55,
                 from /sw/external/gcc-3.2.3.34rh/include/c++/3.2.3/string:48,
                 from /sw/external/gcc-3.2.3.34rh/include/c++/3.2.3/bits/localefwd.h:49,
                 from /sw/external/gcc-3.2.3.34rh/include/c++/3.2.3/ios:48,
                 from /sw/external/gcc-3.2.3.34rh/include/c++/3.2.3/ostream:45,
                 from /sw/external/gcc-3.2.3.34rh/include/c++/3.2.3/iostream:45,
                 from hello.cpp:1:
/sw/external/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_threads.h: In 
   constructor `std::_Refcount_Base::_Refcount_Base(unsigned int)':
/sw/external/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_threads.h:74: error: `
   __LOCK_INITIALIZER' undeclared (first use this function)
/sw/external/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?

A: 

Hi there,

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 /sw/external/gcc-3.2.3.34rh/lib:$LD_LIBRARY_PATH.

happyhairydude