Compile OpenCL on Mingw Nvidia SDK

后端 未结 2 539
小蘑菇
小蘑菇 2020-12-29 09:34

Is it possible to compile OpenCL using Mingw and Nvidia SDK?

I\'m aware that its not officially supported but that just doesn\'t make sense. Aren\'t the libraries pr

2条回答
  •  温柔的废话
    2020-12-29 09:54

    We have been able to do this by using the MinGW reimp and dlltool utilities to create an import library "libOpenCL.a" for the "OpenCL.dll" DLL. Here are the steps we followed:

    • step 1: Make sure you have mingw-utils installed (for reimp and dlltool). If you don't, at a MinGW prompt, type:

      mingw-get install mingw-utils

    • step 2: Next, type the following command:

      reimp OpenCL.lib

    This should yield an OpenCL.def and libOpenCL.a file. If the result is something along the lines of "invalid or corrupt import library", the alternative step 2 should work.

    • alternative step 2: Use dlltool together with a .def file that you can find here: http://pastebin.com/f2ac38b2f . The command becomes:

      dlltool -l libOpenCL.a -d OpenCL.def -A -k

    You can now link against the newly created libOpenCL.a. If you still see missing symbols, add them to the .def file and repeat the dlltool command.

    We were able to get this all working thanks to the information found in following posts, for reference:

    1. http://oscarbg.blogspot.com/2009/12/opencl-with-mingw.html
    2. http://www.mingw.org/wiki/CreateImportLibraries (I can only paste 2 links)

提交回复
热议问题