HOWTO: Install gcc-3.4 in ubuntu 10.04

一。 方法1:

http://forum.ubuntu.org.cn/viewtopic.php?t=295355

不同的ubuntu版本包含的软件包版本也不同,如果需要老版本的软件,自然的想法就是
去老版本的ubuntu中找,所以软件源中需要添加老ubuntu版本对应的软件源。查看
/etc/apt/source.list文件,发现其中记录了使用的软件源,需要在该文件中补充。软件
源的格式如下:
deb http://cn.archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
本来还有一些deb-src开头的记录,后面内容和上面5项分别对应,想来应该是下载源码的,就删掉了。

细看这些记录,发现每行都有hardy,这就是ubuntu发行版的代号,对应是8.04,够老的吧,呵呵
如果需要其它ubuntu版本的源,可以修改每行的发行版代号,把hardy修改为对应的代号,如10.04对应
的代号是lucid。

pay attation: save the original source.list file,  and delete all the original list and copy the above list.

# sudo apt-get update

# sudo apt-get install gcc-3.4


二。  方法二:

http://ubuntuforums.org/showthread.php?t=79896

HOWTO: Install gcc-3.4 via apt-get without an Internet connection

Compiling kernel modules on Breezy is difficult because the kernel was compiled with gcc-3.4.5 but the distribution CD does not contain gcc-3.4. Instead, when you install the build-essential package, gcc-4.0.2 is installed. The issue is that to compile kernel modules, you need the same version of gcc that was used to compile the kernel, otherwise you cannot compile kernel modules. This presents a dilemma to those ( like myself) that have to compile kernel modules for modems and things like that in order to connect to the Internet. NOTE: this guide is for i386 architectures only.

1. Find a machine that has an Internet connection and download the following 3 packages
cpp-3.4_3.4.4-6ubuntu8_i386.deb (1707096 bytes)
gcc-3.4_3.4.4-6ubuntu8_i386.deb (484408 bytes)
gcc-3.4-base_3.4.4-6ubuntu8_i386.deb (163028 bytes)

2. On your Breezy machine, create a directory called "gcc-3.4" and copy the above files to it
Code:
mkdir ~/gcc-3.4
3. Create a local repository
Code:
cd ~/gcc-3.4
sudo apt-get install build-essential
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
You should see something like this:
Code:
 ** Packages in archive but missing from override file: **
  cpp-3.4 gcc-3.4 gcc-3.4-base

 Wrote 3 entries to output Packages file.
4. Edit /etc/apt/sources.list
Code:
sudo gedit /etc/apt/sources.list
Comment out all the lines in the file that start with "deb-src http" or "deb http". To comment out a line, add a pound character # to the start of the line. We want to do this because we do not have an Internet connection, so we cannot access any repositories that exist on the Internet.

Then add the following line to the file:
Code:
deb file:///home/username/gcc-3.4 ./
Replace "username" with your username. For example, if your usename is "susie" then you would add this line instead:
Code:
deb file:///home/susie/gcc-3.4 ./
5. Install gcc-3.4
Code:
sudo apt-get update
sudo apt-get install gcc-3.4
You should see something like this:
Code:
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
  binutils cpp-3.4 gcc-3.4-base
Suggested packages:
  binutils-doc gcc-3.4-doc libc6-dev-amd64
Recommended packages:
  libc6-dev
The following NEW packages will be installed:
  binutils cpp-3.4 gcc-3.4 gcc-3.4-base
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/3824kB of archives.
After unpacking 15.2MB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
  gcc-3.4-base cpp-3.4 gcc-3.4
Install these packages without verification [y/N]? y

Preconfiguring packages ...
Selecting previously deselected package binutils.
(Reading database ... 56661 files and directories currently installed.)
Unpacking binutils (from .../binutils_2.16.1-2ubuntu6_i386.deb) ...
Selecting previously deselected package gcc-3.4-base.
Unpacking gcc-3.4-base (from .../gcc-3.4-base_3.4.4-6ubuntu8_i386.deb) ...
Selecting previously deselected package cpp-3.4.
Unpacking cpp-3.4 (from .../cpp-3.4_3.4.4-6ubuntu8_i386.deb) ...
Selecting previously deselected package gcc-3.4.
Unpacking gcc-3.4 (from .../gcc-3.4_3.4.4-6ubuntu8_i386.deb) ...
Setting up binutils (2.16.1-2ubuntu6) ...

Setting up gcc-3.4-base (3.4.4-6ubuntu8) ...
Setting up cpp-3.4 (3.4.4-6ubuntu8) ...
Setting up gcc-3.4 (3.4.4-6ubuntu8) ...
If step 5 doesn't work for you, you may want to try Arktis' tip "sudo dpkg -i filename" after you download the .deb files, where the filename is the .deb file. Try that for all three .deb files in addition to "sudo apt-get install binutils". I think "sudo dpkg -i *.deb" may do the trick.

You should now be able to compile your kernel modules. Following these steps, I was able to compile the kernel modules for my Lucent modem. Once you get an Internet connection, go back and uncomment all the lines you commented out in /etc/apt/sources.list in step 4. You can also remove the line you added to /etc/apt/sources.list and the ~/gcc-3.4 directory if you like.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值