I am trying to install gcc 4.6 (mainly for having C++0x better supported) in my ubuntu 9.10 (via virtualbox). I referred t开发者_如何学Goo previous questions, but I am getting a different error.
I am referring this link for the installation. Now, I have done till the ./gcc-xx/configure ...
step. Though it was giving some flex package related error. Mostly due to that make
is also failing with below errors:
build/gengtype.o: In function
adjust_field_rtx_def': /home/milind/ubuntu_shared/GCC/build/gcc/../../gcc-4.6-20110610/gcc/gengtype.c:978: undefined reference to
lexer_line' /home/milind/ubuntu_shared/GCC/build/gcc/../../gcc-4.6-20110610/gcc/gengtype.c:1032: undefined reference tolexer_line' /home/milind/ubuntu_shared/GCC/build/gcc/../../gcc-4.6-20110610/gcc/gengtype.c:1042: undefined reference to
lexer_line' ...............
Now this is giving me a hard time figuring it out because I have already flex/bison
latest versions installed. I searched over internet for 2 days almost but no luck. Any help would be really appreciated. Also note that, I already have gcc 4.4
installed in /usr/bin/gcc
and I have unzipped the gcc 4.6
tar in my home directory local folder.
[Note: I am also ok with installing ubuntu 11.10
too (which has gcc 4.6) as last resort. But I don't know if its .iso
image is available.]
I got this fixed. I followed following procedure:
[Note: run all the commands with sudo
, if you are not login as root. e.g. sudo ls -ltr; sudo make install;
- As mentioned in the link in my
question, download the
gcc4.6...tar
file in a temporary place - Now find the place where current
gcc
is stored. e.g. My earliergcc4.4
was stored in/usr/lib/gcc/i486-linux-gnu
. Which has a folder called4.4
,4.4.1
- Create a folder named
4.6
(or4.6.1/2/3
etc.) and put that.tar
file inside it. Untar the file as shown in link. - Follow all the procedure as per the
link. Use
nohup <command> &
to track the logs. i.e.nohup make clean all &
followed bytail -f nohup.out
- If some error comes, it means some
package is missing. Mostly those
package will be present in your
current
gcc
version. You can install them there itself. For example, in my casezlib
was missing. I ransudo apt-get install zlib1g-dev libssl-dev
and it worked fine. Otherwise download from internet and install it. - Once your
gcc
is installed, you can simply check it usingtype gcc-4.6
. In my case it showed that it's stored as/usr/local/bin/g++-4.6
. - Either you can use the same path to
compile or you can put an
alias
in yourbash/tcsh/ksh
. e.g./usr/local/bin/g++-4.6 -std=c++0x -Wall test.cpp
FWIW Debian testing and unstable have gcc-4.6 as a standard package. So you can simply install that distro inside of virtualbox or, as I've done on my Ubuntu 11.04 server at home, via kvm. In the past, I also used to use dchroot
build environments.
There may also be prepackaged gcc-4.6 binaries at launchpad.
精彩评论