From 4eea7ff42736d0fba240ce2fadb7ce00aeffbaca Mon Sep 17 00:00:00 2001 From: Tobias M Date: Wed, 28 May 2025 18:22:17 +0200 Subject: [PATCH] cctag: Fix Darwin build Fix the Darwin build by removing the dependency on the math_c99 libraries which aren't required on Darwin. Also re-enable tests on Darwin by fixing the linking issue. Co-authored-by: Reno Dakota --- .../cctag/cmake-no-apple-rpath.patch | 26 +++++++++++++++++++ pkgs/development/libraries/cctag/default.nix | 13 +++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/libraries/cctag/cmake-no-apple-rpath.patch diff --git a/pkgs/development/libraries/cctag/cmake-no-apple-rpath.patch b/pkgs/development/libraries/cctag/cmake-no-apple-rpath.patch new file mode 100644 index 000000000000..5884e39ad651 --- /dev/null +++ b/pkgs/development/libraries/cctag/cmake-no-apple-rpath.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d0e35b6..fc19477 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -96,20 +96,6 @@ endif() + # set the path where we can find the findXXX.cmake + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") + +-if(APPLE) +- +- # avoid the cmake policy warning about @rpath in MacOSX +- cmake_policy(SET CMP0042 NEW) +- +- SET(CMAKE_MACOSX_RPATH TRUE) # initialize the MACOSX_RPATH property on all targets +- SET(CMAKE_SKIP_BUILD_RPATH FALSE) # don't skip the full RPATH for the build tree +- # SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # when building, don't use the install RPATH already +- SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) # when building, use the install RPATH already +- # probably not needed +- # SET(CMAKE_INSTALL_RPATH "") # the RPATH to be used when installing +- SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # LC_RPATH for CUDA and OpenCV etc written into executable +-endif(APPLE) +- + # FIND BOOST + set(BOOST_REQUIRED_COMPONENTS "atomic;chrono;date_time;filesystem;program_options;serialization;system;thread;timer;math_c99") + if(WIN32) + diff --git a/pkgs/development/libraries/cctag/default.nix b/pkgs/development/libraries/cctag/default.nix index d187d70152da..28a8bb3c3dc9 100644 --- a/pkgs/development/libraries/cctag/default.nix +++ b/pkgs/development/libraries/cctag/default.nix @@ -17,9 +17,8 @@ stdenv.mkDerivation rec { version = "1.0.4"; outputs = [ - "lib" - "dev" "out" + "dev" ]; src = fetchFromGitHub { @@ -41,8 +40,15 @@ stdenv.mkDerivation rec { patches = [ ./cmake-install-include-dir.patch + ./cmake-no-apple-rpath.patch ]; + # darwin boost doesn't have math_c99 libraries + postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' + substituteInPlace CMakeLists.txt --replace-warn ";math_c99" "" + substituteInPlace src/CMakeLists.txt --replace-warn "Boost::math_c99" "" + ''; + nativeBuildInputs = [ cmake ]; @@ -57,8 +63,7 @@ stdenv.mkDerivation rec { opencv.cxxdev ]; - # Tests are broken on Darwin (linking issue) - doCheck = !stdenv.hostPlatform.isDarwin; + doCheck = true; meta = with lib; { description = "Detection of CCTag markers made up of concentric circles";