您的位置 首页 知识

Ubuntu9.10制造ARM穿插编译器

本环境内核版本:Linuxubuntu9102.6.31-21-generic#59-UbuntuSMPi686GNU/Linux准备软件包如下:bison_13a2.3.dfsg-4build1_i

本环境内核版别:Linux ubuntu910 2.6.31-21-generic #59-Ubuntu SMPi686 GNU/Linux

预备软件包如下:

bison_13a2.3.dfsg-4build1_i386.deb

build-essential_11.4_i386.deb

flex_2.5.33-10build1_i386.deb

libncurses5-dev_5.6+20071124-1ubuntu2_i386.deb

m4_1.4.8-1build1_i386.deb

patch_2.5.9-5_i386.deb

gcc-3.4.5.tar.gz

glibc-2.3.6.tar.gz

linux-2.6.26.5.tar.gz

crosstool-0.43.tar.gz

binutils-2.15.tar.gz

glibc-linuxthreads-2.3.3.tar.gz

linux-libc-headers-2.6.12.0.tar.bz2

furtherchan@ubuntu910:~/Downloads$sudo dpkg -i m4_1.4.8-1build1_i386.deb

[sudo] password for furtherchan:

Selecting previously deselected package m4.

(Reading database … 191676 files and directories currently installed.)

Unpacking m4 (from m4_1.4.8-1build1_i386.deb) …

Setting up m4 (1.4.8-1build1) …

Ignoring install-info called from maintainer script

The package m4 should be rebuild with new debhelper to get trigger support

Processing triggers for install-info …

Processing triggers for man-db …

furtherchan@ubuntu910:~/Downloads$sudo dpkg -i bison_13a2.3.dfsg-4build1_i386.deb

Selecting previously deselected package bison.

(Reading database … 191725 files and directories currently installed.)

Unpacking bison (from bison_13a2.3.dfsg-4build1_i386.deb) …

Setting up bison (1:2.3.dfsg-4build1) …

update-alternatives: using /usr/bin/bison.yacc to provide /usr/bin/yacc (yacc) in auto mode.

Processing triggers for man-db …

furtherchan@ubuntu910:~/Downloads$sudo dpkg -i build-essential_11.4_i386.deb

(Reading database … 191752 files and directories currently installed.)

Preparing to replace build-essential 11.4 (using build-essential_11.4_i386.deb) …

Unpacking replacement build-essential …

Setting up build-essential (11.4) …

furtherchan@ubuntu910:~/Downloads$sudo dpkg -i flex_2.5.33-10build1_i386.deb

Selecting previously deselected package flex.

(Reading database … 191752 files and directories currently installed.)

Unpacking flex (from flex_2.5.33-10build1_i386.deb) …

Setting up flex (2.5.33-10build1) …

Ignoring install-info called from maintainer script

The package flex should be rebuild with new debhelper to get trigger support

Ignoring install-info called from maintainer script

The package flex should be rebuild with new debhelper to get trigger support

Processing triggers for install-info …

Processing triggers for man-db …

