vim nelson-arm.sh
修改
TARBALLS_DIR=$HOME/eMbedded/downloads
RESULT_TOP=$HOME/eMbedded/crosstool
./nelson-arm.sh
+ /home/nelson/eMbedded/crosstoolchain/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.1.0-glibc-2.3.2/glibc-2.3.2/configure --prefix=/usr --build=x86_64-unknown-linux-gnu --host=arm-unknown-linux-gnu --without-cvs --disable-sanity-checks --with-headers=/home/nelson/eMbedded/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/arm-unknown-linux-gnu/include --enable-hacker-mode
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking sysdep dirs... sysdeps/arm/elf sysdeps/unix/sysv/linux/arm sysdeps/unix/sysv/linux sysdeps/gnu sysdeps/unix/common sysdeps/unix/mman sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/arm sysdeps/unix sysdeps/posix sysdeps/arm/fpu sysdeps/arm sysdeps/wordsize-32 sysdeps/ieee754/flt-32 sysdeps/ieee754/dbl-64 sysdeps/ieee754 sysdeps/generic/elf sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for pwd... /bin/pwd
checking for arm-unknown-linux-gnu-gcc... gcc
checking version of gcc... 4.4.3, bad
checking for gnumake... no
checking for gmake... no
checking for make... make
checking version of make... 3.81, ok
configure: error:
*** These critical programs are missing or too old: gcc
*** Check the INSTALL file for required versions.
Ref:
http://blog.chinaunix.net/space.php?uid=12072359&do=blog&id=2960855
修改此檔案
vim build/arm-unknown-linux-gnu/gcc-4.1.0-glibc-2.3.2/glibc-2.3.2/configure
2275c2275
< 3.[2-9]*|4.[01]*)
---
> 3.[2-9]*|4.*)
vim nelson-arm.sh
加上--nounpack
./nelson-arm.sh
In file included from /usr/include/fcntl.h:205,
from /home/nelson/eMbedded/crosstoolchain/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.1.0-glibc-2.3.2/gcc-3.3.6/gcc/system.h:208,
from /home/nelson/eMbedded/crosstoolchain/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.1.0-glibc-2.3.2/gcc-3.3.6/gcc/collect2.c:30:
In function ‘open’,
inlined from ‘collect_execute’ at /home/nelson/eMbedded/crosstoolchain/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.1.0-glibc-2.3.2/gcc-3.3.6/gcc/collect2.c:1575:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[1]: *** [collect2.o] Error 1
make[1]: Leaving directory `/home/nelson/eMbedded/crosstoolchain/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.1.0-glibc-2.3.2/build-gcc-core/gcc'
make: *** [all-gcc] Error 2
vim +1575 build/arm-unknown-linux-gnu/gcc-4.1.0-glibc-2.3.2/gcc-3.3.6/gcc/collect2.c
第三個參數地方加上0777
記得要用,隔開
解法
摘錄部份重點
这纯属软件bug,因为使用open函数的时候,如果在第二个参数中使用了 O_CREAT,就必须添加第三个参数:创建文件时赋予的初始权限。而在gcc-3.3.6/gcc/的collect2.c文件中有漏掉第三个参数的错误,而gcc-4.3对语法错误的检查严格是出了名的(4.1就不会因此错误退出),所以就退出了。
nelson@swdev:~/eMbedded/crosstoolchain/crosstool-0.43$ ./nelsonbuild
arm-unknown-linux-gnu-ar rc ./libgcc.a libgcc/./_udivsi3.o libgcc/./_divsi3.o libgcc/./_umodsi3.o libgcc/./_modsi3.o libgcc/./_dvmd_lnx.o libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_ffsdi2.o libgcc/./_clz.o libgcc/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o libgcc/./_floatditf.o libgcc/./_clear_cache.o libgcc/./_trampoline.o libgcc/./__main.o libgcc/./_exit.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde-glibc.o libgcc/./unwind-sjlj.o libgcc/./unwind-c.o libgcc/./_eprintf.o libgcc/./_bb.o libgcc/./__gcc_bcmp.o
*** buffer overflow detected ***: arm-unknown-linux-gnu-ar terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x2ad5bb56a217]
/lib/libc.so.6(+0xfe0d0)[0x2ad5bb5690d0]
/lib/libc.so.6(+0xfd539)[0x2ad5bb568539]
/lib/libc.so.6(_IO_default_xsputn+0xcc)[0x2ad5bb4e0d1c]
/lib/libc.so.6(_IO_padn+0xe8)[0x2ad5bb4d47f8]
/lib/libc.so.6(_IO_vfprintf+0x2afc)[0x2ad5bb4b2e9c]
/lib/libc.so.6(__vsprintf_chk+0x99)[0x2ad5bb5685d9]
/lib/libc.so.6(__sprintf_chk+0x7f)[0x2ad5bb56851f]
arm-unknown-linux-gnu-ar[0x409144]
arm-unknown-linux-gnu-ar[0x407361]
arm-unknown-linux-gnu-ar[0x4099d5]
arm-unknown-linux-gnu-ar[0x4107ef]
arm-unknown-linux-gnu-ar[0x403fff]
arm-unknown-linux-gnu-ar[0x4044bd]
arm-unknown-linux-gnu-ar[0x404ef9]
/lib/libc.so.6(__libc_start_main+0xfd)[0x2ad5bb489c4d]
arm-unknown-linux-gnu-ar[0x401e69]
======= Memory map: ========
00400000-00465000 r-xp 00000000 08:01 4167281 /home/nelson/eMbedded/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-ar
00664000-00665000 r--p 00064000 08:01 4167281 /home/nelson/eMbedded/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-ar
00665000-00666000 rw-p 00065000 08:01 4167281 /home/nelson/eMbedded/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-ar
00666000-0066a000 rw-p 00000000 00:00 0
00ad1000-019cb000 rw-p 00000000 00:00 0 [heap]
2ad5bb249000-2ad5bb269000 r-xp 00000000 08:01 33562306 /lib/ld-2.11.1.so
2ad5bb269000-2ad5bb26b000 rw-p 00000000 00:00 0
2ad5bb26b000-2ad5bb26c000 r--p 00000000 08:01 796839 /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
2ad5bb26c000-2ad5bb273000 r--s 00000000 08:01 797675 /usr/lib/gconv/gconv-modules.cache
2ad5bb273000-2ad5bb2b2000 r--p 00000000 08:01 796833 /usr/lib/locale/en_US.utf8/LC_CTYPE
2ad5bb2b2000-2ad5bb2bc000 rw-p 00000000 00:00 0
2ad5bb468000-2ad5bb469000 r--p 0001f000 08:01 33562306 /lib/ld-2.11.1.so
2ad5bb469000-2ad5bb46a000 rw-p 00020000 08:01 33562306 /lib/ld-2.11.1.so
2ad5bb46a000-2ad5bb46b000 rw-p 00000000 00:00 0
2ad5bb46b000-2ad5bb5e5000 r-xp 00000000 08:01 33563969 /lib/libc-2.11.1.so
2ad5bb5e5000-2ad5bb7e4000 ---p 0017a000 08:01 33563969 /lib/libc-2.11.1.so
2ad5bb7e4000-2ad5bb7e8000 r--p 00179000 08:01 33563969 /lib/libc-2.11.1.so
2ad5bb7e8000-2ad5bb7e9000 rw-p 0017d000 08:01 33563969 /lib/libc-2.11.1.so
2ad5bb7e9000-2ad5bb7f0000 rw-p 00000000 00:00 0
2ad5bb7f0000-2ad5bb806000 r-xp 00000000 08:01 33554487 /lib/libgcc_s.so.1
2ad5bb806000-2ad5bba05000 ---p 00016000 08:01 33554487 /lib/libgcc_s.so.1
2ad5bba05000-2ad5bba06000 r--p 00015000 08:01 33554487 /lib/libgcc_s.so.1
2ad5bba06000-2ad5bba07000 rw-p 00016000 08:01 33554487 /lib/libgcc_s.so.1
7fffa4b04000-7fffa4b1c000 rw-p 00000000 00:00 0 [stack]
7fffa4bfc000-7fffa4bfd000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
make[2]: *** [libgcc.a] Aborted
make[2]: *** Deleting file `libgcc.a'
make[2]: Leaving directory `/home/nelson/eMbedded/crosstoolchain/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.1.0-glibc-2.3.2/build-gcc-core/gcc'
make[1]: *** [libgcc.a] Error 2
make[1]: Leaving directory `/home/nelson/eMbedded/crosstoolchain/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.1.0-glibc-2.3.2/build-gcc-core/gcc'
make: *** [all-gcc] Error 2
將系統的gcc版本換成4.1版本
參考
install gcc-4.1 under Ubuntu
ln -s nelson-arm.sh nelsonbuild
./nelsonbuild
這樣編譯
還是有一樣的問題
修改nelsonbuild
拿掉--nounpack
重新來一次
哇靠
上面的修改都不用
就成功了
+ /home/nelson/eMbedded/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-gcc -static hello.c -o arm-unknown-linux-gnu-hello-static
+ /home/nelson/eMbedded/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-gcc hello.c -o arm-unknown-linux-gnu-hello
+ test -x /home/nelson/eMbedded/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-g++
+ cat
+ /home/nelson/eMbedded/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-g++ -static hello2.cc -o arm-unknown-linux-gnu-hello2-static
+ /home/nelson/eMbedded/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-g++ hello2.cc -o arm-unknown-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.
gcc版本要換成4.1是關鍵阿
沒有留言:
張貼留言