LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1114|回复: 2

求大虾帮我解决阿!交叉编译环境最后安装GCC时出错!

[复制链接]
发表于 2009-2-28 22:43:09 | 显示全部楼层 |阅读模式
cc/./unwind-c_s.o -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/home/arm/tools/arm-linux/bin/ld: skipping incompatible /lib/ld-linux.so.2 when searching for /lib/ld-linux.so.2
/home/arm/tools/arm-linux/bin/ld: cannot find /lib/ld-linux.so.2
collect2: ld 返回1
make[3]: *** [libgcc_s.so] 错1
make[3]: Leaving directory `/home/arm/build-tools/build-gcc/gcc‘
make[2]: *** [libgcc.a] 错2
make[2]: Leaving directory `/home/arm/build-tools/build-gcc/gcc'
make[1]: *** [all-gcc] 错2
make[1]: Leaving directory `/home/arm/build-tools/build-gcc'
make: *** [all] 错2
我在主机上的lib目录下看了 有ld-linux.so.2这个文件
难道是我建立的交叉编译环境跟我的主机不兼容?
发表于 2009-3-1 11:55:55 | 显示全部楼层
哪一版手册?第几章?第几节?

前面执行过什麽命令?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-3-2 16:54:37 | 显示全部楼层
生成glibc库
$root@host:/home/arm/build-tools/build-glibc# CC=arm-linux-gcc ../glibc-2.6.1/configure --host=$TARGET --prefix=”/usr” --enable-add-ons --with-headers=${TARGET_PREFIX}/include
--cache-file=config.cache
$root@host:/home/arm/build-tools/build-glibc# make
$root@host:/home/arm/build-tools/build-glibc# make install_root=${TARGET_PREFIX} prefix=”” install

对libc.so作出修改:

$root@host:/home/arm/build-tools/build-glibc# cd ${TARGET_PREFIX}/lib

$root@host:/home/arm/tools/arm-linux/lib#  vi 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-littlearm)

GROUP ( /lib/libc.so.6 /lib/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux.so.2 ) )

将GROUP这一行的内容改为:

GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.2 ) )

              $root@host:/home/arm/tools/arm-linux/lib#  cat libpthread.so

              /* GNU ld script

            Use the shared library, but some functions are only in

            the static library, so try that secondarily.  */

OUTPUT_FORMAT(elf32-littlearm)

GROUP ( /lib/libpthread.so.0 /lib/libpthread_nonshared.a )

              将GROUP这一行的内容改为:

              GROUP (libpthread.so.0  libpthread_nonshared.a )

生成完整的编译工具:

$root@host:/home/arm/tools/arm-linux/lib# cd ${PRJROOT}/build-tools/build-gcc

$root@host:/home/arm/build-tools/build-gcc# ../gcc-4.2.1/configure --target=$TARGET --prefix=${PREFIX}  --enable-shared
--enable-languages=c,c++ --with-threads=posix
$root@host:/home/arm/build-tools/build-glibc# make all 此处就出现上述错误
我环境是gcc-4.2.1;glibc-2.6.1;binutils-2.18
宿主机是
linux-2d4a:/home/arm/build-tools # uname -a
Linux linux-2d4a 2.6.25.5-1.1-pae #1 SMP 2008-06-07 01:55:22 +0200 i686 athlon i386 GNU/Linux
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表