Community
cancel
Showing results for 
Search instead for 
Did you mean: 
nnain1
New Contributor I
488 Views

Compile error for oneAPI Base Toolkit

Jump to solution

I have installed oneAPI at my system with Ubuntu 18.04 LTS, Intel® Xeon(R) CPU E5-1620 v4 @ 3.50GHz × 8, Quadro P4000/PCIe/SSE2, gcc/g++5.4.

When I make all, the errors are

dpcpp -o vector-add.exe src/vector-add.cpp -lOpenCL -lsycl
/opt/intel/inteloneapi/compiler/2021.1-beta03/linux/bin/../lib/libsycl.so: undefined reference to `clCreateProgramWithIL@OPENCL_2.1'
/opt/intel/inteloneapi/compiler/2021.1-beta03/linux/bin/../lib/libsycl.so: undefined reference to `clGetKernelSubGroupInfo@OPENCL_2.1'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:10: recipe for target 'main' failed
make: *** [main] Error 1

What could be wrong?

Tags (1)
0 Kudos
1 Solution
Dmitry_Savin
New Contributor I
488 Views

Hi, You may also need to uninstall the Intel OpenCL runtime from the Ubuntu repository (package ocl-icd-libopencl1). The one that comes with the basekit is more recent even compared to the latest Ububtu (19.10). You can check which library is used by running > ldd /opt/intel/inteloneapi/compiler/latest/linux/lib/libsycl.so | grep OpenCL If you did not run > source /opt/intel/inteloneapi/setvars.sh it may point to /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 or some other library and /opt/intel/inteloneapi/compiler/latest/linux/lib/libOpenCL.so.1 otherwise. You can check the supported version and symbols by running > nm -gD libOpenCL.so.1 | grep 'OPENCL\|clGetKernelSubGroupInfo' on each of the found libraries. -Dmitry

View solution in original post

14 Replies
Kaleem_A_Intel
Employee
488 Views

Hi Naing,

Thanks for reaching out to us.

We are working on this issue and will get back to you.

 

Kaleem

AbhishekD_Intel
Moderator
488 Views

Hi, 

This error is due to conflicting libOpenCL.so, I will suggest you to properly uninstall everything and re-install beta03 base toolkit and then it will work.

-Abhishek

 

Dmitry_Savin
New Contributor I
489 Views

Hi, You may also need to uninstall the Intel OpenCL runtime from the Ubuntu repository (package ocl-icd-libopencl1). The one that comes with the basekit is more recent even compared to the latest Ububtu (19.10). You can check which library is used by running > ldd /opt/intel/inteloneapi/compiler/latest/linux/lib/libsycl.so | grep OpenCL If you did not run > source /opt/intel/inteloneapi/setvars.sh it may point to /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 or some other library and /opt/intel/inteloneapi/compiler/latest/linux/lib/libOpenCL.so.1 otherwise. You can check the supported version and symbols by running > nm -gD libOpenCL.so.1 | grep 'OPENCL\|clGetKernelSubGroupInfo' on each of the found libraries. -Dmitry

View solution in original post

nnain1
New Contributor I
488 Views

Thanks a lot.

AbhishekD_Intel
Moderator
488 Views

Hi,

Let us know if it worked for you and get back to us if you faced any issue.

-Abhishek

nnain1
New Contributor I
488 Views

The old installation was removed and reinstall new one following the instructions in the link.

But still have the same error when I make all.

coie@coie-HP-Z440-Workstation:~/Data/coie/Softwares/oneAPI/dpc++/module04/Lab_module4/devcon/complex_mult$ make all
dpcpp lab/complex_mult.cpp -o bin/complex_mult -Isrc/ -lOpenCL -lsycl
/opt/intel/inteloneapi/compiler/2021.1-beta03/linux/bin/../lib/libsycl.so: undefined reference to `clCreateProgramWithIL@OPENCL_2.1'
/opt/intel/inteloneapi/compiler/2021.1-beta03/linux/bin/../lib/libsycl.so: undefined reference to `clGetKernelSubGroupInfo@OPENCL_2.1'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:13: recipe for target 'main' failed
make: *** [main] Error 1

Following one of the suggestions above to check opencl and output is as follow.

coie@coie-HP-Z440-Workstation:~/Data/coie/Softwares/oneAPI/dpc++/module04/Lab_module4/devcon/complex_mult$ ldd /opt/intel/inteloneapi/compiler/latest/linux/lib/
libsycl.so | grep OpenCL
    libOpenCL.so.1 => /opt/intel/inteloneapi/compiler/latest/linux/lib/libOpenCL.so.1 (0x00007feb9bdde000)

Why I still can't compile the project?

Dmitry_Savin
New Contributor I
488 Views

What does

nm -gD /opt/intel/inteloneapi/compiler/latest/linux/lib/libOpenCL.so.1 | grep 'OPENCL\|clGetKernelSubGroupInfo\|clCreateProgramWithIL'

show you?

-Dmitry

 

UPD: In the DevCloud the command does not work, had to do in two steps: nm -gD /opt/intel/inteloneapi/compiler/latest/linux/lib/libOpenCL.so.1> out grep 'OPENCL\|clGetKernelSubGroupInfo\|clCreateProgramWithIL' out
Jie_L_Intel
Employee
488 Views
naing, use this command to build "dpcpp -o vector-add.exe src/vector-add.cpp"
nnain1
New Contributor I
488 Views

Yes this command "dpcpp -o vector-add.exe src/vector-add.cpp" can build exe file. Thanks.

make all doesn't work.

nnain1
New Contributor I
488 Views

This command

nm -gD /opt/intel/inteloneapi/compiler/latest/linux/lib/libOpenCL.so.1 | grep 'OPENCL\|clGetKernelSubGroupInfo\|clCreateProgramWithIL'

gave
00000000000046f0 T clCreateProgramWithIL
0000000000004720 T clGetKernelSubGroupInfo
0000000000000000 A OPENCL_1.0
0000000000000000 A OPENCL_1.1
0000000000000000 A OPENCL_1.2
0000000000000000 A OPENCL_2.0
0000000000000000 A OPENCL_2.1
0000000000000000 A OPENCL_2.2

Joey__Wang
Beginner
488 Views

naing, 

Try change ./src/CMakeLists.txt:target_link_libraries(complex_mult OpenCL sycl)

to ./src/CMakeLists.txt:target_link_libraries(complex_mult sycl)

I found same issue on HPCKit-code-samples..

 

AbhishekD_Intel
Moderator
488 Views

Hi Naing,

Let us know if we can close this thread, you are always welcome to raise a new thread.

-Abhishek

nnain1
New Contributor I
488 Views

Yes please go ahead. Removing opencl flag in makefile solved the issue.

Sushma_P_Intel
Employee
488 Views

Hi Naing,

Hope your issue is resolved. We are closing this thread. You can always reach out to us for other queries in a new thread.

 

Regards

Sushma.

Reply