openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
7.17k stars 2.24k forks source link

[Bug]CMake Error at FindOpenCL.cmake:51 (if): #17706

Closed LaurentBerger closed 1 year ago

LaurentBerger commented 1 year ago

I tried to post on intel forum (https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/cannot-build-openvino/m-p/1489220) but it seems that i am a spammer... First

cd /c/lib
git clone -b 2022.3.0 https://github.com/openvinotoolkit/openvino.git
cd openvino
git submodule update --init --recursive
cd /c/lib/build
mkdir openvino
cd openvino
cmake -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENCV=ON -DOpenCV_DIR=/c/install/opencv /c/lib/openvino

cmakeoutput is

-- OpenVINO version is 2022.3.0 (Build 9052)
-- Trying to find apivalidator in: C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64
-- OpenVINO Runtime enabled features:
--
--     CI_BUILD_NUMBER: 2022.3.0-9052-9752fafe8eb-HEAD
--     ENABLE_LTO = OFF
--     OS_FOLDER = OFF
--     USE_BUILD_TYPE_SUBFOLDER = OFF
--     TREAT_WARNING_AS_ERROR = ON
--     ENABLE_INTEGRITYCHECK = OFF
--     ENABLE_SANITIZER = OFF
--     ENABLE_UB_SANITIZER = OFF
--     ENABLE_THREAD_SANITIZER = OFF
--     ENABLE_COVERAGE = OFF
--     ENABLE_SSE42 = ON
--     ENABLE_AVX2 = ON
--     ENABLE_AVX512F = ON
--     BUILD_SHARED_LIBS = ON
--     ENABLE_LIBRARY_VERSIONING = OFF
--     ENABLE_FASTER_BUILD = OFF
--     ENABLE_CPPLINT = OFF
--     ENABLE_CPPLINT_REPORT = OFF
--     ENABLE_CLANG_FORMAT = OFF
--     ENABLE_NCC_STYLE = OFF
--     VERBOSE_BUILD = OFF
--     ENABLE_UNSAFE_LOCATIONS = OFF
--     ENABLE_FUZZING = OFF
--     ENABLE_INTEL_CPU = ON
--     ENABLE_TESTS = OFF
--     ENABLE_COMPILE_TOOL = ON
--     ENABLE_STRICT_DEPENDENCIES = ON
--     ENABLE_CLDNN = ON
--     ENABLE_INTEL_GPU = ON
--     ENABLE_ONEDNN_FOR_GPU = ON
--     ENABLE_PROFILING_ITT = OFF
--     ENABLE_PROFILING_FILTER = ALL
--     ENABLE_PROFILING_FIRST_INFERENCE = ON
--     SELECTIVE_BUILD = OFF
--     ENABLE_ERROR_HIGHLIGHT = ON
--     ENABLE_DOCS = OFF
--     ENABLE_PKGCONFIG_GEN = OFF
--     THREADING = TBB
--     ENABLE_TBBBIND_2_5 = ON
--     ENABLE_INTEL_GNA = ON
--     ENABLE_IR_V7_READER = ON
--     ENABLE_GAPI_PREPROCESSING = ON
--     ENABLE_MULTI = ON
--     ENABLE_AUTO = ON
--     ENABLE_AUTO_BATCH = ON
--     ENABLE_HETERO = ON
--     ENABLE_TEMPLATE = ON
--     ENABLE_INTEL_MYRIAD_COMMON = ON
--     ENABLE_INTEL_MYRIAD = ON
--     ENABLE_MYRIAD_NO_BOOT = OFF
--     ENABLE_GAPI_TESTS = OFF
--     GAPI_TEST_PERF = OFF
--     ENABLE_MYRIAD_MVNC_TESTS = OFF
--     ENABLE_DATA = OFF
--     ENABLE_BEH_TESTS = OFF
--     ENABLE_FUNCTIONAL_TESTS = OFF
--     ENABLE_SAMPLES = ON
--     ENABLE_OPENCV = ON
--     ENABLE_V7_SERIALIZE = OFF
--     ENABLE_TBB_RELEASE_ONLY = OFF
--     ENABLE_SYSTEM_PUGIXML = OFF
--     ENABLE_SYSTEM_TBB = OFF
--     ENABLE_DEBUG_CAPS = OFF
--     ENABLE_GPU_DEBUG_CAPS = OFF
--     ENABLE_CPU_DEBUG_CAPS = OFF
--     ENABLE_OV_ONNX_FRONTEND = ON
--     ENABLE_OV_PADDLE_FRONTEND = ON
--     ENABLE_OV_IR_FRONTEND = ON
--     ENABLE_OV_TF_FRONTEND = ON
--     ENABLE_SYSTEM_PROTOBUF = OFF
--     ENABLE_OV_CORE_UNIT_TESTS = OFF
--     ENABLE_OPENVINO_DEBUG = OFF
--     ENABLE_REQUIREMENTS_INSTALL = OFF
--
-- MODELS_PATH=
-- PROJECT ............................... OpenVINO
-- CMAKE_VERSION ......................... 3.26.1
-- CMAKE_BINARY_DIR ...................... C:/lib/build/openvino
-- CMAKE_SOURCE_DIR ...................... C:/lib/openvino
-- OpenVINO_SOURCE_DIR ................... C:/lib/openvino
-- OpenVINO_BINARY_DIR ................... C:/lib/build/openvino
-- CMAKE_GENERATOR ....................... Visual Studio 17 2022
-- CMAKE_C_COMPILER_ID ................... MSVC
-- CMAKE_CXX_COMPILER_ID ................. MSVC
-- CMAKE_BUILD_TYPE ...................... Release
-- CMAKE_TOOLCHAIN_FILE ..................
-- GLIBC_VERSION....... .................. 0.0
-- The name openvino::pugixml is an ALIAS for pugixml-static. It will be exported to the OpenVINODeveloperPackage with the original name.
-- The name gflags is an ALIAS for gflags_nothreads_static. It will be exported to the OpenVINODeveloperPackage with the original name.
-- Protocol Buffers Configuring...
--
-- 3.18.2.0
-- Configuration script parsing status [
--   Description : Protocol Buffers
--   Version     : 3.18.2.0 (3.18.2)
--   Contact     : protobuf@googlegroups.com
-- ]
-- Protocol Buffers Configuring done
-- Found PythonInterp: C:/Program Files/Python310/python.exe (found version "3.10.10")
Generated: C:/lib/build/openvino/thirdparty/onnx/onnx/onnx/onnx_openvino_onnx-ml.proto
Generated: C:/lib/build/openvino/thirdparty/onnx/onnx/onnx/onnx-operators_openvino_onnx-ml.proto
Generated: C:/lib/build/openvino/thirdparty/onnx/onnx/onnx/onnx-data_openvino_onnx.proto
--
-- ******** Summary ********
--   CMake version             : 3.26.1
--   CMake command             : C:/Program Files/CMake/bin/cmake.exe
--   System                    : Windows
--   C++ compiler              : C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe
--   C++ compiler version      : 19.35.32215.0
--   CXX flags                 : /DWIN32 /D_WINDOWS /W3 /GR /EHsc -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /EHsc /Gy /bigobj /MP /wd4251 /wd4275 /wd4244 /EHsc /wd26812
--   Build type                : Release
--   Compile definitions       : IE_BUILD_POSTFIX="$<$<CONFIG:Debug>:d>$<$<CONFIG:Release>:>";ENABLE_INTEL_CPU=1;__STDC_FORMAT_MACROS
--   CMAKE_PREFIX_PATH         :
--   CMAKE_INSTALL_PREFIX      : C:/Program Files (x86)/OpenVINO
--   CMAKE_MODULE_PATH         :
--
--   ONNX version              : 1.12.0
--   ONNX NAMESPACE            : openvino_onnx
--   ONNX_USE_LITE_PROTO       : ON
--   USE_PROTOBUF_SHARED_LIBS  : OFF
--   Protobuf_USE_STATIC_LIBS  : ON
--   ONNX_DISABLE_EXCEPTIONS   : OFF
--   ONNX_WERROR               : OFF
--   ONNX_BUILD_TESTS          : OFF
--   ONNX_BUILD_BENCHMARKS     : OFF
--   ONNXIFI_DUMMY_BACKEND     : OFF
--   ONNXIFI_ENABLE_EXT        : OFF
--
--   Protobuf compiler         :
--   Protobuf includes         :
--   Protobuf libraries        :
--   BUILD_ONNX_PYTHON         : OFF
-- Using the multi-header code from C:/lib/openvino/thirdparty/json/nlohmann_json/include/
-- TBB (2020.2) is found at C:/lib/openvino/temp/tbb/cmake
-- Static tbbbind_2_5 package is found
-- The name openvino::itt is an ALIAS for itt. It will be exported to the OpenVINODeveloperPackage with the original name.
-- The name openvino::conditional_compilation is an ALIAS for conditional_compilation. It will be exported to the OpenVINODeveloperPackage with the original name.
-- The name ngraph::builder is an ALIAS for ngraph_builders. It will be exported to the OpenVINODeveloperPackage with the original name.
-- The name ngraph::reference is an ALIAS for ngraph_reference. It will be exported to the OpenVINODeveloperPackage with the original name.
-- The name openvino::core::dev is an ALIAS for ov_core_dev. It will be exported to the OpenVINODeveloperPackage with the original name.
-- DNNL_TARGET_ARCH: X64
-- DNNL_LIBRARY_NAME: dnnl
-- Could NOT find Doxyrest (missing: DOXYREST_EXECUTABLE)
-- Found PythonInterp: C:/Program Files/Python310/python.exe (found suitable version "3.10.10", minimum required is "2.7")
-- Could NOT find Sphinx (missing: SPHINX_EXECUTABLE)
-- Enabled workload: INFERENCE
-- Enabled primitives: CONVOLUTION;DECONVOLUTION;CONCAT;LRN;INNER_PRODUCT;MATMUL;POOLING;REDUCTION;REORDER;RNN;SOFTMAX
-- Enabled primitive CPU ISA: ALL
-- Enabled primitive GPU ISA: ALL
-- Primitive cache is disabled
-- Found PythonInterp: C:/Program Files/Python310/python.exe (found suitable version "3.10.10", minimum required is "3")
-- The name openvino::runtime::dev is an ALIAS for openvino_dev. It will be exported to the OpenVINODeveloperPackage with the original name.
CMake Warning at src/bindings/python/CMakeLists.txt:90 (message):
  Python module 'cython>=0.29.22' is missed, IE Python API 1.0 will not be
  built (ENABLE_PYTHON is OFF)
