Can't build CMake project with additional libs #284

Closed
opened 2026-01-29 16:39:54 +00:00 by claunia · 5 comments
Owner

Originally created by @Izaron on GitHub (Feb 18, 2017).

CLion uses CMake, and I can't build it, for example, with OCR
I have installed tesseract and leptonica developer libraries

option (WITH_OCR "Build with OCR (Optical Character Recognition) feature" OFF)

When I trying to change "OFF" to "ON" and clean cmake and cmake folder, I get an errors

<...>
compilation terminated.
/bin/sh: -I/usr/include/leptonica: No such file or directory
lib_ccx/CMakeFiles/ccx.dir/build.make:62: recipe for target 'lib_ccx/CMakeFiles/ccx.dir/__/zvbi/decoder.c.o' failed
gmake[3]: *** [lib_ccx/CMakeFiles/ccx.dir/__/zvbi/decoder.c.o] Error 127
/bin/sh: -I/usr/include/leptonica: No such file or directory
gmake[3]: *** Waiting for unfinished jobs....
<...>

I tried change code in this part:

#if (WITH_OCR)
  find_package(PkgConfig)

  pkg_check_modules (TESSERACT REQUIRED tesseract)
  pkg_check_modules (LEPTONICA REQUIRED lept)

  set (EXTRA_LIBS ${EXTRA_LIBS} ${TESSERACT_LIBRARIES})
  set (EXTRA_LIBS ${EXTRA_LIBS} ${LEPTONICA_LIBRARIES})
  include_directories (${TESSERACT_INCLUDE_DIRS} ${LEPTONICA_INCLUDE_DIRS})
  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_OCR")
#endif (WITH_OCR)

But got very strange behavior - this includies and define ENABLE_OCR is available only in ccextractor.c file.
Can anyone fix it? I would be very glad.

Originally created by @Izaron on GitHub (Feb 18, 2017). CLion uses CMake, and I can't build it, for example, with OCR I have installed tesseract and leptonica developer libraries ``` option (WITH_OCR "Build with OCR (Optical Character Recognition) feature" OFF) ``` When I trying to change "OFF" to "ON" and clean cmake and cmake folder, I get an errors ``` <...> compilation terminated. /bin/sh: -I/usr/include/leptonica: No such file or directory lib_ccx/CMakeFiles/ccx.dir/build.make:62: recipe for target 'lib_ccx/CMakeFiles/ccx.dir/__/zvbi/decoder.c.o' failed gmake[3]: *** [lib_ccx/CMakeFiles/ccx.dir/__/zvbi/decoder.c.o] Error 127 /bin/sh: -I/usr/include/leptonica: No such file or directory gmake[3]: *** Waiting for unfinished jobs.... <...> ``` I tried change code in this part: ``` #if (WITH_OCR) find_package(PkgConfig) pkg_check_modules (TESSERACT REQUIRED tesseract) pkg_check_modules (LEPTONICA REQUIRED lept) set (EXTRA_LIBS ${EXTRA_LIBS} ${TESSERACT_LIBRARIES}) set (EXTRA_LIBS ${EXTRA_LIBS} ${LEPTONICA_LIBRARIES}) include_directories (${TESSERACT_INCLUDE_DIRS} ${LEPTONICA_INCLUDE_DIRS}) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_OCR") #endif (WITH_OCR) ``` But got very strange behavior - this includies and define `ENABLE_OCR` is available only in ccextractor.c file. Can anyone fix it? I would be very glad.
Author
Owner

@Izaron commented on GitHub (Feb 18, 2017):

linux/build and linux/builddebug works very well with all additional libraries.

@Izaron commented on GitHub (Feb 18, 2017): linux/build and linux/builddebug works very well with all additional libraries.
Author
Owner

@cfsmp3 commented on GitHub (Feb 18, 2017):

GSoC qualification: 2 points

@cfsmp3 commented on GitHub (Feb 18, 2017): GSoC qualification: 2 points
Author
Owner

