我在Debian Jessie 8.10 amd64上创建了一个针对arm架构的c ++应用程序。我在链接https://wiki.embeddedarm.com/wiki/Jessie_armhf_Cross_Compile之后交叉编译了armhf的源代码。 该应用程序还依赖于一些安装在/ usr / local / arm / lib /文件夹中的Poco共享库。我使用的Makefile如下:
CC := /usr/bin/arm-linux-gnueabihf-g++
# Folders
SRCDIR := src
BUILDDIR := build
TARGETDIR := bin
# Targets
EXECUTABLE := my_app
TARGET := $(TARGETDIR)/$(EXECUTABLE)
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
CFLAGS := -c -Wall -std=c++14
INC := -I include -I /usr/local/arm/include/
LIB := -L /usr/local/arm/lib/ -lPocoCrypto -lPocoFoundation -lPocoJSON -lPocoNet -lPocoNetSSL -lPocoUtil
$(TARGET): $(OBJECTS)
@echo " Linking..."
$(CC) $^ -o $(TARGET) $(LIB)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(BUILDDIR)
$(CC) $(CFLAGS) $(INC) -c -o $@ $<
clean:
@echo " Cleaning...";
$(RM) -r $(BUILDDIR) $(TARGET)
.PHONY: clean
可执行文件已成功构建。另外我想在debian linux上运行可执行文件,所以我安装了以下软件包:
sudo apt-get install qemu binfmt-support qemu-user-static qemu-user
但是当我给出时:
qemu-arm -L /usr/local/arm/lib/ ./my_app
我得到以下输出:
error while loading shared libraries: libPocoCrypto.so.48: cannot open shared object file: No such file or directory
我还在文件arm-linux-gnueabihf.conf中添加了路径/ usr / local / arm / lib /,该文件位于/etc/ld.so.conf.d/中 当我给sudo ldconfig -v然后我得到了:
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoUtil.so.48 is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoNet.so.48 is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoFoundation.so.48 is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoJSON.so.48 is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoFoundation.so is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoCrypto.so is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoUtil.so is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoCrypto.so.48 is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoNetSSL.so is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoJSON.so is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoNetSSL.so.48 is for unknown machine 40.
/sbin/ldconfig.real: /usr/local/arm/lib/libPocoNet.so is for unknown machine 40.
我也给了:qemu-arm -L /usr/lib/arm-linux-gnueabihf/ ./my_app
但结果相同。
我做错了什么或qemu用户无法执行此任务?
答案 0 :(得分:0)
如果你注意到你在运行ldconfig -v时遇到错误“soname是未知的机器40”,这意味着你没有被添加到路径中。