Package: ocropus
Version: 0.3.1-3
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch precise

ocropus failed to build from source in the current Ubuntu development
release.  Here's the relevant part of the build log:

  if g++ -DPACKAGE_NAME=\"ocropus\" -DPACKAGE_TARNAME=\"ocropus\" 
-DPACKAGE_VERSION=\"0.3\" -DPACKAGE_STRING=\"ocropus\ 0.3\" 
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"ocropus\" 
-DVERSION=\"0.3\" -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_SYS_TYPES_H=1 
-DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 
-DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 
-DHAVE_FLOAT_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDLIB_H=1 
-DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_WCHAR_H=1 -DHAVE_LIBZ=1 
-DHAVE_LIBPNG=1 -DHAVE_LIBJPEG=1 -DHAVE_LIBTIFF=1 -DHAVE_LIBIULIB=1 
-DHAVE_LIBPTHREAD=1 -DHAVE_LIBTESSERACT_FULL=1 -DHAVE_FORK=1 -DHAVE_VFORK=1 
-DHAVE_WORKING_VFORK=1 -DHAVE_WORKING_FORK=1 -DHAVE_DUP2=1 -DHAVE_MEMSET=1 
-DHAVE_SQRT=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRRCHR=1 -I. -I.  
-I./ext/voronoi -I./ocr-langmods -I./ocr-binarize -I./ocr-bpnet 
-I./ocr-deskew-rast -I./ocr-doc-clean -I./ocr-layout-rast -I./ocr-pageseg 
-I./ocr-samples -I./ocr-utils -I/usr/include/iulib -I/usr/include/colib 
-I/usr/include/colib/..  -I./ocr-tesseract -I/usr/include/tesseract 
-DHAVE_TESSERACT    -g -O2 -fstack-protector --param=ssp-buffer-size=4 
-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -MT 
bpnet.o -MD -MP -MF ".deps/bpnet.Tpo" -c -o bpnet.o `test -f 
'./ocr-bpnet/bpnet.cc' || echo './'`./ocr-bpnet/bpnet.cc; \
          then mv -f ".deps/bpnet.Tpo" ".deps/bpnet.Po"; else rm -f 
".deps/bpnet.Tpo"; exit 1; fi
  ./ocr-bpnet/bpnet.cc: In member function 'virtual void 
iupr_bpnet::BpnetClassifier::score(colib::floatarray&, colib::floatarray&)':
  ./ocr-bpnet/bpnet.cc:401:17: warning: 'void 
ocropus::normalize_input_classify(colib::floatarray&, colib::doublearray&, 
colib::doublearray&)' is deprecated (declared at ./ocr-utils/ocr-utils.h:167) 
[-Wdeprecated-declarations]
  ./ocr-bpnet/bpnet.cc:401:53: warning: 'void 
ocropus::normalize_input_classify(colib::floatarray&, colib::doublearray&, 
colib::doublearray&)' is deprecated (declared at ./ocr-utils/ocr-utils.h:167) 
[-Wdeprecated-declarations]
  ./ocr-bpnet/bpnet.cc: In member function 'void 
iupr_bpnet::BpnetClassifier::logging_train_test(const char*, float, float, 
iupr_bpnet::ConfusionMatrix&, int, float, float)':
  ./ocr-bpnet/bpnet.cc:526:31: error: format not a string literal and no format 
arguments [-Werror=format-security]
  ./ocr-bpnet/bpnet.cc: In member function 'void 
iupr_bpnet::BpnetClassifier::train()':
  ./ocr-bpnet/bpnet.cc:559:31: error: format not a string literal and no format 
arguments [-Werror=format-security]
  ./ocr-bpnet/bpnet.cc:563:31: error: format not a string literal and no format 
arguments [-Werror=format-security]
  ./ocr-bpnet/bpnet.cc:573:31: error: format not a string literal and no format 
arguments [-Werror=format-security]
  ./ocr-bpnet/bpnet.cc:595:35: error: format not a string literal and no format 
arguments [-Werror=format-security]

