Hello. I’m trying to build jeremy-rifkin/libassert
using Nix. The library depends on jeremy-rifkin/cpptrace
which in turn depends on davea42/libdwarf-code
.
I successfully build libdwarf and cpptrace, but I cannot build libassert.
The reason being, when I set -DLIBASSERT_USE_EXTERNAL_CPPTRACE=ON
, even tho I see it being added to cmakeFlags in the nix log
, the build process doesn’t pick this up, and I get an error that it cannot find git
for cpptrace-populate
:
error: builder for '/nix/store/rv0k2rs1mgaj3vdzzlyspmi07whmbpxp-libassert-2.0.2.drv' failed with exit code 1;
last 20 log lines:
-- Detecting CXX compile features - done
CMake Error at /nix/store/0xpv46mb188z226j7cs211zmmi5xw9nj-cmake-3.29.1/share/cmake-3.29/Modules/ExternalProject.cmake:2945 (message):
error: could not find git for clone of cpptrace-populate
Call Stack (most recent call first):
/nix/store/0xpv46mb188z226j7cs211zmmi5xw9nj-cmake-3.29.1/share/cmake-3.29/Modules/ExternalProject.cmake:4456 (_ep_add_download_command)
CMakeLists.txt:29 (ExternalProject_Add)
Which is due to this code path:
if(LIBASSERT_USE_EXTERNAL_CPPTRACE)
find_package(cpptrace REQUIRED)
else()
include(FetchContent)
FetchContent_Declare(
cpptrace
GIT_REPOSITORY "${LIBASSERT_CPPTRACE_REPO}"
GIT_TAG "${LIBASSERT_CPPTRACE_TAG}"
)
FetchContent_MakeAvailable(cpptrace)
endif()
If it picked up the flag, it should use find_package
, which then should work (or at least produce a completely different error).
Here’s the repro which fails: https://github.com/dich0tomy/repro. A simple nix build
will fail.
I also tried doing
preConfigure = ''
cmakeFlagsArray+=(
"-D....."
)
'';
And using configureFlags
instead, but nothing works.
If I go into a shell with cmake and add cpptrace
to packages, then clone the libassert repo and build it manually, everything works fine:
nix develop
git clone git@github.com:jeremy-rifkin/libassert/
cd libassert
cmake -S . -B build -DLIBASSERT_USE_EXTERNAL_CPPTRACE=ON
cmake --build build --parallel 16