2

I have created a c++ app on Debian Jessie 8.10 amd64 targeted for arm architecture. I cross compiled the source code for armhf following the link https://wiki.embeddedarm.com/wiki/Jessie_armhf_Cross_Compile. The app is also dependent on some Poco shared libraries which are installed in folder /usr/local/arm/lib/ . The Makefile I used is the following:

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

The executable is successfully built. Furthemore I wanted to run the executable on the debian linux so I installed the following packages:

sudo apt-get install qemu binfmt-support qemu-user-static qemu-user

But when I give:

qemu-arm -L /usr/local/arm/lib/ ./my_app

I get the following output:

error while loading shared libraries: libPocoCrypto.so.48: cannot open shared object file: No such file or directory

I also added the path /usr/local/arm/lib/ in the file arm-linux-gnueabihf.conf which resides in /etc/ld.so.conf.d/
When I gave sudo ldconfig -v then among others I got :

/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.

I aslo gave: qemu-arm -L /usr/lib/arm-linux-gnueabihf/ ./my_app But the same results.
Am I doing something wrong or the qemu-user cannot perform this task?

dk13
  • 1,461
  • 4
  • 20
  • 47

1 Answers1

0

If you noticed you're getting errors when you run ldconfig -v "soname is unknown machine 40", which means your so's are not being added to to path.