meson does not detect boost correctly.
Dependency Boost (filesystem, regex, system) found: NO
meson.build:3:0: ERROR: Dependency "boost" not found
# meson-boost.nix
{ nixpkgs ? import <nixpkgs> {} }:
with nixpkgs;
stdenv.mkDerivation {
name = "meson-boost";
buildInputs = [
boost
meson
];
}
# meson.build
project('meson-boost', 'c', 'cpp')
dep_boost = dependency(
'boost',
modules: ['filesystem', 'regex', 'system'],
static: true,
)
Then run nix-shell meson-boost.nix, and in the shell, run meson build.
"x86_64-darwin"Darwin 18.2.0, macOS 10.14.2nononix-env (Nix) 2.2"nixpkgs-19.03pre167858.f2a1a4e93be"/Users/val/.nix-defexpr/channels/nixpkgsEssentially, meson tries to run:
clang++ /var/path/to/testfile.cpp -pipe -o /var/path/to/output.exe -O0 -fpermissive -lboost_system-mt -Wl,-undefined,dynamic_lookup
to detect the library.
The -mt part is added to -lboost_system because it believes it will find the multi-threaded version of the library with said suffix. The way nix packages things, AFAICT, suffixes are not used.
cf. https://github.com/NixOS/nixpkgs/issues/784
So a potential fix would be to patch the Python code so that it does not add the -mt suffix for nix. I will experiment and report.
I would report this issue on the meson tracker:
https://github.com/mesonbuild/meson/issues
Issue seems to come from here:
Yeah, I investigated, and as you found out, the problem is that they assume that on a darwin system, the multi-threaded libraries will be found with a -mt suffix. That is not true for the ones as packaged in nixpkgs, so it fails.
An easy fix is to override the derivation to put symbolic links with the -mt suffix next to the original .dylib. And indeed I might message them to see if they can make this process less opinionated.
Hitting this issue on nixpkgs HEAD, from pulseeffects.
@djahandarie that is a different issue and was fixed in https://github.com/NixOS/nixpkgs/commit/61a2045c9a2fd10ce061341209a5b3a649b6cc01.
This one is Darwin specific and unrelated to the Meson's recent rewrite of the boost module. Would be nice to check if it fixed this issue.