armv6zk-none-linux-gnueabi/bin/ld: cannot find /lib/libc.so.6 与cannot find /lib/libpthread.so.0

参考:(需翻墙)

http://xc0ffee.wordpress.com/2011/04/28/linker-%E2%80%9Cld-cannot-find-liblibpthread-so-0%E2%80%B3/

我直接粘贴过来吧:

Linker “ld: cannot find /lib/libpthread.so.0

Having frustrated using Scratchbox to compile my module code for ARM device, I decided to switch to cross-compilation in Desktop for ARM target. I feel scratchbox is one of the most stupidest, difficult to use, good-for-nothing software, which serves nothing better than what cross compiler toolchains can do. And the worst part is, if you do not have admin rights at the host system where scratchbox is installed, then it means, you can not install and use your favourate softwares, like emacs, git!! Stealing your freedom?, definately not a good deal!. Right?

Well, next task was to setup the cross-compilation environment, in my host x86 machine, using appropriate toolchains, with the aid of gcc’s –sysroot option. I managed to write a small script to cross-compile my code using scratchbox-toolchain-arm-linux-cs2010q1-202 cross compiler (http://www.scratchbox.org/download/files/sbox-releases/hathor/tarball/). Compilation went through fine, however, while linking my module, linker thowed below error, even though I made sure all paths are properly set,

/opt/compilers/arm-linux-cs2010q1-202/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld:skipping incompatible /lib/libpthread.so.0 whensearching for /lib/libpthread.so.0
/opt/compilers/arm-linux-cs2010q1-202/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find /lib/libpthread.so.0

It seems like linker is searching for “/lib/libpthread.so.0″ instead of plain “libpthread.so.0″. After scratching head for hours and googling, I figured the cause for this error. The linker script at libc/usr/lib/libpthread.so has the following grouping,

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

And so this is where the /lib/libpthread.so.0 path is coming from. Modifiying the above line and removing the path information, like below,

GROUP ( libpthread.so.0 libpthread_nonshared.a )

linking just happened perfectly fine! Best part is, the compilation happens much faster now. Also I am able to use all my native sotwares freely. I got my “freedom” 

********************************************************************************************************************************************

下面是我自己的修改:

我目录在:/opt/ubq/devkit/arm/arm11/target/usr/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-littlearm)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux.so.3 ) )

将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/libpthread.so.0 /usr/lib/libpthread_nonshared.a )

分别改为:

/* 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 ( libpthread.so.0 libpthread_nonshared.a )


/* 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 ( libc.so.6 libc_nonshared.a  AS_NEEDED ( /lib/ld-linux.so.3 ) )

这个问题不大好查。我考虑了添加-L参数,修改configure脚本,甚至直接修改Makefie都没有成功。

甚至考虑配置libtools。

不过,功不唐捐,熟悉了automake等得基本原理。回头分析一下webkit的autuomake过程。

libc.so 是 典型的暗含的连接脚本文件。这个知识点要留意。

参考:

 http://blog.chinaunix.net/space.php?uid=10678279&do=blog&id=2936584

修改完:

继续编译:

发现:cannot find /lib/ld-linux.so.3

注意上面GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( /lib/ld-linux.so.3 ) )这句话。

我目录下没有ld-linux.so.3 ,google后参考http://ubuntuforums.org/showthread.php?t=1437538:

找到ld-2.7.so执行:ln -s ld-2.7.so ../usr/lib/ld-linux.so.3

终于webkit编译成功。爽一把再说。哈哈

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值