Call Stack (most recent call first):
  src/bindings/python/CMakeLists.txt:111 (ov_check_python_build_conditions)

CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/FindOpenCL.cmake:51 (if):
  if given arguments:

    "EXISTS" "C:/lib/openvino/thirdparty/ocl/cl_headers" "C:/lib/openvino/thirdparty/ocl/clhpp_headers/include/Headers/cl.h"

  Unknown arguments specified
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.26/Modules/FindOpenCL.cmake:95 (_FIND_OPENCL_VERSION)
  samples/cpp/benchmark_app/CMakeLists.txt:84 (find_package)

-- Configuring incomplete, errors occurred!

What's wrong

ilya-lavrenov commented 1 year ago

Have you performed

git submodule update --init

?

LaurentBerger commented 1 year ago

yes exactly i have done

cd /c/lib git clone -b 2022.3.0 https://github.com/openvinotoolkit/openvino.git cd openvino git submodule update --init --recursive cd /c/lib/build mkdir openvino cd openvino cmake -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENCV=ON -DOpenCV_DIR=/c/install/opencv /c/lib/openvino

ilya-lavrenov commented 1 year ago

For some reason OpenCL_INCLUDE_DIR is defined to both cl_headers and clhpp_headers, while our cmake script sets to cl_headers only. Could you please check what is the value of OpenCL_INCLUDE_DIR in CMakeCache.txt?

