otiai10/gosseract

fatal error: unexpected signal during runtime execution

lifepeer opened this issue · 2 comments

Summary

  • Running the example provided in README.md produces the following error:
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xc pc=0x43ddc3e]

runtime stack:
runtime.throw({0x40b39f2, 0x7ffeefbff208})
        /usr/local/opt/go/libexec/src/runtime/panic.go:1198 +0x71
runtime.sigpanic()
        /usr/local/opt/go/libexec/src/runtime/signal_unix.go:719 +0x396

goroutine 1 [syscall]:
runtime.cgocall(0x4092ba0, 0xc000052e40)
        /usr/local/opt/go/libexec/src/runtime/cgocall.go:156 +0x5c fp=0xc000052e18 sp=0xc000052de0 pc=0x400379c
github.com/otiai10/gosseract/v2._Cfunc_UTF8Text(0xc900020)
        _cgo_gotypes.go:302 +0x49 fp=0xc000052e40 sp=0xc000052e18 pc=0x40910e9
github.com/otiai10/gosseract/v2.(*Client).Text.func1(0xc000052f08)
        /Users/<user>/go/pkg/mod/github.com/otiai10/gosseract/v2@v2.3.1/client.go:333 +0x3a fp=0xc000052e78 sp=0xc000052e40 pc=0x409269a
github.com/otiai10/gosseract/v2.(*Client).Text(0xc000052f08)
        /Users/<user>/go/pkg/mod/github.com/otiai10/gosseract/v2@v2.3.1/client.go:333 +0x39 fp=0xc000052eb8 sp=0xc000052e78 pc=0x40925f9
main.main()
        /Users/<user>/Desktop/test/main.go:13 +0xdb fp=0xc000052f80 sp=0xc000052eb8 pc=0x40927bb
runtime.main()
        /usr/local/opt/go/libexec/src/runtime/proc.go:255 +0x227 fp=0xc000052fe0 sp=0xc000052f80 pc=0x40335e7
runtime.goexit()
        /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc000052fe8 sp=0xc000052fe0 pc=0x405cb81
exit status 2
  • tesseract itself is confirmed to be working fine directly

Reproducibility

Reproducibility Frequency

  • 100%

Reproducible example

  1. Install tesseract via brew on macOS 10.13.6
  2. go mod init a new module and run the example provided in README.md

go.mod

module <root>/test

go 1.17

require github.com/otiai10/gosseract/v2 v2.3.1

require github.com/otiai10/mint v1.3.3 // indirect

main.go

package main

import (
	"fmt"

	"github.com/otiai10/gosseract/v2"
)

func main() {
	client := gosseract.NewClient()
	defer client.Close()
	client.SetImage("/Users/<user>/Desktop/test.jpg")
	text, _ := client.Text()
	fmt.Println(text)
	// Hello, World!
}

Environment

uname -a

Darwin <name> 17.7.0 Darwin Kernel Version 17.7.0: Fri Oct 30 13:34:27 PDT 2020; root:xnu-4570.71.82.8~1/RELEASE_X86_64 x86_64
go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/<user>/Library/Caches/go-build"
GOENV="/Users/<user>/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/<user>/go/pkg/mod"
GONOPROXY=""
GONOSUMDB="github.com/galeone/tensorflow"
GOOS="darwin"
GOPATH="/Users/<user>/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/opt/go/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/<user>/Desktop/test/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/y1/326cb6yn0vvg81lhbysdq6br0000gn/T/go-build1971799596=/tmp/go-build -gno-record-gcc-switches -fno-common"
go version

go version go1.17.2 darwin/amd64
tesseract --version

tesseract 5.0.1
 leptonica-1.82.0
  libgif 5.2.1 : libjpeg 9e : libpng 1.6.37 : libtiff 4.3.0 : zlib 1.2.11 : libwebp 1.2.2 : libopenjp2 2.4.0
 Found AVX2
 Found AVX
 Found FMA
 Found SSE4.1
 Found libarchive 3.5.2 zlib/1.2.11 liblzma/5.2.5 bz2lib/1.0.6 liblz4/1.9.3 libzstd/1.5.2
 Found libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0

how did you guys fix this? I'm currently having the same issue with tesseract 5.1.0