Any one successfully build Tesseract 3.0.1 under MSYS+MinGW?

1,121 views
Skip to first unread message

asmwarrior

unread,
Jan 20, 2012, 11:08:36 PM1/20/12
to tesser...@googlegroups.com
Hi, all.
I'm trying to do this, but failed.

The first thing I do is build leptonica-1.68 and installed to /mingw (the MinGW folder is mounted to /mingw under MSYS)

Then I try to run the configure under Tesseract-ocr folder, and it failed to detect the leptonica library, so I manually change the configure.ac, and set the correct path. looks like:


have_lept=no
if test "$LIBLEPT_HEADERSDIR" = "" ; then
  LIBLEPT_HEADERSDIR="/mingw/include /usr/include"
fi
for incd in $LIBLEPT_HEADERSDIR
do
  for lept in . leptonica liblept
  do
    if test -r "$incd/$lept/allheaders.h" ; then
      CPPFLAGS="$CPPFLAGS -I$incd/$lept"
      have_lept=yes
    fi
  done
done
if test "$have_lept" = yes ; then
  AC_MSG_RESULT(yes)
  AC_CHECK_LIB(lept,pixCreate,[], AC_MSG_ERROR([leptonica library missing]), [-lz])
else
  AC_MSG_ERROR([leptonica not found])
fi

Then, I just run the command:

$ make CPPFLAGS="-D__MSW32__ -D_tagBLOB_DEFINED"

The second macro definition is try to work around the BLOB definition conflict.

But later, I still failed with many build errors, like:

libtool: link: ( cd ".libs" && rm -f "libtesseract.la" && cp -p "../libtesseract.la" "libtesseract.la" )
/bin/sh ../libtool --tag=CXX   --mode=link g++  -g -O2   -o tesseract.exe tesseractmain.o libtesseract.la -llept -lpthread
libtool: link: g++ -g -O2 -o .libs/tesseract.exe tesseractmain.o  ./.libs/libtesseract.a -L./ -L../ -L../api -L../ccutil -L../viewer -L../cutil -L../image -L../ccstruct -L../dict -L../classify -L../wordrec -L../neural_networks/runtime -L../textord -L../cube -L../ccmain /mingw/lib/liblept.a -lz -lgdi32 -lpthread
tesseractmain.o: In function `main':
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:100: undefined reference to `tesseract::TessBaseAPI::TessBaseAPI()'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:102: undefined reference to `tesseract::TessBaseAPI::SetOutputName(char const*)'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:104: undefined reference to `tesseract::TessBaseAPI::Init(char const*, char const*, tesseract::OcrEngineMode, char**, int, GenericVector<STRING> const*, GenericVector<STRING> const*, bool)'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:117: undefined reference to `tesseract::TessBaseAPI::GetPageSegMode() const'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:120: undefined reference to `tesseract::TessBaseAPI::Version()'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:137: undefined reference to `STRING::STRING()'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:138: undefined reference to `tesseract::TessBaseAPI::ProcessPages(char const*, char const*, int, STRING*)'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:142: undefined reference to `tesseract::TessBaseAPI::GetBoolVariable(char const*, bool*) const'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:144: undefined reference to `tesseract::TessBaseAPI::GetBoolVariable(char const*, bool*) const'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:145: undefined reference to `STRING::STRING(char const*)'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:146: undefined reference to `STRING::operator+=(char const*)'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:147: undefined reference to `STRING::string() const'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:152: undefined reference to `STRING::length() const'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:152: undefined reference to `STRING::string() const'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:145: undefined reference to `STRING::~STRING()'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:137: undefined reference to `STRING::~STRING()'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:100: undefined reference to `tesseract::TessBaseAPI::~TessBaseAPI()'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:118: undefined reference to `tesseract::TessBaseAPI::SetPageSegMode(tesseract::PageSegMode)'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:149: undefined reference to `STRING::string() const'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:137: undefined reference to `STRING::~STRING()'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:100: undefined reference to `tesseract::TessBaseAPI::~TessBaseAPI()'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:56: undefined reference to `tesseract::TessBaseAPI::Version()'
e:\project\ch\tesseract-3.01\api/../api/tesseractmain.cpp:145: undefined reference to `STRING::~STRING()'
collect2: ld returned 1 exit status
make[2]: *** [tesseract.exe] Error 1
make[2]: Leaving directory `/e/project/ch/tesseract-3.01/api'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/e/project/ch/tesseract-3.01'
make: *** [all] Error 2


Hope someone can help me.

Thank you.
 

 

Wil Hadden

unread,
Feb 3, 2012, 6:32:44 AM2/3/12
to tesseract-ocr
Sorry to get back late on this. I have got mingw scripts that build
3.01 using the android ndk. I can furnish you with the scripts if you
are interested / still need them.

Wil

asmwarrior

unread,
Feb 8, 2012, 1:23:33 AM2/8/12
to tesser...@googlegroups.com
Hi, Wil.

Thanks.

Can you share the scripts? I would try it again under mingw.
I'm not sure your sentence" I have got mingw scripts that build
3.01 using the android ndk" means? Do you mean this is only for android???

asmwarrior

Wil Hadden

