From f7e743d2aadc414ab2b0f6bebff00efb927af192 Mon Sep 17 00:00:00 2001 From: Andy Gorman Date: Tue, 31 Aug 2021 17:14:31 -0700 Subject: [PATCH] Fixing broken builds and adding README help with installing, building, and running --- go/README.md | 25 +++++++++++++++++++++++++ go/go.mod | 4 ---- go/vosk.go | 3 +-- 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 go/README.md diff --git a/go/README.md b/go/README.md new file mode 100644 index 00000000..0d71a6e4 --- /dev/null +++ b/go/README.md @@ -0,0 +1,25 @@ +# BUILDING VOSK + +To use the go bindings you first have to build vosk from source. You can build it by following the instructions on the vosk web site under Compilation from source. https://alphacephei.com/vosk/install + +First you will be required to install Kaldi then vosk. Once complete you will have `libvosk.so`. + + +# INSTALLING VOSK GO BINDINGS + + + go get github.com/alphacep/vosk-api/go + + +# VOSK NOT INSTALLED TO SYSTEM + +If the vosk headers aren't installed then use CGO_LDFLAGS environment variable to point to the headers when building and installing. + + CGO_LDFLAGS="-L/opt/vosk-api/src" go get github.com/alphacep/vosk-api/go + + CGO_LDFLAGS="-L/opt/vosk-api/src" go build -o vosk examples/main.go + +If the vosk library isn't installed on the system then use the LD_LIBRARY_PATH environment variable to point to the so file when running. + + LD_LIBRARY_PATH=/opt/vosk-api/src ./vosk + diff --git a/go/go.mod b/go/go.mod index 0c50b30a..9fc41041 100644 --- a/go/go.mod +++ b/go/go.mod @@ -1,7 +1,3 @@ module github.com/alphacep/vosk-api/go go 1.16 - -replace ( - github.com/alphacep/vosk-api/go => ./ -) diff --git a/go/vosk.go b/go/vosk.go index 93baec74..7cd6f6e5 100644 --- a/go/vosk.go +++ b/go/vosk.go @@ -1,7 +1,6 @@ package vosk -// #cgo CPPFLAGS: -I ${SRCDIR}/../src -// #cgo LDFLAGS: -L ${SRCDIR}/../src -lvosk -ldl -lpthread +// #cgo -lvosk -ldl -lpthread // #include // #include import "C"