'Selecting a Meson dependency as another Meson project
I am trying to build gedit and gedit-plugins using Meson on Fedora 34. Here I am using the fedora:34 container as the environment.
First I build gedit and install it to /opt, which works fine.
sudo dnf install meson ninja-build git
sudo dnf install 'dnf-command(builddep)'
sudo dnf builddep gedit
git clone https://gitlab.gnome.org/GNOME/gedit.git
cd gedit
mkdir build && cd build
meson --prefix /opt
ninja
sudo ninja install
cd ..
Now I want to build gedit-plugins and use the previous built gedit as a dependency.
git clone https://gitlab.gnome.org/GNOME/gedit-plugins.git
cd gedit-plugins
mkdir build && cd build
meson --prefix /opt
However, the last meson --prefix /opt command fails:
Run-time dependency gedit found: NO (tried pkgconfig)
../meson.build:29:0: ERROR: Dependency "gedit" not found, tried pkgconfig
A full log can be found at /gedit-plugins/build/meson-logs/meson-log.txt
I know that if I install gedit-devel, then this dependency can be solved by providing header files in /usr/include/gedit-40.0/gedit/. However, I would like meson to find header files in /opt/include/gedit-40.0/gedit/ automatically. How can I achieve this?
I tried LIBRARY_PATH=/opt meson --prefix /opt and LIBRARY_PATH=/gedit/build meson --prefix /opt, but neither work.
Solution 1:[1]
In meson.build like 29 checks the dependency via gedit_dep = dependency('gedit', version: '>= 40.0'). You can add your custom folder to look by editing the line as gedit_dep = dependency('gedit', version: '>= 40.0', dirs: '/opt').
This is because you have installed the libraries and dependency of gedit in /opt
Solution 2:[2]
Try using Meson compiler.find_library().
Use:
dirargument to specify directories to search in for binaryhas_headersandheader_include_directoriesto specify which headers are required and where to search for them
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Vipin Varghese |
| Solution 2 | Danijel |