unread,
Feb 8, 2012, 11:22:27 AM2/8/12
to tesseract-ocr
Hi,

I'll zip up the scripts and send them to your gmail account tonight.

The scripts are used to build a .so library that runs on an android
phone, but the way I have written them means it is easy to configure
them to run for any version of gcc, well in theory anyway!

Wil

zdenko podobny

unread,
Feb 8, 2012, 4:47:17 PM2/8/12
to tesser...@googlegroups.com
Hi,


I was/am testing building tesseract by cmake... just with intention to have one build systems for linux, windows and possibly Mac (but I have no Mac computer for testing ;-)

I created script (CMakeLists.txt) that was able to compile tesseract (3.02) on linux and windows (mingw32 and nmake from vs2008).

BUT mingw version was not able to run ("The application failed to initialize properly (0xc000007b)...". When I search why, I identify there is problem with usage leptonica library (build by VS2008) in mingw...

Today I remembered that in my older tests (https://github.com/zdenop/QT-Leptonica) Qt Creator was able to use leptonica (VS2008 build) in mingw without problem. So I tried to compile project in QT Creator and it works (also outside QT Creator) ;-) I guess it is should be question of some mingw options (help is welcomed).

Result can be found in above mentioned repository. I had not time for testing - I just tried to use tesseract.exe and create test/example for using tesseract c++ library.

Zdenko



--
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to tesser...@googlegroups.com
To unsubscribe from this group, send email to
tesseract-oc...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en

Wil Hadden

unread,
Feb 8, 2012, 5:42:40 PM2/8/12
to tesseract-ocr
I will forward you the scripts I use in mingw as well, though I'm not
sure how much help it will be!

Wil

On Feb 8, 9:47 pm, zdenko podobny <zde...@gmail.com> wrote:
> Hi,
>
> Have a look athttps://github.com/zdenop/tesseract-mingw
> > **

asmwarrior

unread,
Feb 12, 2012, 12:40:10 AM2/12/12
to tesser...@googlegroups.com


On Thursday, February 9, 2012 5:47:17 AM UTC+8, zdpo wrote:
Hi,


I was/am testing building tesseract by cmake... just with intention to have one build systems for linux, windows and possibly Mac (but I have no Mac computer for testing ;-)

I created script (CMakeLists.txt) that was able to compile tesseract (3.02) on linux and windows (mingw32 and nmake from vs2008).

BUT mingw version was not able to run ("The application failed to initialize properly (0xc000007b)...". When I search why, I identify there is problem with usage leptonica library (build by VS2008) in mingw...

Today I remembered that in my older tests (https://github.com/zdenop/QT-Leptonica) Qt Creator was able to use leptonica (VS2008 build) in mingw without problem. So I tried to compile project in QT Creator and it works (also outside QT Creator) ;-) I guess it is should be question of some mingw options (help is welcomed).

Result can be found in above mentioned repository. I had not time for testing - I just tried to use tesseract.exe and create test/example for using tesseract c++ library.

Zdenko


Hi, Zdenko, thank you very much. I just clone your github, and I use Codeblocks and MinGW 4.6.3 to create a very simple console project, and it works FINE!! Thanks.

@Wil Hadden:
Thanks for sending your build scripts for android(mingw), but I'm not a makefile or autotools guru, so I can't manually change the files for native mingw. Anyway, very thanks to your help.

Another thing about Zdenko's package, I see some files like "libgcc_s_dw2-1.dll" and "libstdc++-6.dll", I'm not sure which mingw version did you use? The official mingw 4.6.x or TDM-GCC or other mingw version? I believe that if you add some compiler options, like "static" or other options, you can build the "libtesseract_302.dll" with statically link to gcc and libstdc++ libraries, so, these dll dependencies can be removed.

Thank you all!

Asmwarrior
ollydbg from codeblocks' forum

zdenko podobny

unread,
Feb 12, 2012, 8:14:53 AM2/12/12
to tesser...@googlegroups.com
  1. As I mentioned I build it within QT Creator (2.3.0) that comes with mingw (3.15.2 according _mingw.h)
  2. I am not sure if you really need libgcc_s_dw2-1.dll and libstdc++-6.dll. But when I am set empty path (SET path="") on windows to see if my test application do not use something else, it asked for these dll. So I you have installed mingw it should use dll from your installation...
  3. This is experimental build system for tesseract ;-) There is a lot of things that should be done not only static linking... Improvement are welcomed. But for me this is just alternative for testing if VS2008 build system is correct...
 Zdenko

Thank you all!

Asmwarrior
ollydbg from codeblocks' forum

--

santiago

unread,
Feb 12, 2012, 3:25:17 PM2/12/12
to tesser...@googlegroups.com

٩١#2/02/2012 13:40, "asmwarrior"٩٦ <asmwa...@gmail.com> escribió:
>
> Hi, all.
> I'm trying to do this, but failed.
>
> The first thing I do is build leptonica-1.68 and installed to /mingw (the MinGW folder is mounted to /mingw under MSYS)
>

> Then I try to run the configure٦٠ under Tesseract-ocr folder, and it failed to detect the leptonica library, so I manually change the configure.ac, and set the correct path. looks like:

Reply all
Reply to author
Forward
0 new messages