LaurentBerger commented 1 year ago

I found

//Build with Werror
ONNX_WERROR:BOOL=OFF

OPENCLROOT:PATH=C:/lib/openvino/bin/intel64

//Path to OCL (CL and CLHPP) includes
OPENCL_HEADERS_DIR:PATH=C:/lib/openvino/thirdparty/ocl/cl_headers;C:/lib/openvino/thirdparty/ocl/clhpp_headers/include

//Enable support for OpenCL ICD Loader testing.
OPENCL_ICD_LOADER_BUILD_TESTING:BOOL=OFF

//Disable support for OpenCLOn12. Support for OpenCLOn12 should
// only be disabled when building an import lib to link with, and
// must be enabled when building an ICD loader for distribution!
OPENCL_ICD_LOADER_DISABLE_OPENCLON12:BOOL=OFF

//Path to OCL includes
OPENCL_ICD_LOADER_HEADERS_DIR:PATH=C:/lib/openvino/thirdparty/ocl/cl_headers

OPENCL_VERSION_2_2:BOOL=ON

//Extra paths for extra modules to include into OpenVINO build
OPENVINO_EXTRA_MODULES:STRING=

//create OS dedicated folder in output
OS_FOLDER:BOOL=OFF

//Value Computed by CMake
OpenCL-ICD-Loader_BINARY_DIR:STATIC=C:/lib/build/openvino/thirdparty/ocl/icd_loader

//Value Computed by CMake
OpenCL-ICD-Loader_IS_TOP_LEVEL:STATIC=OFF

//Value Computed by CMake
OpenCL-ICD-Loader_SOURCE_DIR:STATIC=C:/lib/openvino/thirdparty/ocl/icd_loader

OpenCL_INCLUDE_DIR:PATH=C:/lib/openvino/thirdparty/ocl/cl_headers;C:/lib/openvino/thirdparty/ocl/clhpp_headers/include

OpenCL_LIBRARY:PATH=C:/lib/openvino/bin/intel64/Release/OpenCL.lib

//Dependencies for the target
OpenCL_LIB_DEPENDS:STATIC=general;cfgmgr32.lib;general;runtimeobject.lib;

OpenCL_VERSION_STRING:STRING=2.2

//No help, variable specified on the command line.
OpenCV_DIR:UNINITIALIZED=C:/install/opencv

//Value Computed by CMake
OpenVINOPython_BINARY_DIR:STATIC=C:/lib/build/openvino/src/bindings/python
LaurentBerger commented 1 year ago

On intel forum somebody gives me an answer https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/cannot-build-openvino/m-p/1489912/highlight/true#M29489