-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
OpenVINO Version
2025.2.1
Operating System
Other (Please specify in description)
Hardware Architecture
x86 (64 bits)
Target Platform
NixOS and all platforms that can run nix
like darwin.
I have Lunar Lake CPU
Build issue description
Hi there, I'm trying to improve the NixOS packaging for openvino
. One thing we can do is to build the test binaries so we can see them all passing for the target architectures. However today this is not possible.
When I enable the testing cmake flags:
(cmakeBool "ENABLE_TESTS" true)
(cmakeBool "ENABLE_FUNCTIONAL_TESTS" true)
nix build
breaks at the point below, even if I include (cmakeBool "BUILD_TESTING" false)
. I get this random error after about an hour of compilation:
[ 82%] Building CXX object build-modules/template/tests/functional/CMakeFiles/ov_template_func_tests.dir/shared_tests_instances/single_layer_tests/softmax.cpp.o
cd /build/source/build/build-modules/template/tests/functional && /nix/store/67x7pknz0qa2j16x02idf0x98lpcspah-gcc-wrapper-14.3.0/bin/g++ -DIN_OV_COMPONENT -DOPENCV_TEMPLATE_TESTS >
[ 82%] Building CXX object build-modules/template/tests/functional/CMakeFiles/ov_template_func_tests.dir/shared_tests_instances/single_layer_tests/split.cpp.o
cd /build/source/build/build-modules/template/tests/functional && /nix/store/67x7pknz0qa2j16x02idf0x98lpcspah-gcc-wrapper-14.3.0/bin/g++ -DIN_OV_COMPONENT -DOPENCV_TEMPLATE_TESTS >
[ 82%] Building CXX object build-modules/template/tests/functional/CMakeFiles/ov_template_func_tests.dir/skip_tests_config.cpp.o
cd /build/source/build/build-modules/template/tests/functional && /nix/store/67x7pknz0qa2j16x02idf0x98lpcspah-gcc-wrapper-14.3.0/bin/g++ -DIN_OV_COMPONENT -DOPENCV_TEMPLATE_TESTS >
[ 82%] Building CXX object build-modules/template/tests/functional/CMakeFiles/ov_template_func_tests.dir/subgraph_reference/preprocess.cpp.o
cd /build/source/build/build-modules/template/tests/functional && /nix/store/67x7pknz0qa2j16x02idf0x98lpcspah-gcc-wrapper-14.3.0/bin/g++ -DIN_OV_COMPONENT -DOPENCV_TEMPLATE_TESTS >
[ 82%] Building CXX object build-modules/template/tests/functional/CMakeFiles/ov_template_func_tests.dir/subgraph_reference/preprocess_opencv.cpp.o
cd /build/source/build/build-modules/template/tests/functional && /nix/store/67x7pknz0qa2j16x02idf0x98lpcspah-gcc-wrapper-14.3.0/bin/g++ -DIN_OV_COMPONENT -DOPENCV_TEMPLATE_TESTS >
[ 82%] Building CXX object build-modules/template/tests/functional/CMakeFiles/ov_template_func_tests.dir/subgraph_reference/stateful_model.cpp.o
cd /build/source/build/build-modules/template/tests/functional && /nix/store/67x7pknz0qa2j16x02idf0x98lpcspah-gcc-wrapper-14.3.0/bin/g++ -DIN_OV_COMPONENT -DOPENCV_TEMPLATE_TESTS >
[ 82%] Building CXX object build-modules/template/tests/functional/CMakeFiles/ov_template_func_tests.dir/transformations/disable_transformations_test.cpp.o
cd /build/source/build/build-modules/template/tests/functional && /nix/store/67x7pknz0qa2j16x02idf0x98lpcspah-gcc-wrapper-14.3.0/bin/g++ -DIN_OV_COMPONENT -DOPENCV_TEMPLATE_TESTS >
[ 82%] Linking CXX executable /build/source/bin/intel64/Release/ov_template_func_tests
cd /build/source/build/build-modules/template/tests/functional && /nix/store/a3w3ka2d796ghlhf31il839c0658m5ih-cmake-3.31.7/bin/cmake -E cmake_link_script CMakeFiles/ov_template_fu>
/nix/store/67x7pknz0qa2j16x02idf0x98lpcspah-gcc-wrapper-14.3.0/bin/g++ -Wsuggest-override -Wno-odr -fsigned-char -ffunction-sections -fdata-sections -fdiagnostics-show-option -Wal>
make[2]: Leaving directory '/build/source/build'
[ 82%] Built target ov_template_func_tests
make[1]: Leaving directory '/build/source/build'
make: *** [Makefile:169: all] Error 2
I suspect the default cmake
command tries to execute tests automatically and nix build
doesnt like that(it is reserved for another phase of the build`. How can I disable the test runners in this case?
Here is my openvino-package.nix
for reproduction:
{
lib,
stdenv,
fetchFromGitHub,
fetchurl,
cudaSupport ? opencv.cudaSupport or false,
# build
scons,
addDriverRunpath,
autoPatchelfHook,
cmake,
git,
libarchive,
patchelf,
pkg-config,
python3Packages,
shellcheck,
# runtime
flatbuffers,
gflags,
level-zero,
libusb1,
libxml2,
ocl-icd,
opencv,
protobuf,
pugixml,
snappy,
tbb_2022,
cudaPackages,
tree
}:
let
inherit (lib)
cmakeBool
;
# prevent scons from leaking in the default python version
scons' = scons.override { inherit python3Packages; };
tbbbind_version = "2_5";
tbbbind = fetchurl {
url = "https://storage.openvinotoolkit.org/dependencies/thirdparty/linux/tbbbind_${tbbbind_version}_static_lin_v4.tgz";
hash = "sha256-Tr8wJGUweV8Gb7lhbmcHxrF756ZdKdNRi1eKdp3VTuo=";
};
python = python3Packages.python.withPackages (
ps: with ps; [
cython
distutils
pybind11
setuptools
sphinx
wheel
]
);
in
stdenv.mkDerivation rec {
pname = "openvino";
version = "2025.2.1";
src = fetchFromGitHub {
owner = "openvinotoolkit";
repo = "openvino";
tag = version;
fetchSubmodules = true;
hash = "sha256-Bu0m7nGqyHwHsa7FKr4nvUh/poJxMTgwuAU81QBmI4g=";
};
outputs = [
"out"
"python"
];
nativeBuildInputs = [
addDriverRunpath
autoPatchelfHook
cmake
git
libarchive
patchelf
pkg-config
python
scons'
shellcheck
]
++ lib.optionals cudaSupport [
cudaPackages.cuda_nvcc
];
postPatch = ''
mkdir -p temp/tbbbind_${tbbbind_version}
pushd temp/tbbbind_${tbbbind_version}
bsdtar -xf ${tbbbind}
echo "${tbbbind.url}" > ie_dependency.info
popd
'';
dontUseSconsCheck = true;
dontUseSconsBuild = true;
dontUseSconsInstall = true;
cmakeFlags = [
"-Wno-dev"
"-DCMAKE_MODULE_PATH:PATH=${placeholder "out"}/lib/cmake"
"-DCMAKE_PREFIX_PATH:PATH=${placeholder "out"}"
"-DCMAKE_CXX_FLAGS=-Wno-odr"
"-DCMAKE_C_FLAGS=-Wno-odr"
"-DOpenCV_DIR=${lib.getLib opencv}/lib/cmake/opencv4/"
"-DProtobuf_LIBRARIES=${protobuf}/lib/libprotobuf${stdenv.hostPlatform.extensions.sharedLibrary}"
"-DPython_EXECUTABLE=${python.interpreter}"
(cmakeBool "CMAKE_VERBOSE_MAKEFILE" true)
(cmakeBool "NCC_STYLE" false)
(cmakeBool "ENABLE_CPPLINT" false)
(cmakeBool "ENABLE_TESTS" true)
(cmakeBool "ENABLE_FUNCTIONAL_TESTS" true)
(cmakeBool "BUILD_TESTING" false) # NOTE: Essential to not run the tests, added now
(cmakeBool "ENABLE_SAMPLES" false)
# features
(cmakeBool "ENABLE_INTEL_CPU" stdenv.hostPlatform.isx86_64)
(cmakeBool "ENABLE_INTEL_GPU" true)
(cmakeBool "ENABLE_INTEL_NPU" stdenv.hostPlatform.isx86_64)
(cmakeBool "ENABLE_JS" false) # NOTE: What is this?!
(cmakeBool "ENABLE_LTO" true)
(cmakeBool "ENABLE_ONEDNN_FOR_GPU" false) # TODO: Should be true?
(cmakeBool "ENABLE_OPENCV" true)
(cmakeBool "ENABLE_OV_JAX_FRONTEND" false) # auto-patchelf could not satisfy dependency libopenvino_jax_frontend.so.2450
(cmakeBool "ENABLE_PYTHON" true)
# system libs
(cmakeBool "ENABLE_SYSTEM_FLATBUFFERS" true)
(cmakeBool "ENABLE_SYSTEM_OPENCL" true)
(cmakeBool "ENABLE_SYSTEM_PROTOBUF" false) # NOTE: Change this?
(cmakeBool "ENABLE_SYSTEM_PUGIXML" true)
(cmakeBool "ENABLE_SYSTEM_SNAPPY" true)
(cmakeBool "ENABLE_SYSTEM_TBB" true)
];
autoPatchelfIgnoreMissingDeps = [
"libngraph_backend.so"
];
# src/graph/src/plugins/intel_gpu/src/graph/include/reorder_inst.h:24:8: error: type 'struct typed_program_node' violates the C++ One Definition Rule [-Werror=odr]
# env.NIX_CFLAGS_COMPILE = "-Wno-odr";
buildInputs = [
flatbuffers
gflags
level-zero
libusb1
libxml2
ocl-icd
opencv
pugixml
snappy
tbb_2022
tree
]
++ lib.optionals cudaSupport [
cudaPackages.cuda_cudart
];
enableParallelBuilding = true;
preInstallPhase = ''
echo "preInstallll"
tree .
'';
postInstall = ''
mkdir -p $python
mv $out/python/* $python/
rmdir $out/python
'';
postFixup = ''
# Link to OpenCL
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
addDriverRunpath "$lib"
done
'';
meta = with lib; {
changelog = "https://github.com/openvinotoolkit/openvino/releases/tag/${src.tag}";
description = "OpenVINO™ Toolkit repository";
longDescription = ''
This toolkit allows developers to deploy pre-trained deep learning models through a high-level C++ Inference Engine API integrated with application logic.
This open source version includes several components: namely Model Optimizer, nGraph and Inference Engine, as well as CPU, GPU, MYRIAD,
multi device and heterogeneous plugins to accelerate deep learning inferencing on Intel® CPUs and Intel® Processor Graphics.
It supports pre-trained models from the Open Model Zoo, along with 100+ open source and public models in popular formats such as Caffe*, TensorFlow*, MXNet* and ONNX*.
'';
homepage = "https://docs.openvinotoolkit.org/";
license = with licenses; [ asl20 ];
platforms = platforms.all;
broken = stdenv.hostPlatform.isDarwin; # Cannot find macos sdk
maintainers = with maintainers; [ tfmoraes ];
};
}
and this flake.nix
make it able to be nix build .#openvino
:
{
description = "WIP Development and Packaging of openvino for nix";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system};
runtimePackages = [ pkgs.pkg-config pkgs.level-zero ];
in {
devShells.default = pkgs.mkShell rec {
name = "openvino-dev";
buildInputs = runtimePackages;
hardeningDisable = [ "zerocallusedregs" ];
shellHook = ''
export ZDOTDIR="$(mktemp -d)" # NOTE: Only needed to load our .zshrc *along* with ~/.zshrc
cat > "$ZDOTDIR/.zshrc" << 'EOF'
source ~/.zshrc # Source the original .zshrc, required.
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ ->\ \1/'
}
function display_jobs_count_if_needed {
local job_count=$(jobs -s | wc -l | tr -d " ")
if [ $job_count -gt 0 ]; then
echo "%B%F{yellow}%j| ";
fi
}
PROMPT="%F{blue}$(date +%H:%M:%S) $(display_jobs_count_if_needed)%B%F{green}%n %F{blue}%~%F{cyan} ❄%F{yellow}$(parse_git_branch) %f%{$reset_color%}"
EOF
if [ -z "$DIRENV_IN_ENVRC" ]; then
exec zsh -i
fi
'';
};
packages = {
openvino = pkgs.callPackage ./openvino-package.nix {};
};
}
);
}
Issue submission checklist
- I'm reporting an issue. It's not a question.
- I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.