Skip to content
Advertisement

CMake Lib in Linux Docker missing dependencies

I use CMake to create the DLL and SO file from my own C++ library, which I then call in my C# code via DLLImport. This has worked so far under Windows and under Linux (Docker). Now the library has been extended, which continues to work on Windows with the DLL. However, under Linux I now get the following error message when calling a DLL function:

Unable to load shared library ‘CustomLib’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libCustomLib: cannot open shared object file: No such file or directory

Since it worked before under Linux I think it should find the library and therefore the dependencies are the problem. But now I don’t know how to proceed.

A colleague helped me with the analysis and I got the following information

JavaScript

I’m using .NET 5.0 and the GCC-compiler

CMake-configuration

JavaScript

CMakeLists.txt

JavaScript

Dockerfile

JavaScript

api-part of docker-compose

JavaScript

Advertisement

Answer

We have solved the problem. The reason was that the backend was running a different Linux distribution (Debian) than the Linux in which the DLL/SO was built (Ubuntu).

I changed the image in the dockerfile from …:5.0 to …:5.0-focal for Ubuntu.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement