Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Problem with compiling host code in VS 2010 and emulation

I am trying out the simple vector addition example given on Altera website. I have AOCL 14.1, Quartus 14.1 and VS2010 installed. I am able to compile the OpenCL kernel without any problem.

However, when I try to compile the host code in VS2010, I get the following error:

alteracl.lib(acl_globals.obj) : error LNK2019: unresolved external symbol acl_hal_get_system_definition referenced in function acl_init_from_hal_discovery

I also found that for some reason, VS2010 is not able to read the file# include "CL/opencl.h" as this appears with a red underline.

The other issue I have is with emulation. AOC always complains that it cannot find the Visual Studio LINK.EXE though I have clearly included it in the path system variable : C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64

Any help would be greatly appreciated.

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I have been able to resolve the AOC unable to find VS LINK.EXE. I was trying emulation from within SoC embedded shell. That was wrong. I switched to windows command prompt shell. Also the path should be C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64

    However, I still have the VS2010 build error:

    LINK : warning LNK4044: unrecognized option '/LC:\altera\14.1\hld\board\de1soc\arm32\lib'; ignored

    1>LINK : warning LNK4044: unrecognized option '/lalterahalmmd'; ignored

    1>LINK : warning LNK4044: unrecognized option '/lalterammdpcie'; ignored

    1>alteracl.lib(acl_globals.obj) : error LNK2001: unresolved external symbol acl_hal_get_system_definition

    I tried compiling vector addition example for AOCL version 14.0 obtained from Altera website and it gave the same error. The options that it complains about being unrecognized are shown when I type aocl link-config.

    Someone please shed some light on this.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I have been able to resolve the AOC unable to find VS LINK.EXE. I was trying emulation from within SoC embedded shell. That was wrong. I switched to windows command prompt shell. Also the path should be C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64

    However, I still have the VS2010 build error:

    LINK : warning LNK4044: unrecognized option '/LC:\altera\14.1\hld\board\de1soc\arm32\lib'; ignored

    1>LINK : warning LNK4044: unrecognized option '/lalterahalmmd'; ignored

    1>LINK : warning LNK4044: unrecognized option '/lalterammdpcie'; ignored

    1>alteracl.lib(acl_globals.obj) : error LNK2001: unresolved external symbol acl_hal_get_system_definition

    I tried compiling vector addition example for AOCL version 14.0 obtained from Altera website and it gave the same error. The options that it complains about being unrecognized are shown when I type aocl link-config.

    Someone please shed some light on this.

    --- Quote End ---

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------say that you installed Visual Studio 2010 and windows SDK7.1, then pls help to follow the following steps which proved work: 11;dConfigure project to use the configuration alteraopencl with the platform x64: Right click on the Project simpleopencl in the Solution Explorer. Click on properties. At the top of the Property Pages, click on configuration manager¡­ From the dropdown menus, change the configuration and platform

    2. click Close [/B]to close the Configuration Manager.

    3.In the Property Pages, go to configuration properties -> general. Verify that the platform toolset has been set to windows7.1sdk. This is what allows us to compile 64-bit executable.

    4.In the Property Pages, go to c/c++ -> general. You should see that the additional include directories should include a path to the Intel include files.

    the include directory allows our compile to be aware of the altera opencl header files.

    5. Now go to linker->general. You should see Altera¡¯s 64-bit library path listed under Additional library directories.

    this points the linker to the library directory where intel¡¯s libraries are located.

    6. Go to linker->input. In the additional dependencies field, you should see opencl.lib. This is Altera¡¯s provided static library for compiling and running

    OpenCL kernels.

    7. Click ok to close the Property Pages.

    [/B]
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    say that you installed Visual Studio 2010 and windows SDK7.1, then pls help to follow the following steps which proved work:

    1. Configure project to use the configuration AlteraOpenCL with the platform x64: Right click on the Project SimpleOpenCL in the Solution Explorer. Click on Properties. At the top of the Property Pages, click on Configuration Manager¡* From the dropdown menus, change the Configuration and platform

    2. Click Close to close the Configuration Manager.

    3.In the Property Pages, go to Configuration Properties -> General. Verify that the Platform Toolset has been set to Windows7.1SDK. This is what allows us to compile 64-bit executable.

    4.In the Property Pages, go to C/C++ -> General. You should see that the Additional Include Directories should include a path to the Intel include files. The include directory allows our compile to be aware of the Altera OpenCL header files.

    5. Now go to Linker->General. You should see Altera¡¯s 64-bit library path listed under Additional Library Directories. This points the linker to the library directory where Intel¡¯s libraries are located.

    6. Go to Linker->Input. In the Additional Dependencies field, you should see opencl.lib. This is Altera¡¯s provided static library for compiling and running OpenCL kernels.

    7. Click OK to close the Property Pages.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    There has something to set in Project Properties.

    please refer to modified project as attached.

    The execution result as below:

    Initializing OpenCL

    Platform: Altera SDK for OpenCL

    Using 1 device(s)

    EmulatorDevice : Emulated Device

    Using AOCX: vector_add.aocx

    Launching for device 0 (10000 elements)

    Time: 275.007 ms

    Kernel time (device 0): 274.017 ms

    Verification: PASS

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Have you resolve your problem? I have to say that I have met the same problem with you, can you tell me the solutions? Thank you very much!