01-30-2019 03:19 PM
Hello I am trying to do a basic imread() to get data to plug into my algorithm, but it seems my Vivado HLS cannot find all the linkers. What flags/includes/linker paths do I need to add to the tool so it can find the OpenCV on my system? Does HLS use the OpenCV on the system or does it automatically install/compile its own version inside the tool? Are the functions like imread etc included in Xilinx's special OpenCV library headers?
Here is my basic code
#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> #include "haar_fusion_avg.h" #include <hls_video.h> #include <hls_opencv.h> #include "ap_int.h" #include <hls_stream.h> using namespace cv; using namespace std; int main(int argc, char **argv) { AXI_STREAM video1; Mat image; image = imread("lichtenstein_blur_bottom_right.png", CV_LOAD_IMAGE_COLOR); return 0; }
Here are the errors I get when I try to Run C Simulation.
INFO: [SIM 2] *************** CSIM start *************** INFO: [SIM 4] CSIM will launch GCC as the compiler. Generating csim.exe Makefile.rules:399: recipe for target 'csim.exe' failed /home/jfrye/sw/Xilinx/Vivado/2018.2/tps/lnx64/binutils-2.26/bin/ld: warning: libjpeg.so.62, needed by /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so, not found (try using -rpath or -rpath-link) /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_finish_compress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_write_scanlines@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_std_error@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_set_quality@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_finish_decompress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_stdio_src@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_alloc_huff_table@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_set_defaults@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_read_scanlines@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_CreateCompress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_start_compress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_CreateDecompress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_start_decompress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_destroy_decompress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_resync_to_restart@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_destroy_compress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_read_header@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.2/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_stdio_dest@LIBJPEG_6.2' collect2: error: ld returned 1 exit status make: *** [csim.exe] Error 1 ERR: [SIM 100] CSim file generation failed: compilation error(s). INFO: [SIM 3] *************** CSIM finish ***************
01-30-2019 08:55 PM
The tool uses linking libraries on the system. I guess for whatever reason when I was compiling OpenCV code before it was not invoking this library that the tools needs.
sudo apt-get install libjpeg62
01-30-2019 03:54 PM
Hey @david.johnson,
It's been reported by others than imread is missing from Vivado HLS 2018.2. However, the issue has been fixed in 2018.3. Can you update your version of Vivado?
I'd also like to point you to Xilinx's xfOpenCV. We've separated out the hardware accelerated version of opencv we provide into that git repository. There are two examples and a PDF guide to get you started; you do have to manually set the linker option to use xfOpenCV.
01-30-2019 07:36 PM
I'm getting the same error in the 2018.3 version of the tool. Although what you mentioned about imread I am sure is true, this is a different issue I think.
2018.3 tool ouput
INFO: [SIM 2] *************** CSIM start *************** INFO: [SIM 4] CSIM will launch GCC as the compiler. Generating csim.exe Makefile.rules:399: recipe for target 'csim.exe' failed /home/jfrye/sw/Xilinx/Vivado/2018.3/tps/lnx64/binutils-2.26/bin/ld: warning: libjpeg.so.62, needed by /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so, not found (try using -rpath or -rpath-link) /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_finish_compress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_write_scanlines@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_std_error@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_set_quality@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_finish_decompress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_stdio_src@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_alloc_huff_table@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_set_defaults@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_read_scanlines@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_CreateCompress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_start_compress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_CreateDecompress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_start_decompress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_destroy_decompress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_resync_to_restart@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_destroy_compress@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_read_header@LIBJPEG_6.2' /home/jfrye/sw/Xilinx/Vivado/2018.3/lnx64/tools/opencv/opencv_gcc/libopencv_highgui.so: undefined reference to `jpeg_stdio_dest@LIBJPEG_6.2' collect2: error: ld returned 1 exit status make: *** [csim.exe] Error 1 ERR: [SIM 100] CSim file generation failed: compilation error(s). INFO: [SIM 3] *************** CSIM finish ***************
01-30-2019 08:55 PM
The tool uses linking libraries on the system. I guess for whatever reason when I was compiling OpenCV code before it was not invoking this library that the tools needs.
sudo apt-get install libjpeg62
05-10-2019 03:28 AM
This is not the only issue with OpenCV testbenches as opencv_gcc is compiled with libpng12 which can't be installed in Ubuntu 18.04.
Solution: Copy an existing 'libpng12.so.0.59.0' to '2018.3/lnx64/tools/opencv/opencv_gcc' and create a symbolic link, e.g.:
ln -s libpng12.so.0.59.0 libpng12.so.0