在Ubuntu上安装gcc 4.6的问题 [英] Problem with gcc 4.6 installation on ubuntu

查看:184
本文介绍了在Ubuntu上安装gcc 4.6的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的ubuntu 9.10(通过virtualbox)中安装gcc 4.6(主要用于支持C ++ 0x)。我提到前面的问题,但我得到一个不同的错误。



我指的是此链接进行安装。现在,我已经完成了 ./ gcc-xx / configure ... 步骤。虽然它给出了一些软件包相关的错误。主要是因为 make 也会失败,出现以下错误:


build / gengtype .o:在函数
adjust_field_rtx_def'中:
/home/milind/ubuntu_shared/GCC/build/gcc/../../gcc-4.6-20110610/gcc/gengtype .c:978:
未定义引用
lexer_line'
/home/milind/ubuntu_shared/GCC/build/gcc/../../gcc-4.6-20110610/ gcc / gengtype.c:1032:
未定义引用 lexer_line'
/home/milind/ubuntu_shared/GCC/build/gcc/../../gcc-4.6- 20110610 / gcc / gengtype.c:1042:
未定义引用
lexer_line'...............


现在这让我很难找出答案,因为我已经安装了 flex / bison 最新版本。我在互联网上搜索了2天,但几乎没有运气。任何帮助将非常感激。还要注意,我已经在 / usr / bin / gcc 中安装了 gcc 4.4 ,并且我已经将 gcc 4.6 tar在我的主目录本地文件夹中。



[注意:我也可以安装 ubuntu 11.10 也是(它有gcc 4.6)作为最后的手段。但我不知道它的.iso 图像是可用的。


解决方案
我修正了这个问题。我遵循以下过程:
如果不是以root用户身份登录,请使用 sudo 运行所有命令。例如 sudo ls -ltr; sudo make install;


  1. 正如我的
    问题中的链接所述, c $ c> gcc4.6 ... tar

    临时存放的文件

  2. 现在找到当前
    <$存储c $ c> gcc 。例如我之前的
    gcc4.4 存储在
    / usr / lib / gcc / i486-linux-gnu 。其中
    有一个名为 4.4 4.4.1

  3. 创建一个名为 4.6 (或
    4.6.1 / 2/3 等)的文件夹并放入里面有
    .tar 文件。如链接所示,解开
    文件。

  4. 按照
    链接执行所有步骤。使用 nohup<命令> &
    跟踪日志。即的nohup使
    清洁所有&安培;
    接着尾-f
    的nohup.out

  5. 如果出现一些错误,则表示缺少一些
    软件包。大多数这些
    包将出现在您的
    当前 gcc 版本中。你可以
    自己安装它们。对于
    例子,在我的例子中, zlib
    缺失。我运行了 sudo apt-get install
    zlib1g-dev libssl-dev
    ,它工作得很好。否则,从互联网下载并安装它。

  6. 一旦安装了 gcc ,您的
    可以使用键入
    gcc-4.6
    。在我的情况下,它显示
    被存储为
    / usr / local / bin / g ++ - 4.6

  7. 要么你可以使用
    编译相同的路径,也可以把一个在$ 别名 b $ b你的的bash / tcsh的/ ksh的。例如
    / usr / local / bin / g ++ - 4.6 -std = c ++ 0x
    --Wall test.cpp


I am trying to install gcc 4.6 (mainly for having C++0x better supported) in my ubuntu 9.10 (via virtualbox). I referred to 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 tolexer_line' /home/milind/ubuntu_shared/GCC/build/gcc/../../gcc-4.6-20110610/gcc/gengtype.c:1032: undefined reference to lexer_line' /home/milind/ubuntu_shared/GCC/build/gcc/../../gcc-4.6-20110610/gcc/gengtype.c:1042: undefined reference tolexer_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;

  1. As mentioned in the link in my question, download the gcc4.6...tar file in a temporary place
  2. Now find the place where current gcc is stored. e.g. My earlier gcc4.4 was stored in /usr/lib/gcc/i486-linux-gnu. Which has a folder called 4.4, 4.4.1
  3. Create a folder named 4.6 (or 4.6.1/2/3 etc.) and put that .tar file inside it. Untar the file as shown in link.
  4. Follow all the procedure as per the link. Use nohup <command> & to track the logs. i.e. nohup make clean all & followed by tail -f nohup.out
  5. 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 case zlib was missing. I ran sudo apt-get install zlib1g-dev libssl-dev and it worked fine. Otherwise download from internet and install it.
  6. Once your gcc is installed, you can simply check it using type gcc-4.6. In my case it showed that it's stored as /usr/local/bin/g++-4.6.
  7. Either you can use the same path to compile or you can put an alias in your bash/tcsh/ksh. e.g. /usr/local/bin/g++-4.6 -std=c++0x -Wall test.cpp

这篇关于在Ubuntu上安装gcc 4.6的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