Search code examples
openclfpgaintel-fpga

Intel OpenCL SDK for FPGA compile kernel for emulation with aoc command gives linker error


I'm trying to compile a kernel for emulation with aoc in the Intel FPGA SDK, I have set all environment variables as possible even using the init_opencl.bat included in the SDK. I'm running the following line using the visual studio 2017 developers command prompt in order to use visual studio linker:

aoc -march=emulator -v -board=a10gx my_kernel.cl -o my_kernel.aocx

but it always throws a linker error (the errors are in Spanish, sorry about that).

Creando biblioteca libkernel.lib y objeto libkernel.exp

libkernel.obj : error LNK2019: símbolo externo __imp___translate_sampler_initializer sin resolver al que se hace referencia en la función my_kernel

libkernel.obj : error LNK2019: símbolo externo floorf sin resolver al que se hace referencia en la función __acl__copysignf

libkernel.obj : error LNK2019: símbolo externo ceilf sin resolver al que se hace referencia en la función __acl__copysignf

libkernel.obj : error LNK2019: símbolo externo log2 sin resolver al que se hace referencia en la función __acl__sppow_approx

libkernel.obj : error LNK2019: símbolo externo exp2 sin resolver al que se hace referencia en la función __acl__sppow_approx

LINK : error LNK2001: símbolo externo _DllMainCRTStartup sin resolver

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x86\msvcrt.lib : warning LNK4272: el tipo de máquina de biblioteca 'x86' está en conflicto con el tipo de máquina de destino 'x64'

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x86\legacy_stdio_definitions.lib : warning LNK4272: el tipo de máquina de biblioteca 'x86' está en conflicto con el tipo de máquina de destino 'x64'

libkernel.dll : fatal error LNK1120: 6 externos sin resolver

I have no idea what else to do.

Note: The kernel uses image2d objects which I'm not entirely sure are compatible with FPGAs. Actually that's another question.


Solution

  • First of all thanks doqtor for your answer...in the end I was finnaly able to compile without having to change much....actually if you run the aoc offline compiler from the Visual Studio Developers Command Prompt x64 most of the problems are solved.

    I decided to cleanly reinstall the entire Intel FPGA SDK and this time set up correctly every environment variable...and everything worked perfectly...I was able to compile and execute the SDK examples.

    But one problem could not be solved....my kernel uses image2d_t objects and of course sampler_t....turns out according to the Intel SDK Programming Guide...the SDK does not support images and samplers while working with OpenCL 1.0.

    The weird thing is that the FPGA Emulator platform does support it so i was able to compile using the emulator....although this wont solve much for me.....I have decided to change my kernel and find an alternative to image and samplers.

    Thanks