When testing the code on PC there were errors in the Go code, but they are unrelated to the build errors from libtesseract.so:
``` package main import ( "io/ioutil" "os" "fmt" "log" "github.com/otiai10/gosseract" ) 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.SetImageFromBytes(b); err != nil { log.Fatal("Invalid image format from stdin: %v", err) } hocr, err := client.HOCRText() if err != nil { log.Fatal("Error performing hOCR: %v", err) } fmt.Println(hocr) } ``` Since I could build and run this program on my PC with no errors, it seems to be related to the build toolchain on android. Apologise for the confusion here! I filled a bug report on termux-packages repository: https://github.com/termux/termux-packages/issues/5946 Best Regards, Em quinta-feira, 15 de outubro de 2020 às 12:33:05 UTC-3, Ronoaldo Pereira escreveu: > 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" > > "github.com/otiai10/gosseract" > ) > > 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: > > # github.com/otiai10/gosseract > /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, > -- You received this message because you are subscribed to the Google Groups "tesseract-ocr" group. To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-ocr+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/2fc87ae7-bf89-4f1a-a41d-98bd3942028bn%40googlegroups.com.