Install Gcc on Linux with No Root Privilege

installing GCC-4.9 without root - adding paths and binaries and extra

If you build your compiler with --prefix=/home/myname/gcc4.9 (adjust to match your system, obviously), then the compiler should "know" that the include paths etc.

All you need beyond that is to make sure your path has /home/myname/gcc4.9/bin before /usr/bin or wherever your other gcc is installed, and everything should work just like normal. On my machine, I have gcc 4.8.2 installed from my own build and gcc 4.6.3 from the linux installer for gcc (because it's a fairly old distro). And as long as I have the paths set in the right order, it works "automagically".

You will need to set LD_LIBRARY_PATH, but include-paths and static libraries should be handled by gcc itself.

how to have a working compiler in an empty ubuntu without root privileges

Finally I got notice of a way to install without admin privileges make+gcc on a freshly installed ubuntu, without having to become crazy writing my own bash scripts to extract from .deb files. I just had to rely on conda!

First, install miniconda (does not require privileges)

Second, use conda to install make, gcc, ... (all available on the anaconda official channel, also!).

Is it possible to install g++ on CentOS without root?

You could use EasyBuild, which will allow you to very easily install a particular GCC version without requiring root, see http://hpcugent.github.com/easybuild .

Disclaimer: I'm an EasyBuild developer.

Install gcc in home

Can this be done? What is the best way to set this up? What do I need
to know or worry about?

Yes, this can be done. In fact it is very comman to have multiple version of GCC in one machine.You download and install gcc4.9 in your path /home/my_user_name/local/gcc/. You can refer the following link about how to install GCC4.9 using source file.

How do I compile and run GCC 4.9.0?

Once you are done with the steps, you should be able to use GCC4.9.1 by providing the complete path. The best way could be to write a makefile and use it to avoid long type.

If everything goes fine with your GCC4.9 installation, following command should give the output like this:

$/home/mantosh/gcc-4.9.1/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/mantosh/gcc-4.9.1/bin/gcc
COLLECT_LTO_WRAPPER=/home/mantosh/gcc-4.9.1/libexec/gcc/x86_64-unknown-linux-gnu/4.9.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/mantosh/objdir/../gcc-4.9.1/configure --prefix=/home/mantosh/gcc-4.9.1 --disable-multilib
Thread model: posix
gcc version 4.9.1 (GCC)

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.1-2ubuntu1~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~12.04)

So from above, we can see that GCC4.8 is my default compiler and GCC4.9.1 is other compiler installed. The first one would be compiled by default gcc(which gcc4.8 in my case) and in second case by gcc4.9.1. as we are giving complete path on command line.

$g++ test.cpp
$/home/mantosh/gcc4.9.1/bin/g++ test.cpp


Related Topics



Leave a reply



Submit