How to create meson.build with external libs?

p.shkadzko p.shkadzko at gmail.com
Mon Jan 13 20:53:43 UTC 2020


On Monday, 13 January 2020 at 19:56:35 UTC, p.shkadzko wrote:
> On Monday, 13 January 2020 at 17:14:29 UTC, p.shkadzko wrote:
>> On Sunday, 12 January 2020 at 22:12:14 UTC, Rasmus Thomsen 
>> wrote:
>>> On Sunday, 12 January 2020 at 22:00:33 UTC, p.shkadzko wrote:
>>>> [...]
>>>
>>> In difference to dub, meson will _not_ auto-download required 
>>> software for you. You have to ways to go forward with this:
>>>
>>> [...]
>>
>> I followed the 1 step, namely git cloned the lubeck and 
>> installed it with meson into /usr/local however, I still get 
>> the same error. Could I miss anything?
>
> I had to set PKG_CONFIG_PATH to "/usr/local/lib/pkgconfig". For 
> some reason Manjaro distro doesn't have it set by default. 
> After setting the pkgconfig path, lubeck is getting found and 
> everything works.

After I ran "meson build" I got the following output:
-----------------------
The Meson build system
Version: 0.52.1
Source dir: /home/tastyminerals/dev/test_proj
Build dir: /home/tastyminerals/dev/test_proj/build
Build type: native build
Project name: mir_quickstart
Project version: 0.1
D compiler for the host machine: ldc2 (llvm 1.18.0 "LDC - the 
LLVM D compiler (1.18.0):")
D linker for the host machine: GNU ld.gold 2.33.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (1.6.3)
Run-time dependency mir-algorithm found: YES 3.4.0
Run-time dependency lubeck found: YES 1.0.0
Build targets in project: 1
Found ninja-1.9.0 at /usr/bin/ninja

I then cd to build/ dir and run "ninja"
------------------------
[2/2] Linking target test_proj.tart at exe/app.d.o'.

But when I try to run compiled app.d file as demo_run, I get:
------------------------
./demo_run: error while loading shared libraries: 
libmir-algorithm.so: cannot open shared object file: No such file 
or directory

I thought that if meson builds and finds the external libs 
successfully and ninja links everything, all should be fine. I 
don't understand. Why the compiled file cannot find the external 
library?


More information about the Digitalmars-d-learn mailing list