Author Topic: ATI - MinGW-w64 applications exit when calling OpenCL runtime routines  (Read 4836 times)

0 Members and 1 Guest are viewing this topic.


  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4017
    • View Profile
When OpenCL™ applications are compiled with MinGW-w64, the application exits when an OpenCL™ runtime routine is called.

This is a known issue with the MinGW-w64 compiler.

Whereas the MinGW (32-bit) compiler does not require a libopencl.a file, MinGW-w64 does require such a file. When a libopencl.a file is not available and specified during the link stage, no link errors are reported. However, execution of the resulting binary executable terminates whenever an OpenCL™ runtime routine is called.

The recommended work around until this is resolved in the MinGW-w64 is to generate a libopencl.a file from the OpenCL.dll provided with the ATI Stream SDK v2 installation.

You will need to make sure the following tools are installed on your system:

    * gendef (a MinGW-w64 utility)
    * dlltool (a MinGW-w64 utility)

Run the following commands to generate libopencl.a from OpenCL.dll:

   1. gendef OpenCL.dll (this generates an OpenCL.def file)
   2. dlltool -l libopencl.a -d OpenCL.def -k -A
   3. Copy the resulting libopencl.a file into $ATISTREAMSDKROOT\lib.

When compiling an OpenCL™  application with MinGW-w64, make sure to specify the libopencl.a file as part of the input into the link stage of the compilation.