找不到/lib/libc.so.6 [英] Cannot find /lib/libc.so.6

查看:1379
本文介绍了找不到/lib/libc.so.6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在交叉编译一个应用程序,但是链接崩溃并显示错误消息

I'm cross-compiling an application, but linking blows up with an error that it

找不到/lib/libc.so.6".

"cannot find /lib/libc.so.6".

它应该使用的libc.so.6是位于/home/work/worldcom/filesys/lib/libc.so.6的libc.so.6.我这是怎么了?

The libc.so.6 that it should be using is the one that sits at /home/work/worldcom/filesys/lib/libc.so.6. What have I got wrong here?

linking libobj.so
arm-none-linux-gnueabi-g++ obj1.o obj2.o obj2.o  -o libobj.so -L/home/work/worldcom/filesys/usr -Wl,-O1 -Wl,-z,defs -Wl,--enable-new-dtags -Wl,--sort-common -Wl,--as-needed -Wl,--hash-style=both -L/home/work/worldcom/filesys -L/home/work/worldcom/filesys/lib -L/home/work/worldcom/filesys/usr/lib -lcurl -shared
/home/lishevita/armv5tel/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
/home/lishevita/armv5tel/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find /lib/libc.so.6
collect2: ld returned 1 exit status<br />
make: *** [libobj.so] Error 1<br />

我的Makefile是手写的(即不是由 Autotools 生成的).为了避免出现笼统的您的Makefile损坏"的情况,以下是Makefile中的一些详细信息,可能有助于弄清这些问题.

My makefile is handwritten (i.e. not generated by Autotools). In order to avoid a blanket "your Makefile is broken" here are some details from the makefile that might help clarify.

CROSS_COMPILE = arm-none-linux-gnueabi-  
SYSROOT = /home/work/worldcom/filesys/  
DESTDIR = /home/work/worldcom/filesys/  

RELEASE_CXXFLAGS = -Os  
DEBUG_CXXFLAGS = -O0 -gstabs  
PKGCONFIG=`env ROOT=/home/work/worldcom/filesys cross-pkg-config glib-2.0 libcurl --cflags`  

CC = $(CROSS_COMPILE)gcc  
CXX = $(CROSS_COMPILE)g++  
LD = $(CROSS_COMPILE)ld  
AR = $(CROSS_COMPILE)ar  

LDFLAGS = -Wl,-O1 -Wl,-z,defs -Wl,--enable-new-dtags -Wl,--sort-common -Wl,--as-needed -Wl,--hash-style=both -L$(SYSROOT) -L$(SYSROOT)lib -L$(SYSROOT)usr -L$(SYSROOT)usr/lib -lcurl  

libobj.so: $(LIBOBJ_OBJS)  
        @echo linking $@  
        $(CXX) $^ -o $@ $(LDFLAGS) -shared $(PKG_LIBS) 

当然,还有LIBOBJ_OBJS的定义和目标,但与问题无关.

Of course there is also a definition and target for the LIBOBJ_OBJS but those are irrelevant to the problem.

推荐答案

您没有指出要使用的gcc版本,但是如果它是最新版本(我认为高于4.0.0),则应尝试使用-sysroot标志到g ++/ld.将其指向Makefile中定义的$ SYSROOT.

You didn't indicate what gcc version you are using, but if it is a recent enough one (4.0.0 and above me thinks) you should try the -sysroot flag to g++/ld. Point it to $SYSROOT as defined in your Makefile.

假设最近的gcc版本足够,它将起作用.

Assuming recent enough gcc version, it will work.

希望这会有所帮助, 吉拉德

Hope this helps, Gilad

这篇关于找不到/lib/libc.so.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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