mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.51k stars 1.6k forks source link

Failed link with boost using ldc2 #7842

Open Rogni opened 3 years ago

Rogni commented 3 years ago

Describe the bug https://travis-ci.org/github/Rogni/MesonLinkWithBoostBug/builds/735436192#L307

error link boost using ldc2 in last versions meson (0.54, 0.55)

Error:

ldc2  -of=app app.p/main.d.o app.p/external.cpp.o -L=--allow-shlib-undefined -link-defaultlib-shared /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 -L=-lstdc++ -L=-lstdc++
Error: unrecognized file extension 1

To Reproduce reproduced in versions 0.54 and 0.55 in version 0.53.2 boost linked as LINK_ARGS = -L=-L--allow-shlib-undefined -L=--start-group -L=-lboost_thread -L=-lstdc++ -L=--end-group

https://github.com/Rogni/MesonLinkWithBoostBug

meson.build

project('MesonLinkBoostBug', ['d', 'cpp'])
src = ['main.d', 'external.cpp']
boost_dep = dependency('boost', modules: 'thread')
executable('app', src, dependencies: boost_dep)

Expected behavior maybe need append prefix -L= to /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1

system parameters

dcbaker commented 3 years ago

This is also broken with dmd, only gdc currently works.

mensinda commented 3 years ago

Is this a general bug when passing absolute paths to libraries, or is this boost specific?

Rogni commented 3 years ago

tried

zlib = dependency('zlib', method: 'cmake')

executable('app', src, dependencies: zlib)

in build.ninja:

LINK_ARGS = -L=--allow-shlib-undefined -link-defaultlib-shared /usr/lib/x86_64-linux-gnu/libz.so -L=-lstdc++

app linked

dcbaker commented 3 years ago

it has to do with getting version numbers, ldc and dmd expect the file to end in .so (or whatevert) not .so.X.Y.Z, but if you pass them as -L=mylib.so.1.2.3 that works. And it's really easy for the DMD and LDC to do that. so that's what I did my my PR.