How to create meson.build with external libs?

p.shkadzko p.shkadzko at gmail.com
Tue Jan 14 09:54:18 UTC 2020


On Monday, 13 January 2020 at 21:15:51 UTC, p.shkadzko wrote:
> On Monday, 13 January 2020 at 20:53:43 UTC, p.shkadzko wrote:
>> 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:
>>>> [...]
>>>
>>> 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: demo_proj
>> 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?
>
> $LD_LIBRARY_PATH was not set to "/usr/local/lib" where 
> libmir-algorithm.so is located. I had to set it explicitly and 
> recompile the project but then I get another error message:
>
> ./demo_proj: error while loading shared libraries: 
> subprojects/mir-algorithm/libmir-algorithm.so.3.4.0: cannot 
> open shared object file: No such file or directory
>
>
> (ಠ_ಠ)

My test app.d didn't have any imports for mir.ndslice and lubeck. 
After I imported them, ninja threw the following error.
-----------
[1/2] Compiling D object 'demo_proj at exe/app.d.o'.
FAILED: demo_proj at exe/app.d.o
ldc2 -I=demo_proj at exe -I=. -I=.. -I/usr/local/include/d/lubeck 
-I/usr/local/include/d/mir-algorithm 
-I/usr/local/include/d/mir-core -I/usr/local/include/d/mir-blas 
-I/usr/local/include/d/mir-lapack 
-I/usr/local/include/d/mir-random -enable-color -wi -dw -g 
-d-debug -of='demo_proj at exe/app.d.o' -c ../app.d
/usr/local/include/d/lubeck/lubeck.d(8): Error: module cblas is 
in file 'cblas.d' which cannot be read
import path[0] = demo_proj at exe
import path[1] = .
import path[2] = ..
import path[3] = /usr/local/include/d/lubeck
import path[4] = /usr/local/include/d/mir-algorithm
import path[5] = /usr/local/include/d/mir-core
import path[6] = /usr/local/include/d/mir-blas
import path[7] = /usr/local/include/d/mir-lapack
import path[8] = /usr/local/include/d/mir-random
import path[9] = /usr/include/dlang/ldc
ninja: build stopped: subcommand failed.

cblas.d is located in /usr/local/include/d/cblas/cblas/cblas.d
I added /usr/local/include/d/cblas/cblas to $PATH but that didn't 
help :(


More information about the Digitalmars-d-learn mailing list