How to Build openCV with Intel® oneAPI DPC++/C++ Compiler

ID 788773
Updated 9/18/2023
Version 2023.2



Intel® oneAPI DPC++/C++ Compiler is a latest and greatest SYCL/C++ compiler from Intel. Intel C/C++ Classic compiler will be deprecated in 2024 release.

The description on upgrade process and instructions for OpenCV with latest compiler can be found in this article.

Content expert:

Alina Shadrina


  1. Install  Intel® oneAPI Base Toolkit which contains Intel® oneAPI DPC++/C++ Compiler. Please, refer to Install Intel® oneAPI Toolkits and Components the Get Started Guide in case of any questions. To check for supported Linux distributions and hardware requirements, please refer Intel® oneAPI DPC++/C++ Compiler System Requirements. 
  2. Please, refer to OpenCV* tutorials Installation in Linux  to check the prerequisites and find detailed build commands for the corresponding operating system.
  3. CMake 3.20.5 and later

Building OpenCV with Intel® oneAPI DPC++/C++ Compiler on Linux

  1. Get the latest version of openCV:
$ git clone

and make sure you are using branch 4.*:

$ git status
On branch 4.x   
  1. Navigate to OpenCV repository and prepare the build folder:
$ cd opencv
$ mkdir build && cd build
  1. Set up Intel oneAPI environment variables
    • For default installation:
$ ​​​​​​source /opt/intel/oneapi/
    • For non-default installation:
$ source $<PATH_TO_ONEAPI>/
  1. Run CMake * with Intel® oneAPI DPC++/C++ Compiler  to configure the project:

As a result, the build log looks as follows:

-- 'Release' build type is used by default. Use CMAKE_BUILD_TYPE to specify build type (Release or Debug)
-- The CXX compiler identification is IntelLLVM 2023.2.0
-- The C compiler identification is IntelLLVM 2023.2.0

--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ standard:                11
--     C++ Compiler:                /opt/intel/oneapi/compiler/latest/linux/bin/icpx  (ver 2023.2.0)
--     C++ flags (Release):         -fsigned-char  -msse3 -O3 -DNDEBUG
--     C++ flags (Debug):           -fsigned-char  -msse3 -g
--     C Compiler:                  /opt/intel/oneapi/compiler/latest/linux/bin/icx
--     C flags (Release):           -fsigned-char  -msse3 -O3 -DNDEBUG
--     C flags (Debug):             -fsigned-char  -msse3 -g

  1. After that, run CMake * to build executables:
$  cmake --build .
[  0%] Built target opencv_dnn_plugins
[  0%] Built target opencv_highgui_plugins
  1. Make sure openCV* is compiled with Intel® oneAPI DPC++/C++ Compiler:
$ readelf -p .comment bin/opencv_annotation

String dump of section '.comment':
  [     0]  GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  [    2b]  Intel(R) oneAPI DPC++/C++ Compiler 2023.2.0 (2023.2.0.20230721)
  [    6b]  Intel(R) oneAPI DPC++/C++ Compiler 2023.2.0 (2023.x.0.20230407)