I am using Gnome builder for a .vala project. In this project I want to use libserialport of which I have the library and -devel packages installed. At first I was having issues with the vala part of the library, which turned out to be the .vapi file missing which was easily solved. However now I’m having trouble with the C library part of it and am getting the following error if I include it as: meson.get_compiler('c').find_library('libserialport')
C shared or static library ‘libserialport’ not found
It does show up in pkgconfig pkg-config --list-package-names | grep libserialport and I can find the library in /usr/lib64
Contents of /urs/lib64/pkgconfig/libserialport.pc:
I’d indeed expect dependecy('libserialport') to work, but it doesn’t. I think it might be because it is in /usr/lib64 not /usr/lib(running Fedora). However I don’t know how to make it use lib64.
Btw also tried find_library('serialport') but that doesn’t work either. Or any variation of it with dependecy.
Since you are using Builder, it is possible that you are building a flatpak. If this is the case, it won’t find libraries installed in your host system. You need to add (instructions for building) the libraries you need to the flatpak manifest.
That is probably it (I am using flatpak build). Is there a simple way to add it to the manifest (from e.g. pkconfig)? Did a quick search, but haven’t found it. If you don’t, no problem, I’ll at least have something to do this weekend.
You don’t add it from the pkg-config. You add instructions on how to build it from sources (so you don’t need to install it on your system). You need to do something like what is described here.
Alright. So here is my genius solution (for anyone reading this at a later time): “don’t bother with flatpak”.
I’m not going to build all dependencies locally if I have them right here already. Seems kind of a flaw of flatpak tbh. If you have any closed source dependency you can’t make a flatpak.