----------------------------------------
> From: [email protected]
> To: [email protected]
> Date: Sat, 5 Sep 2015 10:03:35 -0400
> Subject: Re: [Mingw-w64-public] Unable to link OpenCL for i686
>
> Nakai,
>
> Does that imply that there is something wrong with the .def file?
>
Yes.
For 32bit, you should add  the ordinal values of the functions exported by the 
DLL (like clBuildProgram@24).

> I added -A and -k and still get the same error.
>
> Thanks,
> Kyle
>
> -----Original Message-----
> From: Nakai Yuta [mailto:[email protected]]
> Sent: Saturday, September 5, 2015 1:50 AM
> To: [email protected]
> Subject: Re: [Mingw-w64-public] Unable to link OpenCL for i686
>
> hi, zeranoe
>
> Do you want to do that on windows (eg. msys/msys2) ? If so, here is my way
> to generate libOpenCL.a (OpenCL.dll import library).
>
> On Win64 System
> 1. generate .def files
> (a) for 64bit
> mkdir lib64 && gendef - /c/Windows/system32/OpenCL.dll> lib64/OpenCL.def
> (b) for 32bit
> mkdir lib32 && gendef - /c/Windows/SysWOW64/OpenCL.dll> lib32/OpenCL.def
>
> 2. generate import libraries
> (a) for 64bit
> x86_64-w64-mingw32-dlltool -l lib64/libOpenCL.a -d lib64/OpenCL.def -A -k
> (b) for 32bit
> i686-w64-mingw32-dlltool -l lib32/libOpenCL.a -d lib32/OpenCL.def -A -k
>
> I use these import libraries when I build FFmpeg.
>
> ----------------------------------------
>> From: [email protected]
>> To: [email protected]
>> Date: Fri, 4 Sep 2015 23:17:22 -0400
>> Subject: [Mingw-w64-public] Unable to link OpenCL for i686
>>
>> I'm unable to link OpenCL for i686, but x86_64 works.
>>
>> I'm creating the library files (.a) from a def file using dlltool. The
>> def file and headers come from the ICD archive found here:
>> https://www.khronos.org/registry/cl/
>>
>> I'm attempting to run the following bash compile script:
>>
>> for arch in "i686" "x86_64"; do
>> opencl_dir="$working_dir/opencl-1.2.11.0-$arch"
>> $arch-w64-mingw32-dlltool --input-def "libOpenCL.def"
>> --no-leading-underscore --output-lib "$opencl_dir/lib/libOpenCL.a"
>> $arch-w64-mingw32-gcc -I"$opencl_dir/include" -std=c99 -c -o
>> "link-opencl.o" "link-opencl.c"
>> $arch-w64-mingw32-gcc -L"$opencl_dir/lib" -o "link-opencl-$arch.exe"
>> "link-opencl.o" -lOpenCL
>> done
>>
>> The compile script outputs the following:
>>
>> link-opencl.o:link-opencl.c:(.text+0x4): undefined reference to
>> `clEnqueueNDRangeKernel@36'
>> collect2: error: ld returned 1 exit status
>> link-opencl.c: In function 'check_clEnqueueNDRangeKernel':
>> link-opencl.c:2:50: warning: cast from pointer to integer of different
>> size [-Wpointer-to-int-cast] long check_clEnqueueNDRangeKernel(void) {
>> return (long) clEnqueueNDRangeKernel; }
>>
>> The first part (undefined reference to `clEnqueueNDRangeKernel@36') is
>> i686, and the 2nd is x86_64 which succeeds with a warning.
>>
>> link-opencl.c contains:
>>
>> #include <CL/cl.h>
>> long check_clEnqueueNDRangeKernel(void) { return (long)
>> clEnqueueNDRangeKernel; } int main(void) { return 0; }
>>
>> Running an objdump on each libOpenCL.a results in:
>> I686:
>> [ 7](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
>> clEnqueueNDRangeKernel [ 8](sec 5)(fl 0x00)(ty 0)(scl 2) (nx 0)
>> 0x00000000 __imp_clEnqueueNDRangeKernel
>>
>> X86_64:
>> [ 7](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x0000000000000000
>> clEnqueueNDRangeKernel [ 8](sec 5)(fl 0x00)(ty 0)(scl 2) (nx 0)
>> 0x0000000000000000 __imp_clEnqueueNDRangeKernel
>>
>> Thanks,
>> Kyle
>>
>>
>> ----------------------------------------------------------------------
>> -------- _______________________________________________
>> Mingw-w64-public mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
> ----------------------------------------------------------------------------
> --
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
                                          
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to