How can I use Opencv to build on the same Linux PC?

I am trying to create a C ++ application with opencv and share the application with another user who has Opencv installed on his PC. How can i do this?

I tried:

  • I copied all the header files, source files and libraries in the path / home / myfolder.
    1. I created an application and linked all the files stored in / home / myfolder.
    2. set the environment variable LD_LIBRARY_PATH to / home / myfolder in the .bashrc file so that the application can find libraries at runtime.

I was able to compile on my PC, but when I share my folder with another PC and contact all the libraries, I get an undefined reference error for Opencv.

thanks

+5
source share
2 answers

The answer is static binding. If you do not need the size of the executable file, and the target computer does not have the necessary libraries, just put them inside the executable file. Please see this question for reference.

+1
source

This answer has security implications - inform yourself before use and use it only on a private network.


You can leave another ssh user on your computer and forward the X11 connection to his own machine using the -X or -Y options.

So another user:

 ssh -Y someUser@yourPC yourApp 

You will need to think about whether you want to trust this user to log in as you do, or if you want to make another user on your PC that could only run your specific application, and another.


Another option would be to allow another user to make their X11 display available to your PC by typing the following on his machine:

 xhost + 

Then you can run your application on your computer, but with the display being sent to his machine - thus, he does not need to log into your computer or have his password:

 DISPLAY=<otherPC>:0 yourApp 
0
source

Source: https://habr.com/ru/post/1271090/


All Articles