-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segmentation fault when initializing with null language #4028
Comments
The API was changed by my commit f5d22d0 ("Don't set a default language in TessBaseAPI::Init"). The reason for that commit was that Tesseract required (and loaded) So the documentation should be updated, and of course the code should not crash. |
The right form is |
Why? |
Including Leptonica tells the compiler to look for header files in the
Including |
The PR has more details: #3610 |
@stweil : Who leptonica is build on MacOS with Homebrew? With autotool or cmake? On Windows cmake build with custom instalation I got this:
IMO this is right approach, so developer could use both variants. Personally I prefer |
Homebrew uses autotools for all platforms in its tesseract formula. I am surprised that pkgconfig gives two include paths for the Leptonica headers. That's strange and unusual. |
@DanBloomberg, there seem to exist two different conventions how people include the header file for Leptonica:
Which of the two variants would you prefer? We currently have the problem that it can depend on the build type (autotools or cmake) whether both variants work or only the first one. We could enforce that only one of both variants is supported, or we could support both variants. |
What do you means by |
CMake and Autotools should behave similarly, otherwise you make supporting the software more difficult. |
Due to the differences between the builds, for Tesseract at least I would prefer that we support just one build system for Linux, macOS,, and the BSDs. |
#4026 is one more example for a different behavior of the Autotools build vs. the CMake build. |
I have always used variant 1. Both in the library and for the 300 or so programs in the prog/ directory. Never considered variant 2, which wouldn't work with any of my code because I'm using specific local builds (not installed software) when developing and testing. |
Currently they use different templates for The |
I meant |
IMO leptonica has problem with naming conventions: " If I understand it correctly: |
|
Basic Information
tesseract 5.2.0
leptonica-1.82.0
libgif 5.2.1 : libjpeg 6b (libjpeg-turbo 2.1.3) : libpng 1.6.37 : libtiff 4.4.0 : zlib 1.2.12 : libwebp 1.3.0
Found AVX2
Found AVX
Found FMA
Found SSE4.1
Operating System
No response
Other Operating System
Fedora Linux 37
But this was originally reported to me from a user on a Mac M1 (presumably macOS 13 Ventura).
uname -a
Linux fedora-desktop 6.1.14-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Feb 26 00:13:26 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Compiler
gcc version 12.2.1 20221121 (Red Hat 12.2.1-4) (GCC)
Virtualization / Containers
No response
CPU
13th Gen Intel® Core™ i7-13700K
Current Behavior
When using
TessBaseAPIInit3(cube, NULL, NULL)
the language isn't set to a sensible default, thus later causing a segmentation fault whenTessBaseAPIRecognize
is called.Expected Behavior
Given that the documentation says:
I would expect a
NULL
to work the same way as"eng"
(not segmentation fault at the Recognize step).Suggested Fix
Null pointer defaults to "eng".
Other Information
Test case program
run using
gcc $(pkg-config --cflags --libs tesseract) $(pkg-config --cflags --libs lept) test.c && ./a.out
.This was originally reported against a Rust wrapper: antimatter15/tesseract-rs#34
The text was updated successfully, but these errors were encountered: