thinkoco / c5soc_opencl

DE1SOC DE10-NANO DE10-Standard OpenCL hardware that support VGA and desktop. And Some applications such as usb camera YUYV to RGB , Sobel and so on.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile errors building camera_sobel

kutenai opened this issue · comments

Greetings. I'm trying to compile the camera_sobel, but getting compile errors.

I've tried using the 17.1 and 18.1 build tools versions, but I get the same error for both

edhenderson@ubuntu:~/proj/machine_learning/c5soc_opencl/application/camera_sobel$ make
arm-linux-gnueabihf-g++   -Wall -std=c++11 -O2 -c host/src/video.cpp -o host/src/video.o -I/home/edhenderson/intelFPGA/17.1/hld/host/include   -Ihost/inc  -I../common/inc  -I/usr/include/SDL2  -DFPGA_DEVICE 
host/src/video.cpp: In function ‘void video_set_format()’:
host/src/video.cpp:86:20: error: invalid conversion from ‘__u32 {aka unsigned int}’ to ‘v4l2_buf_type’ [-fpermissive]
  video.format.type = stream_flag;
                    ^
host/src/video.cpp: In function ‘void buffer_request()’:
host/src/video.cpp:156:24: error: invalid conversion from ‘__u32 {aka unsigned int}’ to ‘v4l2_buf_type’ [-fpermissive]
  video.buffer.req.type = stream_flag;
                        ^
Makefile:118: recipe for target 'host/src/video.o' failed
make: *** [host/src/video.o] Error 1
edhenderson@ubuntu:~/proj/machine_learning/c5soc_opencl/application/camera_sobel$ 

Do I need to go back to 16.x?? I'd really prefer to move forward of course. My next step is to start digging into the libraries and include files and see if I can track down the source of the error. I'm kind of thinking this is a version issue, but without more experience with OpenCL, it will take me some time to track this down.

Any advice or assistance would be much appreciated

I was able to fix the above issues by modifying video.cpp

//static int stream_flag = V4L2_BUF_TYPE_VIDEO_CAPTURE;
static v4l2_buf_type stream_flag = V4L2_BUF_TYPE_VIDEO_CAPTURE;

Next, I found an issue with missing files
#include <SDL2/SDL.h>

I am working on Ubuntu, so I found I could install sdr2 using apt-get. Of course, I'm pretty sure that isn't going to work since the compiler would try and build against the "ubuntu" library, but I'm cross compiling... so not I'm stuck. I did try and add the /usr/include directory to load SDR, but then it has an issue finding immintrin.h. I found this in the directory
~/intelFPGA/18.1/embedded/ds-5/sw/ARMCompiler6.10.1/lib/clang/7.0.0/include/, but then I get a ton of other errors, so, obviously, I have incompatible libraries

Can you help with information about how your environment was set up to build these applications??

Okay, I found a way to do this, but it's a bit hacky. I'm copying the /usr/include and /usr/lib paths from the arm core and using them for cross compiling. I should be able to download this though right??