Open fschutt opened 1 year ago
At the moment you can disable only webp
(with -DLIBWEBP_SUPPORT=OFF) and openjpeg
(-DOPENJPEG_SUPPORT=OFF).
Just for notice: jpeg
is (optional) dependency for tiff
, so error could come also from this source especially if you are making static build.
I eventually managed to disable everything by editing the source code, especially environ.h
and the Makefile (to get rid of all mentions of libjpeg, etc.). The resulting library was about 4MB for leptonica and 3MB for tesseract. It would be great if the Makefile could be edited so that it's easier to create a "headless" build.
For leptonica, a simple way to make your "headless" build is to edit only environ.h and use the static makefile, as described in the README.html.
@DanBloomberg Yeah I found it, but I'm just suggesting making those environ.h
flags configurable from the Makefile, so that it's easier to enable / disable without using sed (when using automated scripts / CI, etc.).
I plan to adjust cmake configuration, so you can choose which dependencies should be compiled.
@zdenop I also had to modify cmake/Configure.cmake
and prog/makefile.static
to completely disable linking to libpng, libtiff, libjpeg and libz: https://github.com/fschutt/tesseract-static-rs/blob/e5fffdf9fc1f5592d304ceab1237f8051535994b/build.rs#L123-L199
As you demonstrate, in addition to editing environ.h, you also need to modify the ALL_LIBS variable in prog/makefile.static. Nice use of rust!
please try with current master:
cmake -Bbuild -DBUILD_PROG=OFF -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON -DENABLE_ZLIB=OFF -DENABLE_PNG=OFF -DENABLE_GIF=OFF -DENABLE_JPEG=OFF -DENABLE_TIFF=OFF -DENABLE_WEBP=OFF -DENABLE_OPENJPEG=OFF
Hi,
I use leptonica with tesseract and I'd like to link everything statically. I use the tesseract library from the API, so I can pass in all files as .pnm (very simple file format). To make compilation simpler and to disable possible "DLL not found" errors, I'd like to disable every dependency such as dependencies on libjpeg, libpng, libgif, etc.
Currently I build
leptonica.a
with:... which links to libjpeg, etc. I try to supress this, but I don't know which flags to use. I'd like to only have PNM support (which I suppose is built-in, so no extra libs necessary for encoding / decoding images).
However, when I then build tesseract, it complains about libjpeg not being found. Is there a flag for disabling all these unnecessary image formats?