5

I am working on CentOS 6 machines, which has very old GCC/GlibC version. I want to build the whole glibc, binutils, gcc toolchain with latest or at least very recent versions in order to use c++11 support in latest gcc, and ld.gold in recent binutils, and possibly improvements in recent glibc.

I want to put the whole toolchain in some separate directory, and not to influence any existing system files. I also want to build gcc with --sys-root so that when using the gcc, I don't need to specify -I/some/directory/include and -L/some/directory/lib or whatever other parameters. Also the generated executable will automatically use the new ld-linux-xxxxx program loader which will automatically find the new libc.so.

Anyone knows if there exists some tutorial on this task?

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
Kan Li
  • 8,557
  • 8
  • 53
  • 93
  • Can't you install a recent CentOS in a chroot of your old system? – Basile Starynkevitch Feb 08 '13 at 06:17
  • Have you already tried instructions from here: http://gcc.gnu.org/install/ ? If yes, where did you stuck? Please show us some research intention. – Konstantin Vladimirov Feb 08 '13 at 06:18
  • I actually spent quite a long time trying them but actually doesn't work at all. The major source of trouble is the glibc, where ld-linux-xxxx can't find the correct libc.so, also the headers are installed in wrong place where gcc can't find it, etc. – Kan Li Feb 08 '13 at 08:27

4 Answers4

0

The compiler is very dependent on glibc, altough you manage to build the compiler either in a chrooted system or equivalent, you will need to build also all libraries needed with the program you will build with this new compiler. The best you can do is use a fresh new system (vm or whatever) or upgrade your existing one

sancelot
  • 1,905
  • 12
  • 31
0

You can download the latest toolchain from Openembedded or Yocto. And here you don't have to do any package installation to your current system. Just download the toolchain, source the environment and thats it you are ready to check the c++11 support. The location to download the toolchain: http://downloads.yoctoproject.org/releases/yocto/yocto-1.7/toolchain/ (Just select the architecture either 32bit or 64 bit based on your machine support)

geek
  • 47
  • 1
  • 9
-1

If you need the latest toolchain, you'd better migrate to Fedora.

If you can't/won't, the best bet is to get the pieces as source RPMs for CentOS and Fedora, unpack them and fix up the CentOS by pilfering the sources and patches from Fedora, take care it doesn't overrule the system packages, correct versions and fix to install elsewhere (don't mess up your system too much! /usr/local comes to mind). The pieces are at least binutils, gcc.

vonbrand
  • 11,412
  • 8
  • 32
  • 52
  • This instruction is too abstract which I can't follow. – Kan Li Feb 08 '13 at 08:29
  • 1
    @icando, yes, it is quite complex. And there is no guarantee you won't end up with a severely broken system. And whatever you build with that toolchain won't run anywhere else. If you _really_ need C++ 2011 features, get an up to date system where you can use it seamlessly without any extraneous extensive work on your side. You might even run Fedora 18, say, in a virtual machine if you want to play around with the new features. Or wait for RHEL/CentOS 7... – vonbrand Feb 08 '13 at 18:22
-1

I do not knwo Why you need this ? If this is needed that to compile for another computer, I would suggest using a virtual machine running the same OS as target. much more easier !!

sancelot
  • 1,905
  • 12
  • 31
  • I am not doing cross compile. I just need a compiler on the machine itself. As I mentioned, the toolchain on centos is too old and doesn't support any c++11 features. Also it doesn't have ld.gold. VM is not an option because the centos machine is running in VM itself. – Kan Li Feb 08 '13 at 08:28