Package: tesseract
Version: 1.02-3
Tags: patch

Your package fails to build with recent versions of the gcc-snapshot
package, i.e. a pre-release of GCC 4.2.  The problem is that external
variables are defined both in a C and C++ context, as you can see in
this simple example:

42059:[EMAIL PROTECTED]: ~] /usr/lib/gcc-snapshot/bin/g++ -c t.cc
t.cc:1: error: previous declaration of 'int i' with 'C++' linkage
t.cc:4: error: conflicts with new declaration with 'C' linkage
42060:[EMAIL PROTECTED]: ~] cat t.cc
extern int i;

extern "C" {
        extern int i;
}

According to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27227#c8 this
is not valid.

A patch is below, although it's possible you could solve this in a
nicer way.  I didn't spend much time on it.

> Automatic build of tesseract_1.02-3 on em64t by sbuild/amd64 0.52
...
>       x86_64-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I..  -I../ccstruct 
> -I../ccutil -I../cutil -I../classify -I../image -I../dict -I../viewer   -Wall 
> -DTESSDATA_PREFIX=/usr/share/tesseract-ocr/ -DNDEBUG -O2 -Wall -c -o tface.o 
> `test -f 'tface.cpp' || echo './'`tface.cpp
> In file included from /usr/include/unistd.h:783,
>                  from tface.cpp:47:
> ../cutil/globals.h:46: error: previous declaration of 'int optind' with 'C++' 
> linkage
> ../ccutil/getopt.h:23: error: conflicts with new declaration with 'C' linkage
> ../cutil/globals.h:47: error: previous declaration of 'char* optarg' with 
> 'C++' linkage
> ../ccutil/getopt.h:24: error: conflicts with new declaration with 'C' linkage
> make[4]: *** [tface.o] Error 1
> make[4]: Leaving directory `/build/tbm/tesseract-1.02/wordrec'


--- ./cutil/tordvars.h~ 2007-02-04 16:18:12.000000000 +0000
+++ ./cutil/tordvars.h  2007-02-04 16:19:07.000000000 +0000
@@ -39,6 +39,8 @@
 extern FILE *correct_fp;         //correct text
 extern FILE *matcher_fp;
 
+extern "C"
+{
 extern int blob_skip;            /* Skip to next selection */
 extern int num_word_choices;     /* How many words to keep */
 extern int similarity_enable;    /* Switch for Similarity */
@@ -49,6 +51,7 @@
 extern int show_bold;            /* Use bold text */
 extern int display_text;         /* Show word text */
 extern int display_blocks;       /* Show word as boxes */
+}
 
 extern float overlap_threshold;  /* Overlap Threshold */
 extern float certainty_threshold;/* When to quit looking */
--- ./cutil/globals.h~  2007-02-04 16:17:07.000000000 +0000
+++ ./cutil/globals.h   2007-02-04 16:17:54.000000000 +0000
@@ -43,9 +43,15 @@
 extern int debugs[MAXPROC];      /*debug flags */
 extern int plots[MAXPROC];       /*plot flags */
 extern int corners[4];           /*corners of scan window */
+#ifdef __cplusplus
+extern "C" {
+#endif
 extern int optind;               /*option index */
 extern char *optarg;             /*option argument */
                                  /*image file name */
+#ifdef __cplusplus
+}
+#endif
 extern char imagefile[FILENAMESIZE];
                                  /* main directory */
 extern char directory[FILENAMESIZE];

-- 
Martin Michlmayr
http://www.cyrius.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to