qixiaobo / tesseract-ocr

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

Issues building in Debug mode with Visual Studio 2008 #388

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Build the tesseract Project in Debug mode.

What is the expected output? What do you see instead?
I expect to build tesseract with debugging enabled.
I see:
  A tool returned an error code from "Performing Pre-Build Event..."
  and a whole bunch (over 700) of warning messages.

What version of the product are you using? On what operating system?
Tesseract latest SVN version
Windows XP Pro SP3
Visual Studio 2008

Please provide any additional information below.
On Windows XP SP3, when trying to build the Tesseract latest SVN version in 
Debug Mode with Visual Studio 2008, I get:

  5>Performing Pre-Build Event...
  5>Invalid number of parameters
  5>Project : error PRJ0019: A tool returned an error code from "Performing Pre-Build Event..."

Looking at the log output I can see it's trying to do:

 xcopy /Y c:\tesseract\vs2008\\lib\leptonlibd.dll c:\tesseract\vs2008\bin.dbg\

[FIX] The tesseract Project Pre-Build Event should be changed from:

  xcopy /Y $(SolutionDir)\lib\leptonlibd.dll $(TargetDir)

to:

  xcopy /Y "$(SolutionDir)lib\leptonlibd.dll" "$(TargetDir)"

(With the double-quotes added to handle the case of spaces in directory names)

The Release mode Pre-Build Event has a similar problem.

-----

I also see a lot of warnings (over 700), which include:

warning C4018: '>=' : signed/unsigned mismatch
warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
warning C4305: 'argument' : truncation from 'double' to 'float'
warning C4800: 'BOOL8' : forcing value to bool 'true' or 'false' 
warning C4996: 'strdup': The POSIX name for this item is deprecated.

[FIX] So you might consider adding

 /wd4244 /wd4018 /wd4305 /wd4800 /wd4996

to the projects' "Configuration Properties | C/C++ | Command Line| Additional 
options" to hide these kinds of warnings so more relevant ones are easier to 
spot.

-----

After doing so I still these probably innocuous warnings:

warning C4099: 'TBOX' : type name first seen using 'class' now seen using 
'struct'    C:\tesseract\api\baseapi.h  36
warning C4355: 'this' : used in base member initializer 
list    c:\tesseract\ccstruct\ccstruct.cpp  23
warning C4627: '#include "config_auto.h"': skipped when looking for precompiled 
header use  c:\tesseract\ccstruct\labls.cpp 22
warning LNK4221: no public symbols found; archive member will be 
inaccessible    quadratc.obj    ccstruct
warning LNK4221: no public symbols found; archive member will be 
inaccessible    globals.obj cutil
warning C4101: 'next_token' : unreferenced local 
variable    c:\tesseract\ccutil\ambigs.cpp  134 ccutil
warning C4099: 'TBOX' : type name first seen using 'struct' now seen using 
'class' c:\tesseract\ccstruct\rect.h    29
warning C4101: 'i' : unreferenced local 
variable    c:\tesseract\vs2008\tessdll.cpp 148 tessdll

I had to stare at what was causing the following for a bit:

warning C4554: '<<' : check operator precedence for possible error; use 
parentheses to clarify precedence   c:\tesseract\ccutil\debugwin.cpp    104 ccutil
warning C4554: '<<' : check operator precedence for possible error; use 
parentheses to clarify precedence   c:\tesseract\ccutil\debugwin.cpp    105 ccutil

  parm = ((((uinT8) shm_mem[4] << 8) + (uinT8) shm_mem[3] << 8)
    + (uinT8) shm_mem[2] << 8) + (uinT8) shm_mem[1];

I'd be a bit surprised if this is the clearest way to do this on Windows but 
I'm not experienced enough to tell and too lazy too fix it :P .

----

http://code.google.com/p/tesseract-ocr/wiki/ReadMe says:

  For debug mode, you will have to copy the tessdata directory and all
  the dlls in the top-level directory (except tessdll.dll) to
  bin.dbg. There are no separate debug versions of these dlls.

But all I had to do was copy the tessdata directory to bin.dbg. Since 
tesseract.exe is statically linked with everything except leptonlibd.dll this 
makes sense. I'm not sure what other .dll's the ReadMe is talking about?

Switching to the bin.dbg directory and doing:

  tesseract.exe ..\..\phototest.tif phototest

results in a phototest.txt with the expected contents.

Original issue reported on code.google.com by wing...@gmail.com on 25 Oct 2010 at 8:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks. I've added double-quotes in xcopy.

Original comment by max.mar...@gmail.com on 29 Oct 2010 at 9:32

GoogleCodeExporter commented 9 years ago
If you do not want to copy tessdata to bin.dbg you can use/set enviroment 
variable TESSDATA_PREFIX

Original comment by zde...@gmail.com on 13 Nov 2010 at 9:04

GoogleCodeExporter commented 9 years ago
It's not just adding double-quotes to the xcopy command, it was the extra "\". 
You should really remove the extra slash from in front of "\lib\leptonlibd.dll".

While xcopy seems to work with c:\tesseract\vs2008\\lib\leptonlibd.dll it 
certainly looks peculiar

---

Good to know about TESSDATA_PREFIX. I suggest you add that tip to the ReadMe.

Original comment by wing...@gmail.com on 15 Nov 2010 at 5:14

GoogleCodeExporter commented 9 years ago
The issue was (in some extent) fixed. There will be new solution for version 
3.02 
((https://groups.google.com/group/tesseract-dev/browse_thread/thread/c4ce347ad02
f0c2c) improvements are welcomed.

Original comment by zde...@gmail.com on 22 Feb 2012 at 10:08