我有一个Xilinx运行一个软处理器(PowerPC)。最近,我交叉编译了PowerPC的Boost库,并希望对其进行测试。因此,我使用其中一个示例程序,并试图交叉编译它为我的目标。下面是代码
#include <boost/thread/thread.hpp>
void helloworld()
{
printf( "Hello World!");
}
int main()
{
boost::thread thrd(&helloworld);
thrd.join();
}下面是我的制作文件
CPP=ppc_4xx-g++
CFLAGS=-c -g -Wall
LDFLAGS_PowerPC=-L/shared/deps/powerpc/lib -L/opt/ELDK/4.2/ppc_4xx/lib/
LIBS_PowerPC=-lboost_thread -lboost_system -lpthread -lrt
INCLUDES=-I. -I./4.2.2/ -I./include -I/opt/ELDK/4.2/ppc_4xx/usr/include/
CPPFLAGS_PowerPC=-I/shared/deps/common/include
CPPFLAGS_COMMON=-I/shared/deps/powerpc/include
CPPFLAGS=$(CPPFLAGS_COMMON) $(CPPFLAGS_PowerPC)
all: helloworld
helloworld: helloworld.o
$(CPP) $(LDFLAGS_PowerPC) $(LIBS_PowerPC) helloworld.o -o helloworld
helloworld.o: helloworld.cpp
$(CPP) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) helloworld.cpp
clean:
rm -rf *.o helloWorld我能够生成二进制文件,但是当我在我的目标上运行程序时,我会得到以下错误
-/bin/sh: ./helloworld: not found我在网上查了一下,发现当我们有动态链接时,上面的问题就出现了。我的Boost库存在于location /shared/deps/powerpc/lib中,并且我使用下面的命令相应地设置了变量LD_LIBRARY_PATH。
export LD_LIBRARY_PATH=/shared/deps/powerpc/lib/:/opt/ELDK/4.2/ppc_4xx/lib/但即使那样我也会遇到同样的问题。
下面是uname -ars的输出
Linux (none) 3.0.0-14.1-build3+ #23 PREEMPT Thu Jan 3 18:44:27 CST 2013 ppc GNU/Linux我没有在目标上安装ldd,所以我无法检查动态依赖项。但我相信,图书馆也包括在内。我该怎么做?
发布于 2013-06-24 01:27:53
即使我的嵌入式Linux系统有一个动态链接器,它也无法工作。当我使用工具链提供的动态链接器并将其替换为正确的目录时,问题得到了解决。现在动态链接很好。
https://stackoverflow.com/questions/16045578
复制相似问题