After doing these commands (note the --prefix
option of configure)
$PWD/../gcc-4.9.0/configure --prefix=$HOME/gcc-4.9.0
make install
the new gcc will be installed in $HOME/gcc-4.9.0
directory (there should be subdirectories like bin
, lib
, share
inside it).
Full path to gcc
will be $HOME/gcc-4.9.0/bin/gcc
, and g++
(which is symlink to gcc
) will be here: $HOME/gcc-4.9.0/bin/g++
.
There can be no separate g++
in objdir because gcc
compiler driver implements drivers for several languages; the mode (C or C++) is selected based on argv[0]
(name of binary, which was used to run driver: gcc
or g++
; this mode also affects linking flags) and on source file extensions (gcc
accepts both C and C++ programs as input for compilation into object files). So, g++
may be generated as symlink by make install
, and the place to store generated symlink is $prefix/bin
.
After building the GCC and installing it in the $HOME/gcc-4.9.0
directory, you can use it; but default system gcc will be not updated. Update of distributive gcc should be done via distributive tools (apt
, dpkg-build
, etc). Current prebuild version of system-wide gcc for Wheezy is 4.7.2, 4.8.2 for Jessie and Sid and 4.9-2 for "Experimental".
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…