^[[Afurtherchan@ubuntu910:~/Downloads$sudo dpkg -i patch_2.5.9-5_i386.deb

(Reading database … 191775 files and directories currently installed.)

Preparing to replace patch 2.5.9-5 (using patch_2.5.9-5_i386.deb) …

Unpacking replacement patch …

Setting up patch (2.5.9-5) …

Processing triggers for man-db …

furtherchan@ubuntu910:~/Downloads$sudo dpkg –i libncurses5-dev_5.6+20071124-1ubuntu2_i386.deb

Selecting previously deselected package libncurses5-dev.

(Reading database … 191775 files and directories currently installed.)

Unpacking libncurses5-dev (from libncurses5-dev_5.6+20071124-1ubuntu2_i386.deb) …

dpkg: dependency problems prevent configuration of libncurses5-dev:

libncurses5-dev depends on libncurses5 (= 5.6+20071124-1ubuntu2); however:

Version of libncurses5 on system is 5.7+20090803-2ubuntu2.

#注释:犯错,libncurses5在9.10上是5.7+20090803-2ubuntu2,不影响下面,暂时越过

dpkg: error processing libncurses5-dev (–install):

dependency problems – leaving unconfigured

Processing triggers for man-db …

Errors were encountered while processing:

libncurses5-dev

furtherchan@ubuntu910:~/Downloads$

furtherchan@ubuntu910:~/Downloads$sudo dpkg -i gcc-4.1_4.1.2-23ubuntu3_i386.deb

(Reading database … 192865 files and directories currently installed.)

Preparing to replace gcc-4.1 4.1.2-23ubuntu3 (using gcc-4.1_4.1.2-23ubuntu3_i386.deb) …

Unpacking replacement gcc-4.1 …

Setting up gcc-4.1 (4.1.2-23ubuntu3) …

Processing triggers for man-db …

furtherchan@ubuntu910:~/Downloads$sudo dpkg -i gcc-4.1-base_4.1.2-23ubuntu3_i386.deb

(Reading database … 192865 files and directories currently installed.)

Preparing to replace gcc-4.1-base 4.1.2-23ubuntu3 (using gcc-4.1-base_4.1.2-23ubuntu3_i386.deb) …

Unpacking replacement gcc-4.1-base …

Setting up gcc-4.1-base (4.1.2-23ubuntu3) …

furtherchan@ubuntu910:~/Downloads$sudo dpkg -i cpp-4.1_4.1.2-23ubuntu3_i386.deb

(Reading database … 192865 files and directories currently installed.)

Preparing to replace cpp-4.1 4.1.2-23ubuntu3 (using cpp-4.1_4.1.2-23ubuntu3_i386.deb) …

Unpacking replacement cpp-4.1 …

Setting up cpp-4.1 (4.1.2-23ubuntu3) …

Processing triggers for man-db …

furtherchan@ubuntu910:~/Downloads$

furtherchan@ubuntu910:/usr/bin$ ls -l gcc

lrwxrwxrwx 1 root root 7 2009-11-16 21:27 gcc -> gcc-4.4

furtherchan@ubuntu910:/usr/bin$ mv gcc gcc_bck

mv: cannot move `gcc to `gcc_bck: Permission denied

furtherchan@ubuntu910:/usr/bin$sudo mv gcc gcc_bck

furtherchan@ubuntu910:/usr/bin$ ls -l gcc_bck

lrwxrwxrwx 1 root root 7 2009-11-16 21:27 gcc_bck -> gcc-4.4

furtherchan@ubuntu910:/usr/bin$ ls -l /usr/bin/gcc-4.1

-rwxr-xr-x 1 root root 198916 2008-10-26 21:12 /usr/bin/gcc-4.1

furtherchan@ubuntu910:/usr/bin$sudo ln -s /usr/bin/gcc-4.1 /usr/bin/gcc

#注释:修正gcc链接,链接至4.1版别

furtherchan@ubuntu910:/usr/bin$ ls -l gcc

lrwxrwxrwx 1 root root 16 2010-05-19 14:57 gcc -> /usr/bin/gcc-4.1

furtherchan@ubuntu910:/usr/bin$

furtherchan@ubuntu910:/usr/bin$ ls -la /bin/sh

lrwxrwxrwx 1 root root 4 2009-11-16 21:27/bin/sh -> dash

furtherchan@ubuntu910:/usr/bin$sudo dpkg-reconfigure dash

#注释:在装备界面上挑选NO删去dash

Removing `diversion of /bin/sh to /bin/sh.distrib by dash

Removing `diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash

furtherchan@ubuntu910:/usr/bin$

furtherchan@ubuntu910:~/Downloads$tar -zxvf crosstool-0.43.tar.gz

furtherchan@ubuntu910:~/Downloads$ cd crosstool-0.43/

furtherchan@ubuntu910:~/Downloads/crosstool-0.43$gedit demo-arm-softfloat.sh

#注释:修正途径

#set -ex

#TARBALLS_DIR=/home/furtherchan/Downloads

#RESULT_TOP=/home/furtherchan/Crosstool

furtherchan@ubuntu910:~/Downloads/crosstool-0.43$gedit gcc-3.4.5-glibc-2.3.6.dat

#注释:修正称号

# BINUTILS_DIR=binutils-2.15

# GCC_DIR=gcc-3.4.5

# GLIBC_DIR=glibc-2.3.6

# LINUX_DIR=linux-2.6.26.5

# LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.12.0

# GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.6

furtherchan@ubuntu910:~/Downloads/crosstool-0.43$./demo-arm-softfloat.sh

#注释:履行2分钟左右犯错,报too old ld,ld版别不对,检查版别:

furtherchan@ubuntu910:~/Downloads/crosstool-0.43$ld -v

GNU ld (GNU Binutils for Ubuntu) 2.20

#注释:

#处理:解压glibc-2.3.6.tar.bz2,修正glibc-2.3.6下的configure,修正完从头打包压缩成tar.bz2

#####################################################################

# Found it, now check the version.

echo “$as_me:$LINENO: checking version of $AS” >&5

echo $ECHO_N “checking version of $AS… $ECHO_C” >&6

ac_prog_version=`$AS -v &1 | sed -n s/^.*GNU assembler.* /([0-9]*/.[0-9.]*/).*$//1/p`

case $ac_prog_version in

) ac_prog_version=”v. ?.??, bad”; ac_verc_fail=yes;;

2.2[0-9]*)<--------------line: 3920,修正版别规模,还有下一处

