How to include shared library in my .rpm?

I am making an application in which I use a 3rd party shared library. I don’t have its source code, just the compiled .so binary and includes.

How can I include that library in my application’s rpm, so that it gets copied to the device’s lib / lib64 folder? This library is not available from anywhere as an automatically downloadable dependency, and without it I get an error that “Nothing provides xxxxxxx.so()(64bit)” and deployment or manual .rpm installation fails.

I knew how to do it on BB10 but somehow I can’t figure it out on SFOS.

I do have LIBS += -L$$PWD/libs/ -llibname in .pro, but that obviously doesn’t cause the lib to be included in the package.

What else do I need to do?

P.S. It’s not intended to be distributed in harbour, so their restrictions are not important here. I just want to bundle the library with my package so that it gets installed with it.

OK, I figured it out.

In .pro file:

library.files = $$PWD/libs/libraryname.so
library.path = $$[QT_INSTALL_LIBS]

INSTALLS += library

and then in .yaml file:

- '%{_libdir}/libraryname.so'

did the job.

Note that if you plan to distribute your app via Jolla Store/Harbour, you will need to package the library at a path belonging to your application and use RPATH to help the linker locate it. See the FAQ. More info can be found here on Forum, e.g., Using libpoppler in harbour application.

1 Like

Thank you! I’ll check it out!

You can also include libraries like done in Communi:

To explain:
Communi has libcommuni as backend that is build in the “…/backend” folder and then linked
using “-L…/backend -libname”.
This way the linker nows to link against the libraries in the packagend folder.

The backend is build earlier in the build system as can be seen here:

The point of explaining on how the backend is build is that the way you make sure your library is build depends on your target library.
Many libraries such as KDE Frameworks have ways to include them into your build system so they
are build in the same chain of dependencies.
You need to make sure to know how to do this.

1 Like

Thank you very much for such a detailed explanation!