./configure won't detect presence of OpenCL on macOS
./configure
The output log has the following related part:
configure:11271: checking for OpenCL library
configure:11314: gcc -o conftest -g -O2 -Wall -mtune=core2 -fexceptions -D_FORTIFY_SOURCE=0 -pthread -pthread conftest.c -lOpenCL -lm >&5
conftest.c:50:1: warning: 'clCreateContextFromType' is deprecated: first deprecated in macOS 10.14 - (Define CL_SILENCE_DEPRECATION to hide this warning) [-Wdeprecated-declarations]
clCreateContextFromType(0,0,0,0,0)
^
/System/Library/Frameworks/OpenCL.framework/Headers/cl.h:620:1: note: 'clCreateContextFromType' has been explicitly marked deprecated here
clCreateContextFromType(const cl_context_properties * /* properties */,
^
1 warning generated.
ld: library not found for -lOpenCL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
OpenCL headers are properly detected though
206bac54bac9e106b281ba3f28355d0e8d5c376b@dlemstra Since you edited this issue I assume I should probably ping you on this one. The current bypass used by ImageMagick works perfectly fine on the -framework OpenCL part, however seems like the full command still contains elements from other configurations like -lOpenCL and -lCL which were the actual reason of the failure. It seems if we modify the m4 to only uses -framework OpenCL without other CL linker flags would solve this issue. However autoconf grammar is just too much for me
configure:11364: gcc -o conftest -g -O2 -Wall -mtune=core2 -fexceptions -D_FORTIFY_SOURCE=0 -pthread -pthread conftest.c -lOpenCL -framework OpenCL -L/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries -lm >&5
conftest.c:50:1: warning: 'clCreateContextFromType' is deprecated: first deprecated in macOS 10.14 - (Define CL_SILENCE_DEPRECATION to hide this warning) [-Wdeprecated-declarations]
clCreateContextFromType(0,0,0,0,0)
^
/System/Library/Frameworks/OpenCL.framework/Headers/cl.h:620:1: note: 'clCreateContextFromType' has been explicitly marked deprecated here
clCreateContextFromType(const cl_context_properties * /* properties */,
^
1 warning generated.
ld: library not found for -lOpenCL
clang: error: linker command failed with exit code 1 (use -v to see invocation)**
Yeah it shouldn't have -lOpenCL or -L/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries. -framework OpenCL should be all we need
These settings are defined in the m4/ax_opencl.m4 file. Can you tell us how we should patch this file to make it work on macOS @Naville?
I dunno sh1t aboutM4 Grammar. But as mentioned in the original issue, resulting linker command should only have -framework OpenCL present
Thanks for the problem report. We can reproduce it and will have a patch to fix it in the GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.
Most helpful comment
Thanks for the problem report. We can reproduce it and will have a patch to fix it in the GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.