about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMatt Leon <ml@mattleon.com>2024-02-11 16:02:10 -0500
committerMartin Weinelt <hexa@darmstadt.ccc.de>2024-06-17 23:38:36 +0200
commite91df802987b7c83a0462ff7e997b88ed34782a3 (patch)
treef1b9aade1867093232c2137e776968d8a1c2a770 /pkgs
parent04a04bf44a322d134f984d400b12355708250a01 (diff)
openvino: fix aarch64 build
This package was previously marked broken on aarch64. Adding scons as a
native build input, blocking scons's build hooks, and removing
x86-specific build options (for intel processors) seems to have fixed
the build.

I noticed a build error when not using the cmake build dir, so I also
removed that option.

Scons requires an override for python3, so that it doesn't leak the
default python interpreter into the build, which means the native
cpython library would always be built against the default version.

Co-Authored-By: Martin Weinelt <hexa@darmstadt.ccc.de>
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/openvino/default.nix20
1 files changed, 12 insertions, 8 deletions
diff --git a/pkgs/development/libraries/openvino/default.nix b/pkgs/development/libraries/openvino/default.nix
index 2e36cf208fb84..14ad6c166e551 100644
--- a/pkgs/development/libraries/openvino/default.nix
+++ b/pkgs/development/libraries/openvino/default.nix
@@ -5,6 +5,7 @@
 , cudaSupport ? opencv.cudaSupport or false
 
 # build
+, scons
 , addOpenGLRunpath
 , autoPatchelfHook
 , cmake
@@ -25,7 +26,7 @@
 , protobuf
 , pugixml
 , snappy
-, tbb
+, tbb_2021_5
 , cudaPackages
 }:
 
@@ -36,6 +37,9 @@ let
 
   stdenv = gcc12Stdenv;
 
+  # prevent scons from leaking in the default python version
+  scons' = scons.override { python3 = python3Packages.python; };
+
   tbbbind_version = "2_5";
   tbbbind = fetchurl {
     url = "https://storage.openvinotoolkit.org/dependencies/thirdparty/linux/tbbbind_${tbbbind_version}_static_lin_v4.tgz";
@@ -78,6 +82,7 @@ stdenv.mkDerivation rec {
     patchelf
     pkg-config
     python
+    scons'
     shellcheck
   ] ++ lib.optionals cudaSupport [
     cudaPackages.cuda_nvcc
@@ -91,7 +96,9 @@ stdenv.mkDerivation rec {
     popd
   '';
 
-  dontUseCmakeBuildDir = true;
+  dontUseSconsCheck = true;
+  dontUseSconsBuild = true;
+  dontUseSconsInstall = true;
 
   cmakeFlags = [
     "-Wno-dev"
@@ -109,7 +116,7 @@ stdenv.mkDerivation rec {
     (cmakeBool "ENABLE_SAMPLES" false)
 
     # features
-    (cmakeBool "ENABLE_INTEL_CPU" true)
+    (cmakeBool "ENABLE_INTEL_CPU" stdenv.isx86_64)
     (cmakeBool "ENABLE_JS" false)
     (cmakeBool "ENABLE_LTO" true)
     (cmakeBool "ENABLE_ONEDNN_FOR_GPU" false)
@@ -125,8 +132,6 @@ stdenv.mkDerivation rec {
     (cmakeBool "ENABLE_SYSTEM_TBB" true)
   ];
 
-  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isAarch64 "-Wno-narrowing";
-
   autoPatchelfIgnoreMissingDeps = [
     "libngraph_backend.so"
   ];
@@ -140,7 +145,7 @@ stdenv.mkDerivation rec {
     opencv.cxxdev
     pugixml
     snappy
-    tbb
+    tbb_2021_5
   ] ++ lib.optionals cudaSupport [
     cudaPackages.cuda_cudart
   ];
@@ -172,8 +177,7 @@ stdenv.mkDerivation rec {
     homepage = "https://docs.openvinotoolkit.org/";
     license = with licenses; [ asl20 ];
     platforms = platforms.all;
-    broken = (stdenv.isLinux && stdenv.isAarch64) # requires scons, then fails with *** Source directory cannot be under variant directory.
-      || stdenv.isDarwin; # Cannot find macos sdk
+    broken = stdenv.isDarwin; # Cannot find macos sdk
     maintainers = with maintainers; [ tfmoraes ];
   };
 }