cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
afilgueras
Contributor
Contributor
12,676 Views
Registered: ‎03-05-2014

Vivado HLS cannot find -lopencv* during C simulation

Jump to solution

Hi all,

 

I am trying to run a c simulation but it results in an error (see below).

 

I'm not using opencv at all.

I'm running Vivado 2014.3 on an ubuntu 14.04 machine.

 

Do I have to manually install all opencv libraries on the system? Or am I missing something else like setting some library path or similar.

 

Thank you

 

 

   Compiling ../../../../source/mmult_tb.cpp in debug mode
   Compiling ../../../../source/mmult_core.cpp in debug mode
   Generating csim.exe
/usr/bin/ld: cannot find -lopencv_calib3d
/usr/bin/ld: cannot find -lopencv_contrib
/usr/bin/ld: cannot find -lopencv_core
/usr/bin/ld: cannot find -lopencv_features2d
/usr/bin/ld: cannot find -lopencv_flann
/usr/bin/ld: cannot find -lopencv_gpu
/usr/bin/ld: cannot find -lopencv_highgui
/usr/bin/ld: cannot find -lopencv_imgproc
/usr/bin/ld: cannot find -lopencv_legacy
/usr/bin/ld: cannot find -lopencv_ml
/usr/bin/ld: cannot find -lopencv_objdetect
/usr/bin/ld: cannot find -lopencv_photo
/usr/bin/ld: cannot find -lopencv_stitching
/usr/bin/ld: cannot find -lopencv_superres
/usr/bin/ld: cannot find -lopencv_ts
/usr/bin/ld: cannot find -lopencv_video
/usr/bin/ld: cannot find -lopencv_videostab
collect2: ld returned 1 exit status
make: *** [csim.exe] Error 1
@E [SIM-1] 'csim_design' failed: compilation error(s).

 

0 Kudos
1 Solution

Accepted Solutions
afilgueras
Contributor
Contributor
21,151 Views
Registered: ‎03-05-2014

Hi,

I have been able to work around this problem

It is not very elegant but I got the problem sorted :)

Basically I made the opencv libraries included in vivado hls visible to the compiler.
The needed libraries are in xilinx/Vivado_HLS/2014.3/lnx64/tools/opencv/
so I made a soft link to a directory ~/lib for instance and add that directory to the LIBRARY_PATH environment variable.

I also had to do some renaming so the files have the right name.
For instance libopencv_core.so.2.4.5 -> libopencv_core.so

By the way, I still think that the best solution is that the compiler does not try to link against libraries that are not needed.

View solution in original post

0 Kudos
7 Replies
debrajr
Moderator
Moderator
12,536 Views
Registered: ‎04-17-2011
Can you post your testcase here?
Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
afilgueras
Contributor
Contributor
12,494 Views
Registered: ‎03-05-2014

Hi

Sorry for taking so long to reply.

I've managed to create a simple test case that reproduces the error in my environment.

This can be tested running vivado_hls -f script.tcl which runs C cosimulation and synthesis.

0 Kudos
debrajr
Moderator
Moderator
12,484 Views
Registered: ‎04-17-2011

Are you sure this is the correct testcase? I ran script.tcl in HLS 2014.3 but on Windows 7 environment and it ran without any error. Attached is the vivado_hls.log.

Additonally I didnt find any OpenCV reference in the files.

Could you please recheck?

Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
afilgueras
Contributor
Contributor
12,479 Views
Registered: ‎03-05-2014

I checked that this small test case causes me these problems. I've attached the log file.

If I go to the csim directory project/solution1/csim/build and run
make -f csim.mk --dry-run
I get:

 

/Soft/xilinx/Vivado_HLS/2014.3/lnx64/tools/gcc/bin/g++ obj/test_tb.o obj/test.o -D_DEBUG -Wl,--as-needed -L "/Soft/xilinx/Vivado_HLS/2014.3/lnx64/tools/systemc/lib" -lsystemc -lpthread -L "/Soft/xilinx/Vivado_HLS/2014.3/lnx64/tools/fpo_v7_0" -lgmp -lmpfr -lIp_floating_point_v7_0_bitacc_cmodel -L "/Soft/xilinx/Vivado_HLS/2014.3/lnx64/tools/opencv" -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -L "/Soft/xilinx/Vivado_HLS/2014.3/lnx64/tools/fft_v9_0" -lIp_xfft_v9_0_bitacc_cmodel -L "/Soft/xilinx/Vivado_HLS/2014.3/lnx64/tools/fir_v7_0" -lgmp -lIp_fir_compiler_v7_2_bitacc_cmodel  -o csim.exe

 



Which tries to link with opencv stuff

I've checked the makefiles and there is a __SIM_OPENCV__ = 1 in csim.mk which causes everything to be compiled with opencv libraries.
I've also attached the makefiles.

(for some reason I had to compress the files in order to attach them :/ )

 

Regards

Antonio

0 Kudos
debrajr
Moderator
Moderator
12,469 Views
Registered: ‎04-17-2011
Ok..thanks for the clarification. I would try this out and post in this thread.
Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
afilgueras
Contributor
Contributor
21,152 Views
Registered: ‎03-05-2014

Hi,

I have been able to work around this problem

It is not very elegant but I got the problem sorted :)

Basically I made the opencv libraries included in vivado hls visible to the compiler.
The needed libraries are in xilinx/Vivado_HLS/2014.3/lnx64/tools/opencv/
so I made a soft link to a directory ~/lib for instance and add that directory to the LIBRARY_PATH environment variable.

I also had to do some renaming so the files have the right name.
For instance libopencv_core.so.2.4.5 -> libopencv_core.so

By the way, I still think that the best solution is that the compiler does not try to link against libraries that are not needed.

View solution in original post

0 Kudos
debrajr
Moderator
Moderator
12,402 Views
Registered: ‎04-17-2011
Hi,
Thanks for the update. Please feel free to mark your post as an accepted solution and close this topic. This would be helpful for other visitors on our community.
Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos