在Ubuntu 14.04上使用gcc 3.4

通过完全按照这篇文章 ,我能够在全新安装的Ubuntu 14.04上安装gcc 3.4。 但是,当我尝试编译程序时,它失败并出现以下错误:

/usr/bin/ld: cannot find crt1.o: No such file or directory /usr/bin/ld: cannot find crti.o: No such file or directory /usr/bin/ld: cannot find -lgcc_s collect2: ld returned 1 exit status 

我已经看过这个答案并安装了build-essential但是没有解决问题。 我仍然得到同样的错误。

另外,我在安装之前安装了g ++ – 3.4的依赖项:

 sudo apt-get build-dep g++-3.4 

更新:

尝试gcc-3.4 -B/usr/lib/x86_64-linux-gnu hello.c会删除前两个错误。

 /usr/bin/ld: cannot find -lgcc_s collect2: ld returned 1 exit status 

更新2:

我读了这篇文章,并在我的系统上尝试过,但是没有帮助:

 gcc-3.4 -B /usr/lib/x86_64-linux-gnu -L /usr/lib/gcc/x86_64-linux-gnu/3.4.6/ hello.c 

请尝试以下步骤:

  1. 运行以下命令:

     LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH export LIBRARY_PATH 

这将消除在编译C程序时显式定义路径的需要。

  1. 安装以下包:

     sudo apt-get install libc6-dev sudo apt-get install gcc-multilib 
  2. 创建一个符号链接:

     sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64