.so file is missing while running C++ app

42 Views Asked by At

I am trying to deploy my app as a docker container. I was able to build the app inside the container. I started the container and run ldd myapp command inside it to obtain the list of all dependencies. Then I added new stage to my dockerfile which copied all these dependencies from earlier build stage along with myapp itself. All dependencies had absolute path, except one:

libDependency.so => /ws/MyApp/Module/../../Dependency/lib/libDependency.so (0x00007f8dff102000)

Corresponding to this, I had following line added to my dockerfile:

COPY --from=builder /ws/MyApp/Module/../../Dependency/lib/libDependency.so /ws/MyApp/Module/../../Dependency/lib/libDependency.so 

I was able to build the image. However when I try to run the app from inside the container, it gives me following error:

$ docker run -it app:0.1 /usr/bin/bash
bash-5.0# /ws/MyApp/build/MyApp
/ws/MyApp/build/MyApp: error while loading shared libraries: libDependency.so: cannot open shared object file: No such file or directory

However I checked that this file is indeed there at the path

 /ws/Dependency/lib/libDependency.so

This .so file is referenced in CMakeLists.txt as follows:

SET(DEPENDENCY_LIB ${DEPENDENCY_LIB_DIR}/lib/libDependency.so) 

What I am missing here?

0

There are 0 best solutions below