0

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.

Jay R.
  • 31,911
  • 17
  • 52
  • 61
  • 2
    You might want to post some error messages. If we see the errors, we might be able to give clues as to what's really wrong. Without that, we can't really comment on fixing the code. – Michael Kohne Nov 18 '09 at 21:39
  • 1
    Right, it's a bad idea to try to compile with old compilers, since that old code will just continue to break more over time. Should be easy to fix it up for new gcc. – Adam Goode Nov 18 '09 at 21:41
  • It may not even be that hard to fix, depending on the errors. My current codebase wouldn't compile with gcc-3.4 and a contractor spent several months hacking on it (eventually breaking a lot of stuff). When I got hold of it, I looked up the error, found that it was the result of a changed default on a warning message, and added the appropriate incantation to our makefile. I can now build with the newer compilers, and at my leisure fix the underlying issues in small increments. – Michael Kohne Nov 18 '09 at 21:45

2 Answers2

2

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
  • 199,314
  • 34
  • 295
  • 362
0

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
  • 28,374
  • 7
  • 55
  • 54