cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ESCHen99
Visitor
Visitor
250 Views
Registered: ‎07-12-2021

[Vitis] Xinlinx opencl C compilation error

I have the following code:

 

 

//...
#define CL_TARGET_OPENCL_VERSION 120
#include "CL/opencl.h"

int main(){
    // Code for exploring platforms in C
    cl_platform_id platform_id;         // platform id

err = clGetPlatformIDs(16, platforms, &platform_count);
    
// Find Xilinx Platform
for (unsigned int iplat=0; iplat<platform_count; iplat++) {
  err = clGetPlatformInfo(platforms[iplat], 
    CL_PLATFORM_VENDOR, 
    1000, 
    (void *)cl_platform_vendor,
    NULL);

  if (strcmp(cl_platform_vendor, "Xilinx") == 0) { 
  // Xilinx Platform found
  platform_id = platforms[iplat];
  }
}
}

 

 

 

But when trying to compile the following errors occur:

 

 

 

/usr/bin/ld: /opt/xilinx/xrt/lib//libxilinxopencl.so: undefined reference to `__cxa_init_primary_exception@CXXABI_1.3.11'
/usr/bin/ld: /opt/xilinx/xrt/lib//libxilinxopencl.so: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()@GLIBCXX_3.4.26'
/usr/bin/ld: /opt/xilinx/xrt/lib//libxilinxopencl.so: undefined reference to `std::__exception_ptr::exception_ptr::exception_ptr(void*)@CXXABI_1.3.11'

 

 

 

 

On the other hand, I can't figure out how to get rid of -std=c++14. The project is in C.

 

Target paltform Alveo u280.

OS: Ubuntu 20.04

Vitis: 2020.1

 

0 Kudos
2 Replies
yangc
Xilinx Employee
Xilinx Employee
206 Views
Registered: ‎02-27-2019

Can you try CL/cl2.hpp? 

yangc_0-1627003777548.png

 

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
ESCHen99
Visitor
Visitor
182 Views
Registered: ‎07-12-2021

Hi, 

 

Thanks for the response although, it is not working:

/usr/include/CL/cl2.hpp:516:2: error: #error Visual studio 2013 or another C++11-supporting compiler required
  516 | #error Visual studio 2013 or another C++11-supporting compiler required
      |  ^~~~~
In file included from ../src/nist/kat_kem.c:14:
/usr/include/CL/cl2.hpp:564:10: fatal error: utility: No such file or directory
  564 | #include <utility>
      |          ^~~~~~~~~
compilation terminated.
make: *** [makefile:140: src/nist/kat_kem.o] Error 1

 

But anyway, I'm compiling C I don't know why a cpp header should help.

 

Thanks in advance.

 

0 Kudos