Nixpkgs: meson does not detect boost correctly

Created on 7 Feb 2019  路  6Comments  路  Source: NixOS/nixpkgs

Issue description

meson does not detect boost correctly.

Dependency Boost (filesystem, regex, system) found: NO

meson.build:3:0: ERROR:  Dependency "boost" not found

Steps to reproduce

# 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.

Technical details

  • system: "x86_64-darwin"
  • host os: Darwin 18.2.0, macOS 10.14.2
  • multi-user?: no
  • sandbox: no
  • version: nix-env (Nix) 2.2
  • channels(val): "nixpkgs-19.03pre167858.f2a1a4e93be"
  • nixpkgs: /Users/val/.nix-defexpr/channels/nixpkgs
bug stale darwin

All 6 comments

Essentially, 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.

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.

Was this page helpful?
0 / 5 - 0 ratings