编译mips架构的uclibc 0.9.32版本的时候出现一个奇怪的错误,现象如下:
/home/ning/svn/trunk/tools-chain/bin/mips-linux-gcc -Wl,-EB
-Wl,-melf32btsmip -shared -Wl,--warn-common -Wl,--warn-once
-Wl,-z,combreloc -Wl,-z,defs -Wl,-s -Wl,-fini,dl_cleanup
-Wl,-soname=libdl.so.0 -nostdlib -o lib/
-Wl,--whole-archive ldso/libdl/libdl_so.a -Wl,--no-whole-archive
./lib/interp.os -L./lib ./lib/libc.so ./lib/ld-uClibc.so.0
/home/ning/svn/trunk/tools-chain/bin/../lib/gcc/mips-linux-uclibc/3.4.4/libgcc.a
/home/ning/svn/trunk/tools-chain/bin/../lib/gcc/mips-linux-uclibc/3.4.4/../../../../mips-linux-uclibc/bin/ld:./lib/libc.so:
file format not recognized; treating as linker script
/home/ning/svn/trunk/tools-chain/bin/../lib/gcc/mips-linux-uclibc/3.4.4/../../../../mips-linux-uclibc/bin/ld:./lib/libc.so:6:
syntax error
collect2: ld returned 1 exit status
make: *** [lib/libdl.so] 错误 1
打开lib/libc.so文件:
/* GNU ld script
* Use the shared library, but some functions are only in
* the static library, so try that secondarily. */
OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips",
"elf32-tradlittlemips")
GROUP ( uclibc_nonshared.a libc.so.0 AS_NEEDED ( ld-uClibc.so.0 ) )
因为芯片供应商提供toolchain的gcc版本比较老,3.4.4版本,而这个链接脚本的格式太新,因此只要用gcc4.0以上的版本编译就可以了。
如果一定要用3.4.4版本编译,将 AS_NEEDED ( ld-uClibc.so.0 ) 删除,再编译即OK。
阅读(8471) | 评论(0) | 转发(0) |