ac_prog_version=”$ac_prog_version, ok”; ac_verc_fail=no;;

*) ac_prog_version=”$ac_prog_version, bad”; ac_verc_fail=yes;;

# Found it, now check the version.

echo “$as_me:$LINENO: checking version of $LD” >&5

echo $ECHO_N “checking version of $LD… $ECHO_C” >&6

ac_prog_version=`$LD –version 2>&1 | sed -n s/^.*GNU ld.* /([0-9][0-9]*/.[0-9.]*/).*$//1/p`

case $ac_prog_version in

) ac_prog_version=”v. ?.??, bad”; ac_verc_fail=yes;;

2.2[0-9]*)<--------------line: 3981,修正版别规模

ac_prog_version=”$ac_prog_version, ok”; ac_verc_fail=no;;

*) ac_prog_version=”$ac_prog_version, bad”; ac_verc_fail=yes;;

从头运转./demo-arm-softfloat.sh

######################################################################

#注释:以下省掉N行

…….

…….

…….

+ test -f /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/arm-softfloat-linux-gnu/lib/libmudflap.so.?

+ for DIR in $PREFIX/$TARGET/lib $PREFIX/$TARGET/lib64

+ test -f /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/arm-softfloat-linux-gnu/lib64/libmudflap.so

+ test -f /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/arm-softfloat-linux-gnu/lib64/libmudflap.so.?

+ cd /home/furtherchan/Downloads/crosstool-0.43

+ gcc fix-embedded-paths.c -o /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/fix-embedded-paths

fix-embedded-paths.c: In function ‘testit’:

fix-embedded-paths.c:368: warning: initializer element is not constant

fix-embedded-paths.c:368: warning: (near initialization for ‘all_tests[2]’)

+ echo Cross-toolchain build complete. Result in /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu.

Cross-toolchain build complete. Result in /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu.

+ exit 0

+ cd /home/furtherchan/Downloads/crosstool-0.43

+ sh testhello.sh

+ cd /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu

+ test ! -d tmp

+ mkdir tmp

+ cd tmp

+ test x != x

+ cat

+ /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc -static hello.c -o arm-softfloat-linux-gnu-hello-static

+ /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc hello.c -o arm-softfloat-linux-gnu-hello

