When building the Driver Compiler for Linux, ensure you use a supported OpenVINO version.
You can find the required OpenVINO version in the release notes under "OpenVINO built from source" or in the Linux NPU driver source.
If you encounter errors like the following when cloning repositories, you may need to configure your proxy:
fatal: unable to access 'https://github.com/your-repo.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/your-repo.git/': Failed to connect to github.com port 443: Connection timed out
fatal: unable to access 'https://github.com/your-repo.git/': Received HTTP code 407 from proxy after CONNECTSet up proxy
# Linux
export http_proxy=<http://proxy_link:port>
export https_proxy=<http://proxy_link:port>
export no_proxy=<no_proxy>
# Windows
set http_proxy=<http://proxy_link:port>
set https_proxy=<http://proxy_link:port>
set no_proxy=<no_proxy>For installation, it is not recommended to use cmake --install . --prefix /usr --component CiD as this will also install elf, compilerTest, and other CiD targets which are unnecessary.
- Error:
c++: internal compiler error: Killed (program cc1plus)
Cause: Usually due to insufficient memory.
Solution: Reduce the number of parallel build jobs (e.g., use-j4instead of-j8), or increase swap space.
- Clone error:
filename too long
Run:git config --global core.longpaths trueand enable the long path feature on Windows as follows or this image: Open the Registry Editor, go toHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem, and set the DWORD valueLongPathsEnabledto1. - MT/MD mismatch error:
If your commit is earlier thand0719b79c5847(2024-08-28), do not add-D CMAKE_TOOLCHAIN_FILE=%OPENVINO_HOME%\cmake\toolchains\onecoreuap.toolchain.cmake. - Ccache is required for Windows build preset:
If ccache is not installed, you may seeCreateProcess failed: The system cannot find the file specified during the cmake --build ... step.
- OpenVINO auto-download: OpenVINO will automatically download a prebuilt oneTBB (see
${OPENVINO_HOME}/temp/tbb), ifENABLE_SYSTEM_TBBis set toOFF, and- CMake option
-D TBBROOT=/path/to/alternative/oneTBBis not passed, and - Environment variable
TBBROOTis not set.
- System oneTBB: To use the system TBB, set
-D ENABLE_SYSTEM_TBB=ONfor CMake. - Custom oneTBB: Download or build your own oneTBB from the oneTBB Project and set
TBBROOTenvironment variable.
Note: If you plan to use the sideloading feature on Windows, we recommend using the OneCore version of TBB. The official release version of TBB does not support OneCore, so please manually compile it according to the documentation. For instructions on how to build OneCore TBB, please see how to build OneCore TBB.
- No TBB: Not recommended, as build speed will decrease. You can set
-D THREADING=SEQfor CMake to disable TBB.
-
Build OneCore oneTBB by yourself. You must build hwloc first, then build oneTBB. See the detailed steps below.
1. Clone repository and build hwloc
The
hwloclibrary is a dependency of thetbbbind_2_5binary, so its version must be determined before proceeding with the build. The correct version can be confirmed by dumping thetbbbind_2_5_debug.libbinary. The correspondinghwlocversion is2.8.0for oneTBB libraryv2021.2.5.Download the ZIP folder from here, unzip, build the library or follow the commands below. Next, clone oneTBB and build oneTBB with MultiThreaded,
set WORKDIR=%cd% curl -L -o hwloc-2.8.0.zip https://github.com/open-mpi/hwloc/archive/refs/tags/hwloc-2.8.0.zip tar -xf hwloc-2.8.0.zip cd hwloc-hwloc-2.8.0\contrib\windows-cmake cmake -A X64 --install-prefix=%cd%\install -DHWLOC_SKIP_TOOLS=ON -DHWLOC_WITH_LIBXML2=OFF -DBUILD_SHARED_LIBS=ON -D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -B build cmake --build build --parallel --config Release cmake --install build --config Release set HWLOC_INSTALL_DIR=%WORKDIR%\hwloc-hwloc-2.8.0\contrib\windows-cmake\install cd %WORKDIR% git clone https://github.com/uxlfoundation/oneTBB.git oneTBB-2021.2.5-static cd oneTBB-2021.2.5-static git checkout v2021.2.5 @REM Use another directory for dynamic build cd .. xcopy oneTBB-2021.2.5-static oneTBB-2021.2.5-dynamic /E /H /I /Q @REM set command build option environment variable. @REM CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" build with MT set buildOption=-D CMAKE_INSTALL_PREFIX=%cd%\install ^ -D CMAKE_HWLOC_2_5_LIBRARY_PATH=%HWLOC_INSTALL_DIR%\lib\hwloc.lib ^ -D CMAKE_HWLOC_2_5_INCLUDE_PATH=%HWLOC_INSTALL_DIR%\include ^ -D CMAKE_HWLOC_2_5_DLL_PATH=%HWLOC_INSTALL_DIR%\bin\hwloc.dll ^ -D TBB_TEST=OFF ^ -D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded"
2. Static oneTBB build
set TBB_HOME=%WORKDIR%\oneTBB-2021.2.5-static cd %TBB_HOME% mkdir build_static cd build_static cmake ^ -G "Visual Studio 16 2019" -A X64 ^ -D BUILD_SHARED_LIBS=OFF ^ %buildOption% ^ .. cmake --build . --config Release cmake --install . --config Release cmake --build . --config Debug cmake --install . --config Debug copy ..\LICENSE.txt install\LICENSE copy %HWLOC_INSTALL_DIR%\bin\hwloc.dll install\lib
All static oneTBB
.liblibraries will be found in thebuild_static\installfolder.3. Dynamic oneTBB build
set TBB_HOME=%WORKDIR%\oneTBB-2021.2.5-dynamic cd %TBB_HOME% mkdir build_dynamic cd build_dynamic cmake ^ -G "Visual Studio 16 2019" -A X64 ^ -D BUILD_SHARED_LIBS=ON ^ %buildOption% ^ .. cmake --build . --config Release cmake --install . --config Release cmake --build . --config Debug cmake --install . --config Debug copy ..\LICENSE.txt install\LICENSE copy %HWLOC_INSTALL_DIR%\bin\hwloc.dll install\bin
All dynamic oneTBB
.liband.dlllibraries will be found in thebuild_dynamic\installfolder.
-
You can set
TBBROOTvia environment variable or in the preset'scacheVariables.Add TBBROOT option to Cmake Preset
Adding the path to
TBBROOTincacheVariables, undercidpreset, as shown below:"name": "cid", "cacheVariables": { "TBBROOT": { "type": "FILEPATH", "value": "/path/to/alternative/oneTBB" } }
Linux Cmake Preset usage is listed here. Windows Cmake Preset usage is listed here.
-
To disable TBB, set
THREADING=SEQ.Disable oneTBB commands
To build Driver Compiler without using oneTBB library (longer model compile time), replace
"value": "TBB"with"value": "SEQ"forTHREADINGincacheVariablesundercid(see here)."name": "cid", "cacheVariables": { "THREADING": { "type": "STRING", "value": "SEQ" }, },
Refer to this document for information related to SEQ threading.
- Any TBB version can be used when generating the LLVM cache, but when building with the cache, the parameters must match those in
build_manifest.txt. - Please note that when using sideloading on Windows, you must use the OneCore version of oneTBB.
- For detailed CMake options, refer to the CMake documentation and the respective
features.cmakefiles in OpenVINO and NPU-Plugin repositories.
If you need further clarification or have additional questions, please refer to the main documentation in this repo or contact the development team.