Install Developer Toolset 1.1 (gcc 4.7) onto RHEL 5

Latest response

I have a legacy RHEL 5 system and need to install an application that requires gcc 4.7.

The compatability section of https://access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset/1/html/User_Guide/sect-Red_Hat_Developer_Toolset-Compatibility.html. Does not claim to be able to build and run on RHEL 5. Will this work for me?

Also https://access.redhat.com/solutions/19458 does not list gcc 4.7 as being compatible with RHEL 5.

Is there a way forward for me?

Andrew

Responses

Hi Andrew,

The compatibility table shows on what versions of RHEL will your binaries run when you build these binaries using tools from specific versions of DTS. In other words, unless you need to build binaries on your RHEL5 and then run them elsewhere, this shouldn't concern you -- when you use gcc to build a binary, it should always run on the system where you built it.

As for the list of gcc versions in the solution you link -- DTS was made available specifically for situations where newer versions of tools are not available on a particular RHEL version. In other words, as long as you can install DTS, you can use the tools it provides (incl. gcc).

That said, please, consider upgrading. DTS 1.x is no longer supported, and support for RHEL5 is very limited. See Red Hat Developer Toolset Product Life Cycle.

Thanks for the reassurance. Would you recommend DTS2.x over DTS1.x?

If at all possible, I would recommend the very latest version (4.1 at this time). But if you need to stay on RHEL 5, then yes, DTS 2.1 is your best bet.

Would be nice to upgrade but that project is not in the budget.

My next question is, once its installed how do I compile in it? The examples in the Devtools-2 User Guide show compiling a single .cpp file, but I have make files, some generated through eclipse. Is it as easy as:

$ scl enable devtoolset-2 'bash'
$ bash
$ eclipse &

Then building in eclipse will use the newer toolset? or

$ make

?

Yes, building in DTS-provided Eclipse will use the DTS-provided toolchain. Make sure you have the devtoolset-2-toolchain package installed before starting Eclipse.)

If you ever wish to use 'DTS Eclipse' with the RHEL-provided toolchain, there are some extra steps to perform. (See Using Eclipse in the DTS 2 User Guide for info on both scenarios.)

So after some wrangling to rhn_register'ed I was able to install devtools-2 and I have the 4.8 compiler, however I am unable to link to the third party library... which is excepting the gcc libraries in the standard places. Details below.

Is there anyway to get the third party library to find the library references in the gcc 4.8 path?

If not it seems my options are to get the third party to compile against devtoolset-2 or upgrade the compiler. Any advice?

********* Details ************
$ $cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
$ scl enable devtoolset-2 'bash'
$ gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ./make.sh
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o dual_ain_loop.o -c -g -Wall dual_ain_loop.c
gcc -o dual_ain_loop dual_ain_loop.o -lLabJackM
/usr/local/lib/libLabJackM.so: undefined reference to `std::bad_exception::what() const@GLIBCXX_3.4.9'
/usr/local/lib/libLabJackM.so: undefined reference to `std::bad_alloc::what() const@GLIBCXX_3.4.9'
/usr/local/lib/libLabJackM.so: undefined reference to `timerfd_settime@GLIBC_2.8'
/usr/local/lib/libLabJackM.so: undefined reference to `std::ctype<char>::_M_widen_init() const@GLIBCXX_3.4.11'
collect2: ld returned 1 exit status
scons: *** [dual_ain_loop] Error 1
scons: building terminated because of errors.

$ ldd /usr/local/lib/libLabJackM.so.1.12.0
/usr/local/lib/libLabJackM.so.1.12.0: /lib64/libc.so.6: version `GLIBC_2.8' not found (required by /usr/local/lib/libLabJackM.so.1.12.0)
/usr/local/lib/libLabJackM.so.1.12.0: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /usr/local/lib/libLabJackM.so.1.12.0)
/usr/local/lib/libLabJackM.so.1.12.0: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/local/lib/libLabJackM.so.1.12.0)
        linux-vdso.so.1 =>  (0x00002b37166ae000)
        libusb-1.0.so.0 => /usr/lib64/libusb-1.0.so.0 (0x00002b3716bf4000)
        liblabjackusb.so => /usr/local/lib/liblabjackusb.so (0x00002b3716e01000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b3717006000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002b3717221000)
        libm.so.6 => /lib64/libm.so.6 (0x00002b3717522000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b37177a5000)
        libc.so.6 => /lib64/libc.so.6 (0x00002b37179b3000)
        /lib64/ld-linux-x86-64.so.2 (0x00000035ed800000)
        librt.so.1 => /lib64/librt.so.1 (0x00002b3717d0c000)

Hi Andrew,

It looks like your program requires a higher version (2.8) of the standard C library (glibc). RHEL 5.x only has glibc 2.5. It might be possible to upgrade glibc without upgrading the whole system (see Upgrading the GNU C Library within Red Hat Enterprise Linux, but it's a non-trivial exercise, and it might lead other problems.

RHEL 6 has glibc 2.12.

Hint: When including console output or source code in a comment, put it in between three tildas, like so:

 ~~~
 output
 ~~~

Hi Robert, Thanks again for your help... Yes of course its glibc.... (it was a long week). I assumed that when I installed devtoolset-2 I would get an updated glibc but after googling the issue I see that that was naive.

Andrew

It's not that naive (see the blogpost I linked), but there's a lot of unknowns, and you might end up spending a considerable amount of time getting the rest of the system working with the new glibc.

On the other hand, you mentioned in your other thread (https://access.redhat.com/discussions/2718031 that the system in question (I assume it's the same one) is embedded. An embedded system might just be minimal enough to work with a newer glibc. I'm just guessing, of course.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.