更改哪个libc.so被链接? [英] Changing which libc.so gets linked?

查看:953
本文介绍了更改哪个libc.so被链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的路由器上为MIPSEL进行交叉编译。我在汇编中得到了一些东西,但现在我转向尝试编译基本的C代码。

目前只有简单的hello world c代码,并且使用mipsel-linux-gnu-gcc编译器,该编译器适用于汇编。

编译器命令:

  mipsel-linux-gnu-gcc  - L / home / uname / devel / extr / squashfs-root / lib -l:libc.so.0 -mips32 -Wl, -  build-id = none -Wl, -  dynamic-linker = / lib / ld -uClibc .so.0 ma.c 

libc.so.0是从路由器的固件中提取的。

该程序编译,但在readelf中,问题在于它与libc.so.6链接



<$ p共享库:[libc.so.6]



0x00000001(需要) p>,而从固件中拉出busybox二进制文件并运行readelf就可以了


  0x00000001(需要)共享库:[libc.so .0] 

如何使它与libc.so.0链接?

解决方案

想通了。必须使用buildroot构建一个uClibc工具链。

Im trying to cross compile for MIPSEL on my router. I got stuff working in assembly, but now Im moving to trying to compile basic C code.

Currently just have simple hello world c code, and using the mipsel-linux-gnu-gcc compiler, which works for assembly.

Compiler command:

 mipsel-linux-gnu-gcc  -L/home/uname/devel/extr/squashfs-root/lib -l:libc.so.0 -mips32 -Wl,--build-id=none -Wl,--dynamic-linker=/lib/ld-uClibc.so.0  ma.c

The libc.so.0 is extracted from the firmware for the router.

The program compiles, however in readelf, the issue is that it links against libc.so.6

 0x00000001 (NEEDED)                     Shared library: [libc.so.6]

whereas pulling the busybox binary from the firmware and running readelf on it

0x00000001 (NEEDED)                     Shared library: [libc.so.0]

How do I get it to link against libc.so.0?

解决方案

Figured it out. Had to build a uClibc toolchain using buildroot.

这篇关于更改哪个libc.so被链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