DayBreakZhang / tesseract-ocr

Automatically exported from code.google.com/p/tesseract-ocr
Other
1 stars 0 forks source link

"make install" produces "not declared in this scope" for setenv and strcasestr #1458

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. make install

What is the expected output? What do you see instead?

make[1]: Entering directory 
'/cygdrive/c/code/tools/tesseract-ocr-3.03-rc1/training'
/bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  
-O2 -DNDEBUG -DUSE_STD_NAMESPACE -DPANGO_ENABLE_ENGINE -I../ccmain -I../api 
-I../ccutil -I../ccstruct -I../viewer -I../textord -I../dict -I../classify 
-I../display -I../wordrec -I../cutil  -I/usr/local/include 
-I/usr/local/include/leptonica -D_REENTRANT -I/usr/include/pango-1.0 
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -I/usr/include/cairo 
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 
-I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/freetype2 
-I/usr/include/libpng15   -std=c++11 -MT pango_font_info.lo -MD -MP -MF 
.deps/pango_font_info.Tpo -c -o pango_font_info.lo pango_font_info.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -O2 -DNDEBUG 
-DUSE_STD_NAMESPACE -DPANGO_ENABLE_ENGINE -I../ccmain -I../api -I../ccutil 
-I../ccstruct -I../viewer -I../textord -I../dict -I../classify -I../display 
-I../wordrec -I../cutil -I/usr/local/include -I/usr/local/include/leptonica 
-D_REENTRANT -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -I/usr/include/cairo -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 
-I/usr/include/libpng15 -I/usr/include/freetype2 -I/usr/include/libpng15 
-std=c++11 -MT pango_font_info.lo -MD -MP -MF .deps/pango_font_info.Tpo -c 
pango_font_info.cpp  -DDLL_EXPORT -DPIC -o .libs/pango_font_info.o
pango_font_info.cpp: In function 'void tesseract::InitFontconfig()':
pango_font_info.cpp:151:66: error: 'setenv' was not declared in this scope
   setenv("FONTCONFIG_PATH", FLAGS_fontconfig_tmpdir.c_str(), true);
                                                                  ^
pango_font_info.cpp: In member function 'bool 
tesseract::PangoFontInfo::ParseFontDescription(const PangoFontDescription*)':
pango_font_info.cpp:219:46: error: 'strcasestr' was not declared in this scope
   is_fraktur_ = (strcasestr(family, "Fraktur") != NULL);
                                              ^
Makefile:839: recipe for target 'pango_font_info.lo' failed
make[1]: *** [pango_font_info.lo] Error 1
make[1]: Leaving directory 
'/cygdrive/c/code/tools/tesseract-ocr-3.03-rc1/training'
Makefile:890: recipe for target 'training' failed
make: *** [training] Error 2

What version of the product are you using? On what operating system?

Tesseract 3.03; Windows 7; cygwin

Please provide any additional information below.

Top portion of training/pango_font_info.cpp looks like this:

// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif

#ifdef MINGW
// workaround for stdlib.h and putenv
#undef __STRICT_ANSI__
#include "strcasestr.h"
#endif  // MINGW
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/param.h>
#include <algorithm>

#include "pango_font_info.h"
#include "commandlineflags.h"
#include "fileio.h"
#include "normstrngs.h"
#include "tlog.h"
#include "unichar.h"
#include "util.h"
#include "pango/pango-context.h"
#include "pango/pango-font.h"
#include "pango/pango-glyph-item.h"
#include "pango/pango-glyph.h"
#include "pango/pango-layout.h"
#include "pango/pango-utils.h"
#include "pango/pangocairo.h"
#include "pango/pangofc-font.h"

Original issue reported on code.google.com by izavo...@gmail.com on 20 Apr 2015 at 5:46

GoogleCodeExporter commented 9 years ago
My apologies, it's supposed to be "make training" not "make install"!

Original comment by izavo...@gmail.com on 20 Apr 2015 at 7:42

GoogleCodeExporter commented 9 years ago
1. Training is not supported on windows.
2. If you want to test/fix something, use the current code from repository (it 
should be posible to build it with msys2[1] on windows)

[1] http://sourceforge.net/projects/msys2/

Original comment by zde...@gmail.com on 21 Apr 2015 at 12:19

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Tesseract team should REALLY address in the project page and README file that 
TRAINING IS NOT SUPPORTED ON WINDOWS! What a waste of time trying to compile 
the training tool on Windows!

Is there any plan to support training on Windows?

Original comment by smwikipe...@gmail.com on 7 May 2015 at 1:54

GoogleCodeExporter commented 9 years ago
3.03 was not really released (there was on release candidate for testing).
New version of tesseract needs leptonica 1.71 but there in no official release 
of it (at least for MS Visual studio). 
Training tools need a several additional libraries (with their own 
dependencies) that are common on linux but not on windows.
So if you need Windows support it is up to you if you invest (or waste) you 
time for it. Patches (or compiled libraries) are welcomed.

Original comment by zde...@gmail.com on 8 May 2015 at 8:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have turned to use Xubuntu 15.04 to compile the training tools. I 
successfully compiled the main program tesseract with `make`. But when trying 
to `make training`, I encountered the following error:

libtool: link: 'boxchar.lo' is not a valid libtool object.

Actually, I have seen such error on MSYS2, too.

Could anyone shed some light?

Original comment by smwikipe...@gmail.com on 9 May 2015 at 3:18

Attachments:

GoogleCodeExporter commented 9 years ago
I do not use Ubuntu, but according this blog http://tomsik.eu/train_tesseract 
it should be easy.

Maybe first check if they did not included training tools to distribution.
If you anyway insist to build them from source and you still get error during 
building training tools try first this:
    cd training
    make clean
    make

Original comment by zde...@gmail.com on 9 May 2015 at 6:21

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks for your reply.

I downloaded the 3.03 rc1 source from the official Google Drive: 
https://drive.google.com/folderview?id=0B7l10Bj_LprhQnpSRkpGMGV2eE0&usp=sharing

After I configure the package, it says I can build the training tools with 
"make training". 

I remember I read somewhere that there's no pre-built 3.03 package. So I have 
to compile it from source. To be specific, I need the "text2image" tool to ease 
the tiff/box files generation. Only 3.03 contains it.

I will try your suggestion and reply soon. Thanks.

Original comment by smwikipe...@gmail.com on 10 May 2015 at 2:32

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I followed the blog you mentioned: http://tomsik.eu/train_tesseract.
And both main program and training tools are successfully built now.

Note that the downloaded source is 3.03.03, not 3.03 rc1. I am not sure if 
3.03.03 is officially released. And I want to know what the latest version is.

Since I need to use the tesseract.exe and releated dll on Windows. And the 
text2image is only available on linux. I think I will have to split the 
training process on 2 platforms.

I will try it and update later.

Original comment by smwikipe...@gmail.com on 10 May 2015 at 4:11

GoogleCodeExporter commented 9 years ago
Have a look at tesseract and tesseract-dev forums for explanation about version 
3.03 in Ubuntu (and debian?). Ubuntu 3.03.03 should be 3.03rc1 with some 
additional patches...

Original comment by zde...@gmail.com on 10 May 2015 at 10:55

GoogleCodeExporter commented 9 years ago
Hi zde..., could you take a look at the threads below? It's kind of urgent. And 
I think you have the authority to answer it. Thanks.

https://groups.google.com/forum/#!topic/tesseract-ocr/nsMOGYtVbvk

https://groups.google.com/forum/#!topic/tesseract-ocr/3efMG2VKeis

Original comment by smwikipe...@gmail.com on 12 May 2015 at 2:03