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