views:

71

answers:

2

I have some guys here who have code that needs to be compiled with gcc-3.3. We have a CentOS 5.2.

When we compile it with their make files, it fails during the link and they say it is because it won't work with gcc-3.4 which is installed already. Is there something I need to tell them to change to make it go, or is it possible to find gcc-3.3 as an rpm and install it? I guess, initially I'm asking how big a difference there is between gcc-3.3 and gcc-3.4 since 3.3 isn't in the CentOS 5.2 install media.

Or how about, can compat-gcc-3.2 be installed on a distribution that also has compat-gcc-3.4?

ADDED:

The error is

/usr/include/c++/3.2.3/bits/stl_alloc.h:248: undefined reference to std::__default_alloc_template<true, 0>::deallocate(void *, unsigned int)

so I'm suspicious of maybe the wrong headers or libraries linked. By installing compat-gcc-32, the code compiles and links, but then segfaults when it tries to do any string operations. It is likely that the first access to whatever is broken just happens to be a string manipulation of some sort.

A: 

I doubt that you'll find RPMs for GCC 3.3 that can be installed alongside the existing GCC 3.4 RPMs in your CentOS installation. I would probably install GCC 3.3 from source to avoid messing around with different GCC versions in the RPM database.

Pär Wieslander
+2  A: 

The difference between gcc-3.3 and 3.4 internally is large: gcc-3.4 has completely re-implemented the C/C++ front end.

The difference for a reasonably standards-compliant program should be non-existent. Code which builds with 3.3 and fails to build with 3.4 is very likely broken, and your best bet is to have the developers fix that code.

If you can't do that, then just build GCC-3.3 from source:

tar xzf gcc-3.3.tar.gz && cd gcc-3.3 &&
./configure --prefix /usr/local/gcc-3.3 --enable-languages=c,c++ &&
make && make install

and then build the "broken" code with PATH=/usr/local/gcc-3.3/bin:$PATH make

Employed Russian