+ test -x /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-g++

+ cat

+ /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-g++ -static hello2.cc -o arm-softfloat-linux-gnu-hello2-static

+ /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-g++ hello2.cc -o arm-softfloat-linux-gnu-hello2

+ echo testhello: C compiler can in fact build a trivial program.

testhello: C compiler can in fact build a trivial program.

+ test = 1

+ test = 1

+ test = 1

+ test 1 =

+ echo Done.

Done.

#注释:编译完结

furtherchan@ubuntu910:~/Downloads/crosstool-G9ho

#注释:接下来参加环境变量

#修正/etc/bash.bashrc

export PATH=$PATH:/home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin:

furtherchan@ubuntu910:~/Crosstool$ ls

gcc-3.4.5-glibc-2.3.6gcc-3.4.5-glibc-2.3.6.tar.bz2

furtherchan@ubuntu910:~/Crosstool$ cd gcc-3.4.5-glibc-2.3.6/

furtherchan@ubuntu910:~/Crosstool/gcc-3.4.5-glibc-2.3.6$ ls

arm-softfloat-linux-gnu

furtherchan@ubuntu910:~/Crosstool/gcc-3.4.5-glibc-2.3.6$ cd arm-softfloat-linux-gnu/

furtherchan@ubuntu910:~/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu$ ls

arm-softfloat-linux-gnubinincludelibman

arm-softfloat-linux-gnu.crosstoolconfig.txtdistributedinfolibexectmp

furtherchan@ubuntu910:~/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu$ cd bin

furtherchan@ubuntu910:~/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin$ ls

arm-softfloat-linux-gnu-addr2linearm-softfloat-linux-gnu-gprof

arm-softfloat-linux-gnu-ararm-softfloat-linux-gnu-ld

arm-softfloat-linux-gnu-asarm-softfloat-linux-gnu-nm

arm-softfloat-linux-gnu-c++arm-softfloat-linux-gnu-objcopy

arm-softfloat-linux-gnu-c++filtarm-softfloat-linux-gnu-objdump

arm-softfloat-linux-gnu-cpparm-softfloat-linux-gnu-ranlib

arm-softfloat-linux-gnu-g++arm-softfloat-linux-gnu-readelf

arm-softfloat-linux-gnu-gccarm-softfloat-linux-gnu-size

arm-softfloat-linux-gnu-gcc-3.4.5arm-softfloat-linux-gnu-strings

arm-softfloat-linux-gnu-gccbugarm-softfloat-linux-gnu-strip

arm-softfloat-linux-gnu-gcovfix-embedded-paths

furtherchan@ubuntu910:~/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin$

furtherchan@ubuntu910:~/c/test$arm-softfloat-linux-gnu-gcc -v

Reading specs from /home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/lib/gcc/arm-softfloat-linux-gnu/3.4.5/specs

Configured with: /home/furtherchan/Downloads/crosstool-0.43/build/arm-softfloat-linux-gnu/gcc-3.4.5-glibc-2.3.6/gcc-3.4.5/configure –target=arm-softfloat-linux-gnu –host=i686-host_pc-linux-gnu –prefix=/home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu –with-float=soft –with-headers=/home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/arm-softfloat-linux-gnu/include –with-local-prefix=/home/furtherchan/Crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/arm-softfloat-linux-gnu –disable-nls –enable-threads=posix –enable-symvers=gnu –enable-__cxa_atexit –enable-languages=c,c++ –enable-shared –enable-c99 –enable-long-long

Thread model: posix

gcc version 3.4.5

furtherchan@ubuntu910:~/c/test$

furtherchan@ubuntu910:~/c/test$arm-softfloat-linux-gnu-gcc -o test test.c

furtherchan@ubuntu910:~/c/test$file test

test: ELF 32-bit LSB executable,ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.4.3, not stripped

#注释:文件格局已是ARM

furtherchan@ubuntu910:~/c/test$

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/zhishi/277176.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部