gpt4 book ai didi

linux - linux/powerpc 上的动态链接失败

转载 作者:太空宇宙 更新时间:2023-11-04 11:24:02 25 4
gpt4 key购买 nike

我有一个运行软处理器 (PowerPC) 的 Xilinx FPGA。我最近为 PowerPC 交叉编译了 Boost 库并想测试它。因此,我使用了其中一个示例程序并尝试针对我的目标对其进行交叉编译。下面是代码

#include <boost/thread/thread.hpp>

void helloworld()
{
printf( "Hello World!");
}

int main()
{
boost::thread thrd(&helloworld);
thrd.join();
}

下面是我的make文件

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 库位于 /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,所以我无法检查动态依赖项。但我确信,包括图书馆。我该如何继续?

最佳答案

尽管我的嵌入式 Linux 系统有动态链接器,但它无法正常工作。当我使用我的工具链提供的动态链接器并将其替换为正确的目录时,问题得到了解决。现在动态链接没问题了。

关于linux - linux/powerpc 上的动态链接失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16045578/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com