-1

I am making a shared library using C language. This lib has a dependencies from libjpeg and X api. I am building it on Ubuntu 18.04 OS and to build it I use the following command: gcc mycode.c -o libname.so --shared -lX11 -lXss -lXExt -ljpeg -fPIC.

I want to use this library on debian based operating systems, for example Debian OS. When I call functions of this library on Debian 9.9, I receive an exception Unable to load a file libname.so or one of it's dependencies. But when I build this C code with the same command on Debian and further use it - all is working.

I assume that the problem is in libjpeg because on Ubuntu I use library called libjpeg but there is no library with the same name on Debian and I use libjpeg-turbo.

Help me please to realize how to build my library in Ubuntu and then use it on other Debian based systems.

Also, I want to mention that I am not an expert at Linux distributions and difference between them, and if things that I want to do are impossible, sorry for time wasting.

  • 1
    Could you edit your question to show the exact error you’re getting, with the real library name, including numbers, instead of libname.so? – Stephen Kitt Jul 12 at 6:16
0

When you do:

ldd path/to/your/libname.so

on the Debian system then ldd will show you what it thinks that library links to and whether the ld.so will be able to resolve/find the listed libraries.

That should show you what the actual problem is and which dependency/library you are missing on the Debian system.

Even better would be to do:

ldd path/to/the/executable_that_links_to_libname

because that would show you (and us here) the information you've omitted above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.