doonny / PipeCNN

An OpenCL-based FPGA Accelerator for Convolutional Neural Networks
Apache License 2.0
1.22k stars 370 forks source link

how do I solve this problem undefined reference to `clCreateContext'? I use OS Ubuntu 18.04 #145

Closed GUUTA closed 3 years ago

GUUTA commented 3 years ago

arm-linux-gnueabihf-g++ ./host/main.o ../common/ocl_util.o ../common/timer.o -o run.exe
./host/main.o: In function main': /home/guta/Desktop/PipeCNN/project/host/main.cpp:256: undefined reference toclCreateContext' /home/guta/Desktop/PipeCNN/project/host/main.cpp:301: undefined reference to clCreateCommandQueue' /home/guta/Desktop/PipeCNN/project/host/main.cpp:303: undefined reference toclCreateCommandQueue' /home/guta/Desktop/PipeCNN/project/host/main.cpp:376: undefined reference to clCreateBuffer' /home/guta/Desktop/PipeCNN/project/host/main.cpp:380: undefined reference toclCreateBuffer' /home/guta/Desktop/PipeCNN/project/host/main.cpp:384: undefined reference to `clEnqueueWriteBuffer'

GUUTA commented 3 years ago

I have solved the above problem by exporting environment variable as following export QUARTUS_ROOTDIR=/home/guta/18.1/quartus export INTELFPGAOCLSDKROOT=/home/guta/intelFPGA/18.1/hld export PATH=$PATH:"$QUARTUS_ROOTDIR"/bin: "$INTELFPGAOCLSDKROOT"/linux64/bin:"$ALTERAOCLSDKROOT"/bin:/home/guta/intelFPGA/18.1/embedded/ds-5/bin export LD_LIBRARY_PATH="$INTELFPGAOCLSDKROOT"/linux64/lib

export AOCL_BOARD_PACKAGE_ROOT="$INTELFPGAOCLSDKROOT"/board/de1soc export QUARTUS_64BIT=1 reference is link https://www.terasic.com.tw/attachment/archive/836/DE1SOC_OpenCL_v02.pdf