Problems with compiling Leptonica and Tesseract-ocr with Mingw+Msys

741 views
Skip to first unread message

Dominik

unread,
Sep 3, 2013, 11:28:31 AM9/3/13
to tesser...@googlegroups.com
I am trying to compile Leptonica and Tesseract with mingw+msys so i can compile and use C++ programs including Tesseract using mingw. I am total begginer with building libraries by myself (to be honest i have never built any and i was just using library built with VC++, but its not enought for me now).

All i do is based on this tutorial:

http://www.sk-spell.sk.cx/compiling-leptonica-and-tesseract-ocr-with-mingwmsys

I have built all the libraries with same versions as there is written in tutorial just not Leptonica (and Tesseract ofc), but i am not sure about giflib and libwebp libraries. That is becouse when i try to make && make install Leptonica library i get that:

(...)

*** Warning: This system can not link to static lib archive
c:/mingw/lib/libgif.la.
*** I have the capability to make that library automatically
 link in when
*** you link to this library.  But I can only do this if you
 have a
*** shared version of the library, which you do not appear t
o have.

*** Warning: This system can not link to static lib archive
c:/mingw/lib/libwebp.la.
*** I have the capability to make that library automatically
 link in when
*** you link to this library.  But I can only do this if you
 have a
*** shared version of the library, which you do not appear t
o have.

libtool: link: rm -fr  .libs/liblept.dll.a
libtool: link: gcc -shared  .libs/adaptmap.o .libs/affine.o
.libs/affinecompose.o .libs/arithlow.o .libs/arrayaccess.o .
libs/bardecode.o .libs/baseline.o .libs/bbuffer.o .libs/bili
near.o .libs/binarize.o .libs/binexpand.o .libs/binexpandlow
.o .libs/binreduce.o .libs/binreducelow.o .libs/blend.o .lib
s/bmf.o .libs/bmpio.o .libs/bmpiostub.o .libs/boxbasic.o .li
bs/boxfunc1.o .libs/boxfunc2.o .libs/boxfunc3.o .libs/boxfun
c4.o .libs/bytearray.o .libs/ccbord.o .libs/ccthin.o .libs/c
lassapp.o .libs/colorcontent.o .libs/coloring.o .libs/colorm
ap.o .libs/colormorph.o .libs/colorquant1.o .libs/colorquant
2.o .libs/colorseg.o .libs/colorspace.o .libs/compare.o .lib
s/conncomp.o .libs/convertfiles.o .libs/convolve.o .libs/con
volvelow.o .libs/correlscore.o .libs/dewarp.o .libs/dnabasic
.o .libs/dwacomb.2.o .libs/dwacomblow.2.o .libs/edge.o .libs
/enhance.o .libs/fhmtauto.o .libs/fhmtgen.1.o .libs/fhmtgenl
ow.1.o .libs/finditalic.o .libs/flipdetect.o .libs/fliphmtge
n.o .libs/fmorphauto.o .libs/fmorphgen.1.o .libs/fmorphgenlo
w.1.o .libs/fpix1.o .libs/fpix2.o .libs/gifio.o .libs/gifios
tub.o .libs/gplot.o .libs/graphics.o .libs/graymorph.o .libs
/graymorphlow.o .libs/grayquant.o .libs/grayquantlow.o .libs
/heap.o .libs/jbclass.o .libs/jpegio.o .libs/jpegiostub.o .l
ibs/kernel.o .libs/leptwin.o .libs/libversions.o .libs/list.
o .libs/maze.o .libs/morph.o .libs/morphapp.o .libs/morphdwa
.o .libs/morphseq.o .libs/numabasic.o .libs/numafunc1.o .lib
s/numafunc2.o .libs/pageseg.o .libs/paintcmap.o .libs/parsep
rotos.o .libs/partition.o .libs/pdfio.o .libs/pdfiostub.o .l
ibs/pix1.o .libs/pix2.o .libs/pix3.o .libs/pix4.o .libs/pix5
.o .libs/pixabasic.o .libs/pixacc.o .libs/pixafunc1.o .libs/
pixafunc2.o .libs/pixalloc.o .libs/pixarith.o .libs/pixcomp.
o .libs/pixconv.o .libs/pixtiling.o .libs/pngio.o .libs/pngi
ostub.o .libs/pnmio.o .libs/pnmiostub.o .libs/projective.o .
libs/psio1.o .libs/psio1stub.o .libs/psio2.o .libs/psio2stub
.o .libs/ptabasic.o .libs/ptafunc1.o .libs/ptra.o .libs/quad
tree.o .libs/queue.o .libs/rank.o .libs/readbarcode.o .libs/
readfile.o .libs/regutils.o .libs/rop.o .libs/ropiplow.o .li
bs/roplow.o .libs/rotate.o .libs/rotateam.o .libs/rotateamlo
w.o .libs/rotateorth.o .libs/rotateorthlow.o .libs/rotateshe
ar.o .libs/runlength.o .libs/sarray.o .libs/scale.o .libs/sc
alelow.o .libs/seedfill.o .libs/seedfilllow.o .libs/sel1.o .
libs/sel2.o .libs/selgen.o .libs/shear.o .libs/skew.o .libs/
spixio.o .libs/stack.o .libs/sudoku.o .libs/textops.o .libs/
tiffio.o .libs/tiffiostub.o .libs/utils.o .libs/viewfiles.o
.libs/warper.o .libs/watershed.o .libs/webpio.o .libs/webpio
stub.o .libs/writefile.o .libs/zlibmem.o .libs/zlibmemstub.o
   /usr/local/lib/libpng15.dll.a /usr/local/lib/libtiff.dll.
