DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.76k stars 387 forks source link

Failed to build Leptonica in local directory. #526

Open fireflyHunter opened 4 years ago

fireflyHunter commented 4 years ago

Platform is x86_64 GNU/Linux.

After cloning the project from git I did following try to build it in the local directory. (without root access)

I first create a folder "local" under $HOME, then enter leptonica directory:

./autogen.sh
./configure --prefix=$HOME/local/
make install

Then it shows the following when I run make check:

FAIL: adaptmap_reg
FAIL: adaptnorm_reg
FAIL: affine_reg
FAIL: alphaops_reg
FAIL: alphaxform_reg
FAIL: baseline_reg
FAIL: bilateral2_reg
FAIL: bilinear_reg
FAIL: binarize_reg
FAIL: binmorph1_reg
FAIL: binmorph3_reg
PASS: blackwhite_reg
FAIL: blend1_reg
FAIL: blend2_reg
FAIL: blend3_reg
FAIL: blend4_reg
FAIL: blend5_reg
PASS: boxa1_reg
PASS: boxa2_reg
PASS: boxa3_reg
FAIL: boxa4_reg
SKIP: bytea_reg
FAIL: ccbord_reg
FAIL: ccthin1_reg
FAIL: ccthin2_reg
FAIL: checkerboard_reg
PASS: circle_reg
FAIL: cmapquant_reg
FAIL: colorcontent_reg
FAIL: colorfill_reg
PASS: coloring_reg
FAIL: colorize_reg
PASS: colormask_reg
FAIL: colormorph_reg
FAIL: colorquant_reg
FAIL: colorseg_reg
FAIL: colorspace_reg
FAIL: compare_reg
FAIL: compfilter_reg
FAIL: conncomp_reg
FAIL: conversion_reg
FAIL: convolve_reg
FAIL: crop_reg
FAIL: dewarp_reg
FAIL: distance_reg
FAIL: dither_reg
PASS: dna_reg
FAIL: dwamorph1_reg
FAIL: edge_reg
FAIL: enhance_reg
FAIL: equal_reg
FAIL: expand_reg
PASS: extrema_reg
PASS: falsecolor_reg
FAIL: fhmtauto_reg
FAIL: findcorners_reg
PASS: findpattern_reg
FAIL: fpix1_reg
FAIL: fpix2_reg
FAIL: genfonts_reg
PASS: grayfill_reg
FAIL: graymorph1_reg
FAIL: graymorph2_reg
FAIL: grayquant_reg
FAIL: hardlight_reg
FAIL: hash_reg
PASS: heap_reg
FAIL: insert_reg
PASS: ioformats_reg
FAIL: iomisc_reg
PASS: italic_reg
FAIL: jbclass_reg
PASS: jpegio_reg
FAIL: kernel_reg
FAIL: label_reg
PASS: lineremoval_reg
FAIL: locminmax_reg
FAIL: logicops_reg
FAIL: lowaccess_reg
FAIL: lowsat_reg
FAIL: maze_reg
FAIL: mtiff_reg
PASS: multitype_reg
FAIL: nearline_reg
FAIL: newspaper_reg
FAIL: numa1_reg
FAIL: numa2_reg
FAIL: numa3_reg
PASS: overlap_reg
SKIP: pageseg_reg
FAIL: paint_reg
FAIL: paintmask_reg
SKIP: pdfio1_reg
SKIP: pdfio2_reg
SKIP: pdfseg_reg
PASS: pixa1_reg
FAIL: pixa2_reg
FAIL: pixadisp_reg
FAIL: pixcomp_reg
FAIL: pixmem_reg
FAIL: pixserial_reg
FAIL: pngio_reg
FAIL: pnmio_reg
FAIL: projection_reg
FAIL: projective_reg
SKIP: psio_reg
SKIP: psioseg_reg
FAIL: pta_reg
FAIL: ptra1_reg
FAIL: ptra2_reg
PASS: quadtree_reg
FAIL: rankbin_reg
FAIL: rankhisto_reg
FAIL: rank_reg
FAIL: rasteropip_reg
FAIL: rasterop_reg
FAIL: rectangle_reg
FAIL: rotate1_reg
FAIL: rotate2_reg
FAIL: rotateorth_reg
FAIL: scale_reg
PASS: seedspread_reg
PASS: selio_reg
FAIL: shear1_reg
PASS: shear2_reg
FAIL: skew_reg
PASS: smallpix_reg
FAIL: speckle_reg
PASS: splitcomp_reg
PASS: string_reg
FAIL: subpixel_reg
FAIL: texturefill_reg
FAIL: threshnorm_reg
PASS: translate_reg
FAIL: warper_reg
PASS: watershed_reg
FAIL: wordboxes_reg
FAIL: writetext_reg
FAIL: xformbox_reg
make[4]: Entering directory `/home/hao/leptonica/prog'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory `/home/hao/leptonica/prog'
============================================================================
Testsuite summary for leptonica 1.80.0
============================================================================
# TOTAL: 139
# PASS:  29
# SKIP:  7
# XFAIL: 0
# FAIL:  103
# XPASS: 0
# ERROR: 0

