Hi!
I am trying to build a small utility using tesseract from a Go program, and instead of calling a subprocess and initializing the OCR engine every time I plan to run the OCR from a Go routine.
I have this small code that uses a binding to tesseract:
$ cat main.go
package main
import (
"io/ioutil"
"os"
"fmt"
"log"
)
func main() {
client := gosseract.NewClient()
defer client.Close()
b, err := ioutil.ReadAll(os.Stdin)
if err != nil {
log.Fatal("Error loading image from stdin: %v", err)
}
if err := client.SetImagesFromBytes(b); err != nil {
log.Fatal("Invalid image format from stdin: %v", err)
}
hocr, err := client.HOCR()
if err != nil {
log.Fatal("Error performing hOCR: %v", err)
}
fmt.Println(hocr)
}
When I try to compile using the version 4.1.1 of tesseract (from pkg install tesseract inside Termux) I get this errors:
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/usr/lib/libtesseract.so: undefined reference to `omp_get_thread_num'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/usr/lib/libtesseract.so: undefined reference to `__kmpc_serialized_parallel'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/usr/lib/libtesseract.so: undefined reference to `__kmpc_push_num_threads'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/usr/lib/libtesseract.so: undefined reference to `__kmpc_for_static_init_4'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/usr/lib/libtesseract.so: undefined reference to `__kmpc_end_serialized_parallel'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/usr/lib/libtesseract.so: undefined reference to `__kmpc_global_thread_num'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/usr/lib/libtesseract.so: undefined reference to `__kmpc_fork_call'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/usr/lib/libtesseract.so: undefined reference to `__kmpc_for_static_fini'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
I don't know if this issue is in my code, the lib binding or the Termux build of tesseract. Any help to dissect this will be apreciated!
Best regards,