I’ve been trying to add a new nix package for manticore-search (Add new manticore-search package by jdelStrother · Pull Request #186112 · NixOS/nixpkgs · GitHub ), but keep running into problems getting cmake to locate its various dependencies.
To take a specific example, manticore depends on re2
, and and uses cmake to look it up (eg find_package(re2 CONFIG)
/ find_package(re2 MODULE)
). (manticoresearch/GetRE2.cmake at c63d173592388ebaf8f17478c4930a3fce903c0f · manticoresoftware/manticoresearch · GitHub )
Just adding re2
to buildInputs and relying on the cmake shell hooks doesn’t seem to be cutting it, and I don’t really get why. re2 doesn’t supply a re2-config.cmake file (though does have a pkgconfig/re2.pc). Do I need to generate my own re2-config.cmake ? Or is there a better way of specifying that dependency?
I’ve also been spamming cmake flags in the hopes one of these variations might do something , but no luck so far.
"-DRE2_LIBRARY=${re2}/lib/libre2.a"
"-Dre2_DIR=${re2}/include"
"-DRE2_DIR=${re2}/include"
"-Dre2_LIBRARY=${re2}/lib/libre2.a"
"-Dre2_INCLUDE_DIR=${re2}/include"
"-DRE2_LIBRARY=${re2}/lib/libre2.a"
"-DRE2_INCLUDE_DIR=${re2}/include"
You can see the current WIP here:
{ lib, stdenv, fetchFromGitHub, fetchurl
, bison, cmake, flex
, boost, icu, mariadb-connector-c, re2
,pkg-config
}:
let
boost_static = boost.override { enableStatic = true; };
columnar = stdenv.mkDerivation rec {
pname = "columnar";
version = "c16-s5"; # see NEED_COLUMNAR_API/NEED_SECONDARY_API in Manticore's GetColumnar.cmake
src = fetchFromGitHub {
owner = "manticoresoftware";
repo = "columnar";
rev = version;
sha256 = "sha256-iHB82FeA0rq9eRuDzY+AT/MiaRIGETsnkNPCqKRXgq8=";
};
nativeBuildInputs = [ cmake ];
cmakeFlags = [ "-DAPI_ONLY=ON" ];
meta = {
description = "A column-oriented storage and secondary indexing library";
This file has been truncated. show original
which currently fails with these build errors: gist:0989545e3542132a4f995fadda3b63ef · GitHub
Sandro
October 21, 2022, 11:21am
2
Did you already try adding pkg-config to nativeBuildInputs?
Yeah, didn’t make any difference.
tobim
October 21, 2022, 4:01pm
4
The most important piece of info upstream is the FindRe2.cmake
module, which documents how to add additional paths to the search paths: manticoresearch/FindRE2.cmake at c63d173592388ebaf8f17478c4930a3fce903c0f · manticoresoftware/manticoresearch · GitHub
That means "-DWITH_RE2_INCLUDES=${re2}/include" "-DWITH_RE2_LIBS=${re2}/lib"
might do the trick. YMMV, I didn’t actually test that, but it should get you closer.
NB: There is an open PR that changes re2 to build with CMake: re2: switch to CMake by azahi · Pull Request #196123 · NixOS/nixpkgs · GitHub . But that won’t help you in this case.
Thanks, I managed to mostly get that approach working.
I did have add -DWITH_RE2_FORCE_STATIC=0
, and then rename FindRE2.cmake to Findre2.cmake - I guess maybe that codepath has never been tried on a case-sensitive filesystem…?
@onny over at github suggested replacing their with_get
logic with with_menu
(manticoresearch/CMakeLists.txt at c01ec3de1d20cbcb040728b401432042ac39ca44 · manticoresoftware/manticoresearch · GitHub ), so their GetFoo.cmake files are bypassed entirely, which helps cmake/pkg-config find the dependencies without needing to manually specify all the paths. Think I’m going to try that approach.