Menu

#23 Build failure with GOCR: thread-local declaration of 'job_t* OCR_JOB' follows non-thread-local declaration

v1.3.7
open
nobody
None
5
2025-04-30
2025-04-28
No

When building OSRA 2.2.1 on Debian Unstable with GOCR 0.52 I ran into the following build failure:

configure:11344: error: GOCR API check failed; make sure you have installed libgocr-dev package or check config.log

Inspecting the build log I think this is the relevant part:

configure:11189: checking for -lPgm2asc
configure:11239: g++ -o conftest -g -O2 -ffile-prefix-map=/home/andrius/debian-packages/osra-2.2.1=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -I/usr/incl
ude/GraphicsMagick -I/usr/include/openbabel3 -I/usr/include/gocr -I/usr/local/include -Wdate-time -DFORTIFYSOURCE=2 -L/usr/local/lib -Wl,-z,relro conftest.cpp -lPgm2asc -lGraphicsMagick -lGraphicsMagick++ -lo
penbabel -lpoppler-cpp -lpoppler -lfontconfig -lfreetype -lpthread -locrad -lpotrace -lm -lpng >&5
In file included from /usr/include/gocr/pnm.h:14,
from /usr/include/gocr/pgm2asc.h:26,
from conftest.cpp:44:
/usr/include/gocr/config.h:50:9: warning: "PACKAGENAME" redefined
50 | #define PACKAGENAME "gocr"
| ^~~~~~~~~~~~
conftest.cpp:2:9: note: this is the location of the previous definition
2 | #define PACKAGENAME "osra"
| ^~~~~~~~~~~~
/usr/include/gocr/config.h:53:9: warning: "PACKAGESTRING" redefined
53 | #define PACKAGESTRING "gocr 0.52"
| ^~~~~~~~~~~~~~
conftest.cpp:5:9: note: this is the location of the previous definition
5 | #define PACKAGESTRING "osra 2.2.1"
| ^~~~~~~~~~~~~~
/usr/include/gocr/config.h:56:9: warning: "PACKAGETARNAME" redefined
56 | #define PACKAGETARNAME "gocr"
| ^~~~~~~~~~~~~~~
conftest.cpp:3:9: note: this is the location of the previous definition
3 | #define PACKAGETARNAME "osra"
| ^~~~~~~~~~~~~~~
/usr/include/gocr/config.h:62:9: warning: "PACKAGEVERSION" redefined
62 | #define PACKAGEVERSION "0.52"
| ^~~~~~~~~~~~~~~
conftest.cpp:4:9: note: this is the location of the previous definition
4 | #define PACKAGEVERSION "2.2.1"
| ^~~~~~~~~~~~~~~
conftest.cpp:47:25: error: thread-local declaration of 'jobt OCRJOB' follows non-thread-local declaration
47 | thread jobt OCRJOB, JOB;
| ^~~~~~~
In file included from /usr/include/gocr/output.h:27,
from /usr/include/gocr/pgm2asc.h:27:
/usr/include/gocr/gocr.h:201:15: note: 'jobt OCRJOB' previously declared here
201 | extern jobt OCRJOB;
| ^~~~~~~
configure:11239: $? = 1***

I do not know much about C++ nor threading, but it seems that GOCR lacks thread.

Discussion

  • Igor

    Igor - 2025-04-28

    The recommended way to build OSRA from source is to use patched GOCR source code from
    https://sourceforge.net/projects/osra/files/gocr-patched/
    When compiling GOCR please make sure to run "make libs" to actually build GOCR library.
    By default only gocr executable is built.

     
    • Andrius Merkys

      Andrius Merkys - 2025-04-30

      Thanks. Is it still possible to use OSRA with unpatched GOCR? Are the changes in the patched version substantial, or just concerning threading support?

       
  • Igor

    Igor - 2025-04-30

    The changes in GOCR are concerned not with threading support but with building it as a library.
    You are welcome to try building from an unpatched source of course.

     

Log in to post a comment.

MongoDB Logo MongoDB