0

I am attempting to compile and link a C/C++ OpenCL application in CLion on Windows using the NVIDIA OpenCL library provided in the NVIDIA CUDA 7.5 SDK.

My issue is that CLion is using CMake and the Cygwin GCC compiler to create code in Windows. Therefore, there is some confusion about whether I should use the .lib, the .a, the .dll, or the .o files during runtime.

There is an indication is that I may be able to export definitions from OpenCl.dll and create opencl.a to import and potentially run against OpenCl.dll. Cygwin has this guide for using nm for linking against DLL's. They indicate that we may do

echo EXPORTS > foo.def
nm foo.dll | grep ' T _' | sed 's/.* T _//' >> foo.def
dlltool --def foo.def --dllname foo.dll --output-lib foo.a

will create work. This post contains instructions on how to complete the task with MinGW and also uses dlltool.

However, as the cygwin guide warns, the running nm OpenCl.dll from the OpenCl.dll in the NVIDIA CUDA SDK results in nm: OpenCl.dll: no symbols indicating that the DLL has been stripped or some error has occurred.

I am working with the CUDA 7.5 SDK but suspect the issues will be similar across the board.

Has anyone successfully built and linked in CLion for Windows, or from Cygwin in a Windows Environment?

Community
  • 1
  • 1
Steve
  • 3,957
  • 2
  • 26
  • 50
  • 1
    nVIDIA ships only stripped versions. You need to get the defs in another way, nm does only use debug data, so it is a logical result that it does not work. – DarkZeros Jan 07 '16 at 10:31
  • @DarkZeros Agreed. Is it known how to acquire a stable def file? My thought is that there is a high probability that the core opencl function defs should be transferable but I am unsure about compatibility issues with transferring between cygwin and windows, possible name mangling (?), etc. – Steve Jan 11 '16 at 23:19
  • 1
    While I don't have experience with Cygwin, I have used the libOpenCL.a file from the AMD APP SDK when building code in MinGW-w64. Hopefully you can use libOpenCL.a too. I haven't had issues using this on NVIDIA GPUs so long as I stick to the OpenCL version they support (1.1 on older drivers, 1.2 on newer drivers). – chippies Jan 17 '16 at 22:03

0 Answers0