This doesn't currently happen in unstable because ocropus isn't using
the output of dpkg-buildflags
(http://lists.debian.org/debian-devel-announce/2011/09/msg00001.html),
but that will be a problem once you enable this.  Here's a patch to fix
the build under -Werror=format-security.

  * Appease gcc -Werror=format-security.

diff -Nru ocropus-0.3.1/debian/patches/format-security.diff 
ocropus-0.3.1/debian/patches/format-security.diff
--- ocropus-0.3.1/debian/patches/format-security.diff   1970-01-01 
01:00:00.000000000 +0100
+++ ocropus-0.3.1/debian/patches/format-security.diff   2011-10-19 
12:27:25.000000000 +0100
@@ -0,0 +1,72 @@
+Description: Appease gcc -Werror=format-security
+Author: Colin Watson <cjwat...@ubuntu.com>
+Forwarded: no
+Last-Update: 2011-10-19
+
+Index: b/ocr-bpnet/bpnet.cc
+===================================================================
+--- a/ocr-bpnet/bpnet.cc
++++ b/ocr-bpnet/bpnet.cc
+@@ -523,7 +523,7 @@
+                                                 " for epoch %d",ep);
+                 logger_confusion_test.confusion(cm);
+             }
+-            printf(temp_string);logger_errors(temp_string);
++            fputs(temp_string, stdout);logger_errors(temp_string);
+         }
+ 
+ 
+@@ -556,11 +556,11 @@
+ 
+             sprintf(temp_string, "ep:%d nh:%d lr:%g tp:%g np:%d i:%d o:%d\n",
+                     epochs,nhidden,learningrate,testportion,n,ninput,noutput);
+-            printf(temp_string);logger_errors(temp_string);
++            fputs(temp_string, stdout);logger_errors(temp_string);
+ 
+             sprintf(temp_string, "=== Start training on %d samples "
+                     "(testing on %d) for %d epochs 
===\n",ntrain,ntest,epochs);
+-            printf(temp_string);logger_errors(temp_string);
++            fputs(temp_string, stdout);logger_errors(temp_string);
+ 
+             //local copy of the current mlp
+             floatarray weights_hidden_input_temp;
+@@ -570,7 +570,7 @@
+ 
+             float old_train_error = 0.0f;
+             sprintf(temp_string, "Epoch: %d\tLR: %f\n\n",0,learningrate);
+-            printf(temp_string);logger_errors(temp_string);
++            fputs(temp_string, stdout);logger_errors(temp_string);
+ 
+             test_on_db(0,ntrain,train_error,train_cls_error,*confusion_train);
+             old_train_error = best_train_error = train_error;
+@@ -592,7 +592,7 @@
+ 
+             for(int epoch=0;epoch<epochs;epoch++) {
+                 sprintf(temp_string, "Epoch: %d\tLR: 
%f\n",epoch+1,learningrate);
+-                printf(temp_string);logger_errors(temp_string);
++                fputs(temp_string, stdout);logger_errors(temp_string);
+                 //confusion_test->printReduced(stdout);
+                 //keep current network in memory
+                 copy(weights_hidden_input_temp, weights_hidden_input);
+Index: b/ocr-utils/logger.cc
+===================================================================
+--- a/ocr-utils/logger.cc
++++ b/ocr-utils/logger.cc
+@@ -433,7 +433,7 @@
+                     if(((trans_t(i)-prev_t(i)) == size) &&
+                         (prev_t(i)%size == indent) && (trans==prev_t(i))) {
+                         sprintf(temp,"<td valign=\"top\" 
colspan=%d><center>",size);
+-                        fprintf(get_log()->file, temp);
++                        fputs(temp, get_log()->file);
+                         if(id_t(i) == 0) {                              // 
special case: id=0 means white space or \n
+                             fprintf(get_log()->file, "<br>White Space");
+                         } else {
+@@ -449,7 +449,7 @@
+                             sprintf(temp, "<td><font 
size=\"-1\">%s</font></td><td>"
+                                 "<font size=\"-1\">%.3f</font></td></tr>", 
buf, cost_t(i+j));
+                             delete[] buf;
+-                            fprintf(get_log()->file, temp);
++                            fputs(temp, get_log()->file);
+                             if ((i+j+1>=n) || (cuts(i+j+1) == 0)) {
+                                 break;                  // cannot display 
more than possible number of transitions
+                             }
diff -Nru ocropus-0.3.1/debian/patches/series 
ocropus-0.3.1/debian/patches/series
--- ocropus-0.3.1/debian/patches/series 2010-04-27 20:41:53.000000000 +0100
+++ ocropus-0.3.1/debian/patches/series 2011-10-19 11:27:33.000000000 +0100
@@ -1,3 +1,4 @@
 usr-local.diff
 ocrodata-env.diff
 system-lua.diff
+format-security.diff

Thanks,

-- 
Colin Watson                                       [cjwat...@ubuntu.com]



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to