{"id":1436,"status":"Fixed","summary":"libz (zlib) and libopenjp2 (openjpg 2.x) needed to build","labels":[],"stars":0,"commentCount":9,"comments":[{"id":0,"commenterId":-6307396659764036835,"content":"\u003d\u003d\u003d What steps will reproduce the problem?\r\n1. Prepare a bare-bones GNU build environment, say by using GNU Guix.\r\n2. Add Leptonica but nothing else to the build environment.\r\n3. Try to build.\r\n\r\n\u003d\u003d\u003d What is the expected output? What do you see instead?\r\nExpected successful build, got linker error mentioning -lz and -lopenjp2.\r\n\r\n\u003d\u003d\u003d What version of the product are you using? On what operating system?\r\nTesseract 3.02.02, building with GNU Guix master branch (running on top of Debian 7.8).\r\n\r\n\u003d\u003d\u003d Please provide any additional information below.\r\nzlib and openjpg 2.x should probably also be added under \u0026quot;Requires\u0026quot; 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.\r\nI used openjpg 2.1; don\u0027t know if 2.0 works.  1.x probably doesn\u0027t work since it tries to link against \u0026quot;openjp2\u0026quot;.","timestamp":1426977735,"attachments":[]},{"id":1,"commenterId":9136543559734422877,"content":"Neither libz or openjp2 is required by tesseract.\r\nPlease provide full log. ","timestamp":1427271597,"attachments":[]},{"id":2,"commenterId":-6307396659764036835,"content":"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.\r\n\r\nFailing build log from Guix is attached.","timestamp":1427275290,"attachments":[{"id":14360002000,"fileName":"tesseract-guix-log.txt","fileSize":376776}]},{"id":3,"commenterId":-6307396659764036835,"content":"Declaring zlib and openjpg as \"propagated inputs\" of the leptonica package, meaning they appear in tesseract\u0027s 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.\r\n\r\nMaybe 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.","timestamp":1427276607,"attachments":[{"id":14360003000,"fileName":"vapoursynth-guix-log.txt","fileSize":39649}]},{"id":4,"commenterId":-6307396659764036835,"content":"Patching Leptonica\u0027s lept.pc to move zlib and openjpg to Libs (from Libs.private), patching Tesseract\u0027s 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.\r\n\r\nSince you say Tesseract itself doesn\u0027t use zlib or openjpg, I assume this is the right way to fix things.\r\n\r\nLong 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.\r\n\r\nHope this helps! :-)","timestamp":1427281396,"attachments":[]},{"id":5,"commenterId":9136543559734422877,"content":"If your build system need change of tesseract.pc file please create and submit patch.\r\n\r\nAs far as I heard new leptonica should be released this week, so please sent them relevant patch ASAP.","timestamp":1428846184,"attachments":[]},{"id":6,"commenterId":-6307396659764036835,"content":"Here is a patch to uncomment the Requires.private line:","timestamp":1428848286,"attachments":[]},{"id":7,"commenterId":-6307396659764036835,"content":"Looks like the e-mail attachment didn\u0027t reach the bug tracking system, so here it is:","timestamp":1428848408,"attachments":[{"id":14360007000,"fileName":"0001-Uncomment-Requires.private-line-in-leptonica.pc.in-f.patch","fileSize":846}]},{"id":8,"commenterId":9136543559734422877,"content":"fixed with revision 370f1c65ad25","timestamp":1428849548,"attachments":[]}]}