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>
(cherry picked from commit e91df80298)
This commit is contained in:
Matt Leon 2024-02-11 16:02:10 -05:00 committed by github-actions[bot]
parent 1305fd153d
commit c593d93b47

View File

@ -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 ];
};
}