I'm trying to build this small OpenCL project:
https://bitbucket.org/Anteru/opencltutorial/src
on Windows, within Cygwin. It is a toy project with one .cpp file and one kernel to demonstrate the use of OpenCL. So, I download the package and cmake
it. I get the error message:
CMake Error at /usr/share/cmake-3.14.5/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenCL (missing: OPENCL_LIBRARY)
Call Stack (most recent call first):
/usr/share/cmake-3.14.5/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/FindOpenCL.cmake:35 (find_package_handle_standard_args)
CMakeLists.txt:6 (FIND_PACKAGE)
I do not balk at this, and proceed to change my CMakeCache.txt
so that instead of:
OPENCL_LIBRARY:FILEPATH=OPENCL_LIBRARY-NOTFOUND
I make it:
OPENCL_LIBRARY:FILEPATH=/cygdrive/c/Program Files/NVIDIA Corporation/OpenCL/OpenCL.dll
(this is the legit path of NVIDIA's OpenCL DLL) Ok, so now CMake configuration concludes successfully. The main.cpp
file compiles, but linking fails!:
/usr/bin/c++.exe -Wl,--enable-auto-import CMakeFiles/clTut.dir/main.cpp.o -o clTut.exe -Wl,--out-implib,libclTut.dll.a -Wl,--major-image-version,0,--minor-image-version,0 "/cygdrive/c/Program Files/NVIDIA Corporation/OpenCL/OpenCL.dll"
CMakeFiles/clTut.dir/main.cpp.o:main.cpp:(.text+0x610): undefined reference to `clGetPlatformInfo'
CMakeFiles/clTut.dir/main.cpp.o:main.cpp:(.text+0x610): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `clGetPlatformInfo'
CMakeFiles/clTut.dir/main.cpp.o:main.cpp:(.text+0x659): undefined reference to `clGetPlatformInfo'
CMakeFiles/clTut.dir/main.cpp.o:main.cpp:(.text+0x659): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `clGetPlatformInfo'
and so on, dozens of such errors.
Why am I getting these errors and how can I fix them? Is it a result of ELF/WinPE incompatibility because I'm using Cygwin?
Additional info:
- My machine has both integrated Intel Graphics (630 - coffee lake), and a Quadro P1000.
- I 've installed CUDA 10.2 and AMD CodeXL installed (never mind why) to their default locations.
- Looking for An OpenCL DLL file, I find:
$ locate OpenCL.dll /cygdrive/c/Program Files (x86)/CodeXL/spies/OpenCL.dll /cygdrive/c/Program Files (x86)/CodeXL/spies64/OpenCL.dll /cygdrive/c/Program Files/NVIDIA Corporation/OpenCL/OpenCL.dll /cygdrive/c/Windows/LastGood/system32/OpenCL.dll /cygdrive/c/Windows/LastGood/SysWow64/OpenCL.dll /cygdrive/c/Windows/System32/OpenCL.dll /cygdrive/c/Windows/SysWOW64/OpenCL.dll