@Izaron commented on GitHub (Feb 22, 2017):

@cfsmp3 and others who have any serious experience in CMake
Can you see this diff and check commit by commit? https://github.com/CCExtractor/ccextractor/compare/master...Izaron:cmake-ocr?expand=1 (have not requested pull yet)
There was one missed library, using of static libraries and more small bugs as seems to me

https://github.com/CCExtractor/ccextractor/blob/master/docs/using_cmake_build.txt - see screenshot of current master CMake
screenshot from 2017-02-22 16-25-38

With my changes it builds OK...

@Izaron commented on GitHub (Feb 22, 2017): @cfsmp3 and others who have any serious experience in CMake Can you see this diff and check commit by commit? https://github.com/CCExtractor/ccextractor/compare/master...Izaron:cmake-ocr?expand=1 (have not requested pull yet) There was one missed library, using of static libraries and more small bugs as seems to me https://github.com/CCExtractor/ccextractor/blob/master/docs/using_cmake_build.txt - see screenshot of current master CMake ![screenshot from 2017-02-22 16-25-38](https://cloud.githubusercontent.com/assets/5406399/23214062/d61a152e-f926-11e6-85aa-b12fcaaba4f3.png) With my changes it builds OK...
Author
Owner

@Izaron commented on GitHub (Feb 22, 2017):

Also, still can't get out what "STATIC" in linker mean.
As I understand, with static libs we should get working binary without any dependencies? But with both STATIC and non-static I get in virtual machine:

./ccextractor: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory
./ccextractor: error while loading shared libraries: libtesseract.so.3: cannot open shared object file: No such file or directory

Can anyone help me please?
CMakeLists.txt have to be updated - we should change minor version from 77 to 85, add SWSCALE from FFMPEG, and get it working.

@Izaron commented on GitHub (Feb 22, 2017): Also, still can't get out what "STATIC" in linker mean. As I understand, with static libs we should get working binary without any dependencies? But with both STATIC and non-static I get in virtual machine: ``` ./ccextractor: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory ./ccextractor: error while loading shared libraries: libtesseract.so.3: cannot open shared object file: No such file or directory ``` Can anyone help me please? CMakeLists.txt have to be updated - we should change minor version from 77 to 85, add SWSCALE from FFMPEG, and get it _working_.
Author
Owner

@cfsmp3 commented on GitHub (Feb 22, 2017):

I've never used CMake, this was Anshul's work I think.

On Wed, Feb 22, 2017 at 7:14 AM, Evgeny Shulgin notifications@github.com
wrote:

Also, still can't get out what "STATIC" in linker mean.
As I understand, with static libs we should get working binary without any
dependencies? But with both STATIC and non-static I get in virtual machine:

./ccextractor: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory
./ccextractor: error while loading shared libraries: libtesseract.so.3: cannot open shared object file: No such file or directory

Can you help me?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/CCExtractor/ccextractor/issues/692#issuecomment-281697628,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFrJ2VUADEXjQd53E4xEZjIoo0R8Ac3Wks5rfFDQgaJpZM4MFEjm
.

@cfsmp3 commented on GitHub (Feb 22, 2017): I've never used CMake, this was Anshul's work I think. On Wed, Feb 22, 2017 at 7:14 AM, Evgeny Shulgin <notifications@github.com> wrote: > Also, still can't get out what "STATIC" in linker mean. > As I understand, with static libs we should get working binary without any > dependencies? But with both STATIC and non-static I get in virtual machine: > > ./ccextractor: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory > ./ccextractor: error while loading shared libraries: libtesseract.so.3: cannot open shared object file: No such file or directory > > Can you help me? > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/CCExtractor/ccextractor/issues/692#issuecomment-281697628>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AFrJ2VUADEXjQd53E4xEZjIoo0R8Ac3Wks5rfFDQgaJpZM4MFEjm> > . >
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#284