a -L/usr/local/lib /usr/local/lib/libjbig.dll.a /usr/local/l
ib/libjpeg.dll.a -lz -lgdi32  -O2 -Wl,--as-needed   -o .libs
/liblept-3.dll -Wl,--enable-auto-image-base -Xlinker --out-i
mplib -Xlinker .libs/liblept.dll.a
Creating library file: .libs/liblept.dll.a
.libs/gifio.o: In function `pixReadStreamGif':
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:103: undefi
ned reference to `DGifOpenFileHandle'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:108: undefi
ned reference to `DGifSlurp'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:200: undefi
ned reference to `DGifCloseFile'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:109: undefi
ned reference to `DGifCloseFile'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:122: undefi
ned reference to `DGifCloseFile'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:141: undefi
ned reference to `DGifCloseFile'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:165: undefi
ned reference to `DGifCloseFile'
.libs/gifio.o:C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio
.c:114: more undefined references to `DGifCloseFile' follow
.libs/gifio.o: In function `pixWriteStreamGif':
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:319: undefi
ned reference to `MakeMapObject'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:340: undefi
ned reference to `EGifOpenFileHandle'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:347: undefi
ned reference to `EGifPutScreenDesc'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:350: undefi
ned reference to `FreeMapObject'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:351: undefi
ned reference to `EGifCloseFile'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:328: undefi
ned reference to `FreeMapObject'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:354: undefi
ned reference to `FreeMapObject'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:356: undefi
ned reference to `EGifPutImageDesc'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:358: undefi
ned reference to `EGifCloseFile'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:398: undefi
ned reference to `EGifPutLine'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:411: undefi
ned reference to `EGifPutComment'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:417: undefi
ned reference to `EGifCloseFile'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:342: undefi
ned reference to `FreeMapObject'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:401: undefi
ned reference to `EGifCloseFile'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:366: undefi
ned reference to `EGifCloseFile'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/gifio.c:372: undefi
ned reference to `EGifCloseFile'
.libs/webpio.o: In function `pixReadStreamWebP':
C:\MinGW\msys\1.0\src\leptonica-1.69\src/webpio.c:88: undefi
ned reference to `WebPGetInfo'
C:\MinGW\msys\1.0\src\leptonica-1.69\src/webpio.c:100: undef
ined reference to `WebPDecodeRGBAInto'
.libs/webpio.o: In function `readHeaderWebP':
C:\MinGW\msys\1.0\src\leptonica-1.69\src/webpio.c:143: undef
ined reference to `WebPGetInfo'
.libs/webpio.o: In function `pixWriteStreamWebP':
C:\MinGW\msys\1.0\src\leptonica-1.69\src/webpio.c:250: undef
ined reference to `WebPEncodeRGBA'
collect2: ld returned 1 exit status
make[2]: *** [liblept.la] Error 1
make[2]: Leaving directory `/usr/src/leptonica-1.69/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/leptonica-1.69'
make: *** [all] Error 2


I think these errors occurs becouse of the previous warnings. It looks like there is no shared lib version but i build both of the libraries and they build shared libraries in default.

By the way, I think that in the tutorial  LDFLAGS="-no-undefined -Wl,--as-needed" its not proper and it should be LDFLAGS="-Wl,--no-undefined -Wl,--as-needed".

 I was trying to find some solution but no success so far. I will appreciate any help.

zdenko podobny

unread,
Sep 4, 2013, 4:43:02 PM9/4/13
to tesser...@googlegroups.com
You made several mistakes ;-):
  • you have no problem with tesseract, but you come to complain on tesseract development forum
  • you decided to use mingw, but you do not understand its messages
  • even you are total beginner with building libraries you decided to not follow tutorial (based on leptonica version I guess you use different lib versions than tutorial => you face new troubles)
Suggested solutions:
  • use correct forum - I guess mingw forum is correct one for your described problems (you are claiming that you build shared libs, but mingw is not able find them...) ;-)
  • follow tutorial punctiliously :-) If it does not work try to use other one :-)
  • skip gif and webp support in leptonica :-) you can live without it
I planned to update that tutorial 2 months age but I do not have time for that:-). As far as remember only problems were with current version of libgif (see [1][2]).

I want to make public compiled mingw version of libraries need for tesseract, but I wait for update of leptonica[3] and tesseract.



Zdenko


--
You received this message because you are subscribed to the Google Groups "tesseract-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Dominik

unread,
Sep 5, 2013, 9:20:22 AM9/5/13
to tesser...@googlegroups.com
Thank you for your reply Zdenko.

I feel sorry that you thought about my post as complaining, i didnt mean to complain on anything. I just wanted to describe the problem closely and write what i had already noticed about the problem.

I know that its not best place to seek for help with problems like mine (especially on -dev forum  - i was going to post it on -ocr, it was just a mistake) but i thought that maybe someone had similar problem as mine becouse i did the same steps as in the tutorial. Nevertheless for posting it here. For me it can be deleted.
I used the same versions of libraries - probably u meant leptonica 1.69 in my previous post. It is there becouse i wanted to check it out after i tried with leptonica 1.68 and i had same problem with both versions. Therefore i just posted messages from 1.69 build couse it was last try.

Anyway, finally i have built it succesfully without giflib and libwebp libraries as u suggested. I didnt know i can "live without it" ;) I am thankful for your help.

Reply all
Reply to author
Forward
0 new messages