Repository: opencv
Issue: macOS Intel 12.6.3: 4.6.0 and 4.7.0 linking failure when OpenCL SVN support is enabled.
Labels: wontfix,category: build/install,category: ocl

### System Information

Hi,

Compiling OpenCV in the CD workflow under macOS and when i enable the cmake WITH_OPENCL_SVM option :

https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/3rdparty/ext_opencv/CMakeLists.txt#L89

...I'm facing a linking error. Do i needs to enable another cmake options at configuration time ?

Notes:

- I tried with 4.6.0 and last 4.7.0, and problem still the same.
- Under Windows and Linux, enabling this option work as expected in the same context.

Thanks in advance

Gilles Caulier

### Detailed description

```
[ 26%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/utils/datafile.cpp.o
[ 26%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/utils/filesystem.cpp.o
[ 26%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/utils/logtagconfigparser.cpp.o
[ 27%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/utils/logtagmanager.cpp.o
[ 27%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/utils/samples.cpp.o
[ 27%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/va_intel.cpp.o
[ 27%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/opencl_kernels_core.cpp.o
[ 27%] Linking CXX shared library ../../lib/libopencv_core.dylib
Undefined symbols for architecture x86_64:
  "_clEnqueueSVMUnmap_pfn", referenced from:
      cv::ocl::Context::Impl::svmInit() in ocl.cpp.o
  "_clSetKernelArgSVMPointer_pfn", referenced from:
      cv::ocl::Context::Impl::svmInit() in ocl.cpp.o
  "_clEnqueueSVMMemcpy_pfn", referenced from:
      cv::ocl::Context::Impl::svmInit() in ocl.cpp.o
  "_clSVMAlloc_pfn", referenced from:
      cv::ocl::Context::Impl::svmInit() in ocl.cpp.o
  "_clEnqueueSVMMemFill_pfn", referenced from:
      cv::ocl::Context::Impl::svmInit() in ocl.cpp.o
  "_clEnqueueSVMMap_pfn", referenced from:
      cv::ocl::Context::Impl::svmInit() in ocl.cpp.o
  "_clSVMFree_pfn", referenced from:
      cv::ocl::Context::Impl::svmInit() in ocl.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[6]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:1549: lib/libopencv_core.4.7.0.dylib] Error 1
gmake[5]: *** [CMakeFiles/Makefile2:1141: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
gmake[4]: *** [Makefile:166: all] Error 2
gmake[3]: *** [ext_opencv/CMakeFiles/ext_opencv.dir/build.make:86: ext_opencv/ext_opencv-prefix/src/ext_opencv-stamp/ext_opencv-build] Error 2
gmake[2]: *** [CMakeFiles/Makefile2:1140: ext_opencv/CMakeFiles/ext_opencv.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:1147: ext_opencv/CMakeFiles/ext_opencv.dir/rule] Error 2
gmake: *** [Makefile:332: ext_opencv] Error 2
FAILED COMMAND: cmake --build . --config RelWithDebInfo --target ext_$1 -- -j$CPU_CORES
```

### Steps to reproduce

Compile OpenCV with WITH_OPENCL_SVM enabled (and other opencl options) as the digiKam opencv CD configuration available here:

https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/3rdparty/ext_opencv/CMakeLists.txt#L11

### Issue submission checklist

- [X] I report the issue, it's not a question
- [ ] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [X] I updated to the latest OpenCV version and the issue is still there
- [ ] There is reproducer code and related data files (videos, images, onnx, etc)