itwood / tesseract-ocr

Automatically exported from code.google.com/p/tesseract-ocr
Other
0 stars 0 forks source link

libz (zlib) and libopenjp2 (openjpg 2.x) needed to build #1436

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
=== What steps will reproduce the problem?
1. Prepare a bare-bones GNU build environment, say by using GNU Guix.
2. Add Leptonica but nothing else to the build environment.
3. Try to build.

=== What is the expected output? What do you see instead?
Expected successful build, got linker error mentioning -lz and -lopenjp2.

=== What version of the product are you using? On what operating system?
Tesseract 3.02.02, building with GNU Guix master branch (running on top of 
Debian 7.8).

=== Please provide any additional information below.
zlib and openjpg 2.x should probably also be added under "Requires" in the 
pkg-config file tesseract.pc, because trying to build VapourSynth with 
tesseract also caused the -lz and -lopenjp2 linker errors while linking in 
libocr.
I used openjpg 2.1; don't know if 2.0 works.  1.x probably doesn't work since 
it tries to link against "openjp2".

Original issue reported on code.google.com by taylanba...@gmail.com on 21 Mar 2015 at 10:42

GoogleCodeExporter commented 9 years ago
Neither libz or openjp2 is required by tesseract.
Please provide full log. 

Original comment by zde...@gmail.com on 25 Mar 2015 at 8:19

GoogleCodeExporter commented 9 years ago
Might this be a problem with Leptonica?  Perhaps it should have -lz and 
-lopenjp2 under Libs and not Libs.private in its pkg-config file lept.pc.

Failing build log from Guix is attached.

Original comment by taylanba...@gmail.com on 25 Mar 2015 at 9:21

Attachments:

GoogleCodeExporter commented 9 years ago
Declaring zlib and openjpg as "propagated inputs" of the leptonica package, 
meaning they appear in tesseract's build environment, does not solve link 
errors encountered while linking *another* library against tesseract (libocr).  
I.e. zlib and openjpg also need to appear in the build environment of that 
library.  My test case is VapourSynth, and the failing build log from Guix is 
attached.

Maybe this issue will be solved once the Requires field in tesseract.pc is 
uncommented, *and* lept.pc defines -lz and -lopenjp2 under its Libs field 
instead of Libs.private.  I suppose "pkg-config --libs tesseract" should then 
output -lz and -lopenjp2 as transitively required link flags.

Original comment by taylanba...@gmail.com on 25 Mar 2015 at 9:43

Attachments:

GoogleCodeExporter commented 9 years ago
Patching Leptonica's lept.pc to move zlib and openjpg to Libs (from 
Libs.private), patching Tesseract's tesseract.pc to enable the previously 
commented-out Requires line for "lept", making the Leptonica Guix package 
propagate zlib and openjpg to Leptonica-using build environments, and making 
the Tesseract Guix package propagate Leptonica to Tesseract-using build 
environments, made everything including VapourSynth (the end point) build fine.

Since you say Tesseract itself doesn't use zlib or openjpg, I assume this is 
the right way to fix things.

Long story short: I will send Leptonica a bug report for them to fix lept.pc, 
and you may want to edit tesseract.pc to enable the Requires line, depending on 
what versions of Leptonica you want to support.

Hope this helps! :-)

Original comment by taylanba...@gmail.com on 25 Mar 2015 at 11:03

GoogleCodeExporter commented 9 years ago
If your build system need change of tesseract.pc file please create and submit 
patch.

As far as I heard new leptonica should be released this week, so please sent 
them relevant patch ASAP.

Original comment by zde...@gmail.com on 12 Apr 2015 at 1:43

GoogleCodeExporter commented 9 years ago
Here is a patch to uncomment the Requires.private line:

Original comment by taylanba...@gmail.com on 12 Apr 2015 at 2:18

GoogleCodeExporter commented 9 years ago
Looks like the e-mail attachment didn't reach the bug tracking system, so here 
it is:

Original comment by taylanba...@gmail.com on 12 Apr 2015 at 2:20

Attachments:

GoogleCodeExporter commented 9 years ago
fixed with revision 370f1c65ad25

Original comment by zde...@gmail.com on 12 Apr 2015 at 2:39