I tried different versions of leptonica, no luck. First few lines of test-suite.log are:

leptonica-1.80.0 : libpng 1.5.13 : zlib 1.2.7
Error in pixReadStreamJpeg: function not present
Error in pixReadStream: jpeg: no pix returned
Error in pixRead: pix not read
Error in pixConvertRGBToGray: pixs not defined
Error in pixaAddPix: pix not defined
Error in pixaAddPix: pix not defined
Error in pixGetDimensions: pix not defined
Error in pixCreateHeader: width must be > 0
Error in pixCreateNoInit: pixd not made
Error in pixCreate: pixd not made
Error in pixRasterop: pixd not defined
Error in pixGetBackgroundGrayMap: pixs not defined or not 8 bpp
Time for gray adaptmap gen:   0.000
Error in regTestWritePixAndCheck: pix not defined
Error in pixaAddPix: pix not defined
Error in pixGetInvBackgroundMap: pixs undefined or not 8 bpp
Time for gray inv map generation:   0.000
Error in regTestWritePixAndCheck: pix not defined
Error in pixaAddPix: pix not defined
Error in pixApplyInvBackgroundGrayMap: pixs undefined or not 8 bpp
Time to apply gray inv map:   0.000
Error in regTestWritePixAndCheck: pix not defined
Error in pixaAddPix: pix not defined
Error in pixGammaTRC: pixs not defined
Error in pixInvert: pixs not defined
Error in pixGammaTRC: pixs not defined
Error in regTestWritePixAndCheck: pix not defined
Error in pixaAddPix: pix not defined

Anyone have solution on this?

DanBloomberg commented 4 years ago

The good news is that 29 of the tests passed ;-)

Just kidding. You need to have libjpeg and libtiff. Without them, there are likely to be a lot of failures.

fireflyHunter commented 4 years ago

The good news is that 29 of the tests passed ;-)

Just kidding. You need to have libjpeg and libtiff. Without them, there are likely to be a lot of failures.

Thank you for your reply! As you instructed I installed libjpeg and libtiff in $HOME/local/bin. Then it still gives me same error info when I build leptonica. I checked that both libjpeg and libtiff is working fine. Should I specify path of libjpeg and libtiff when configuring leptonica build?

DanBloomberg commented 4 years ago

You need to make sure that your newly installed libraries are in directories that are in either the LDFLAGS list or the list of directories in the LD_LIBRARY_PATH environment variable. See the README.html file.

fireflyHunter commented 4 years ago

According to the README file

These libraries (and their shared versions) should be in /usr/lib. (If they're not, you can change the LDFLAGS variable in the makefile.) Additionally, for compilation, the following header files are assumed to be in /usr/include: jpeg: jconfig.h png: png.h, pngconf.h tiff: tiff.h, tiffio.h

I first tried to edit LDFLAG in the makefile, but I am not sure which makefile is it (there are /prog/Makefile and /prog/makefile.static), I only found LDFLAGS variable in /prog/makefile.static. LDFLAGS += -L$(LIB_DIR) -L/usr/X11R6/lib -L$HOME/local/lib $(EXTRALIBS) Then I add the dir to this variable and try make install but still fail (same 29 cases pass)

I also tried export LD_LIBRARY_PATH with local dir appended before ./configure, still no luck.

DanBloomberg commented 4 years ago

you will see in the README.html that you have 3 ways to build the library.

You can use the static makefiles (which you may need to edit depending on which I/O libraries you have). You run make-for-local first, then type make

Or using autoconf as you tried.

Or using cmake. See README for that as well. I'd recommend trying this. It should be able to tell you if it can't find libraries.

stweil commented 3 years ago

@fireflyHunter, could you solve your problem? Normally it is not necessary to install additional software in /usr/local. Just make sure that the development packages for JPEG and TIFF which are provided by your Linux distribution are installed. There are other graphic libraries which can also be installed to support JPEG2000 and more formats.