0

i download opencv 3.1.0 and build it with cmake i unchecked BUILD_SHARED_LIBS

after building finish i try to compile an c++ code as static lib and this is my

CMakeListed.txt file

    cmake_minimum_required(VERSION 2.8)                     
   PROJECT(word)              
   set(OpenCV_DIR "/home/medozeus/videos/opencv/share/opencv")                     
   FIND_PACKAGE( OpenCV REQUIRED )                               
   INCLUDE_DIRECTORIES( ${OpenCV_INCLUDE_DIRS} )
   ADD_EXECUTABLE(wordx main.cpp)                          
   TARGET_LINK_LIBRARIES (wordx ${OpenCV_LIBS})

its compiled without error and i run the program also without error but when i send the program to another pc and run it its give me

error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory

this is my 3rdparty folder content after build

enter image description here

and the lib inside 3rdparty content

enter image description here

but the source code have all the library i don't know why when i build it only build one library in 3rdparty mabye this cause the error

error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory

this is my 3rdparty folder content in source code of open cv

enter image description here

any idea

medo
  • 479
  • 3
  • 9
  • 24
  • Check this link: https://stackoverflow.com/questions/14077611/how-do-i-tell-cmake-to-link-in-a-static-library-in-the-source-directory – zindarod Sep 04 '17 at 13:29

1 Answers1

3

The error means there is no libjpeg.so.8 file on target machine you are running your executable. You could try installing it:

sudo apt-get install libjpeg-dev

Alex
  • 163
  • 7
  • 1
    Just to add a little bit more to your answer, OpenCV has quite a lot of dependencies (a lot of them optional), but I will suggest @medo to take a look to this [tutorial](http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/) to the part of the dependencies, to be able to install the most used ones – api55 Sep 04 '17 at 13:33