Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i use Opencv build in one Linux PC to the other?

Tags:

c++

linux

opencv

I am trying to create a C++ application with opencv and share the application with other user who donot have Opencv installed on its PC. How can i do that?

I tried :

  1. I copied all the header files, source files and libraries in some /home/myfolder path.
    1. I created the application and link all the files stored in /home/myfolder.
    2. set the environment variable LD_LIBRARY_PATH to point /home/myfolder in .bashrc file so that application can find the libraries during run time.

I was able to compile on my PC, but when i share my folder with some other PC and link all the libraries, I get undefined reference error for Opencv.

Thanks

like image 253
sumit Avatar asked Nov 08 '22 17:11

sumit


1 Answers

The answer is static linking. If you don't care about executable size and the target machine doesn't have the required libraries, just supply them inside the executable. Please look at this question for reference.

like image 130
yotabyte Avatar answered Nov 14 '22 22:11

yotabyte