Ubuntu 10.10编译交叉编译器2.95.3的环境搭建


1、sudo apt-get install ncurses-dev

2、sudo apt-get install bison

3、sudo apt-get install flex

4、sudo apt-get install build-essential

5、修改gcc版本,默认是4.4.5的,这个版本太高了,改为3.4.6的

     下载deb安装包,我下载的包为:

    gcc-3.4-base_3.4.6-6Ubuntu3_i386.deb、

    gcc-3.4_3.4.6-6ubuntu3_i386.deb、

    cpp-3.4_3.4.6-6ubuntu3_i386.deb、

    g++-3.4_3.4.6-6ubuntu3_i386.deb、

    libstdc++6-dev_3.4.6-6ubuntu3_i386.deb

  下载地址为:http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/

6、自己新建一个目录,把这些deb包拷贝进去,我的是/mnt/share/gcc-3.4.6

    接下来在此目录下执行下面的命令:

    root@www.bkjia.com:/mnt/share/gcc-3.4.6# dpkg -i *.deb

    查看下安装的结果如下:

    root@www.bkjia.com:/mnt/share/gcc-3.4.6# ls /usr/bin/gcc*

    /usr/bin/gcc  /usr/bin/gcc-3.4  /usr/bin/gcc-4.4  /usr/bin/gccbug-3.4


7、增加gcc3.4.6和gcc4.4.5的可选项

     root@www.bkjia.com:/mnt/share/gcc-3.4.6# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4  40

 

     root@www.bkjia.com:/mnt/share/gcc-3.4.6# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-3.4  30

 

8、切换版本到gcc-3.4

    root@www.bkjia.com:/mnt/share/gcc-3.4.6# update-alternatives --config gc

    There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

  选择       路径            优先级  状态
------------------------------------------------------------
* 0            /usr/bin/gcc-4.4   40        自动模式
  1            /usr/bin/gcc-3.4   30        手动模式
  2            /usr/bin/gcc-4.4   40        手动模式

要维持当前值[*]请按回车键,或者键入选择的编号:1(自己手动输入要选择的默认值,输入1,设置默认为3.4版本的)

9、查看当前gcc版本

root@www.bkjia.com:/mnt/share/gcc-3.4.6# gcc -v
Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.6/specs
Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --with-tune=pentium4 i486-linux-gnu
Thread model: posix
gcc version 3.4.6 (Ubuntu 3.4.6-6ubuntu3)

相关内容