Skip to content

Commit 3b020a8

Browse files
authored
Add export CGO_ENABLED=1 to all GO examples. (k2-fsa#3069)
This pull request aims to enhance the robustness and consistency of the Go API examples by explicitly setting the CGO_ENABLED environment variable to 1 in all associated run.sh scripts. This ensures that Go programs that depend on CGO for linking with C libraries are properly configured for compilation and execution, preventing potential build failures or runtime issues related to CGO being disabled by default in certain environments.
1 parent b19e7a6 commit 3b020a8

54 files changed

Lines changed: 110 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

go-api-examples/add-punctuation/run.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -ex
44

5+
export CGO_ENABLED=1
6+
57
if [ ! -d ./sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12 ]; then
68
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2
79
tar xvf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2

go-api-examples/audio-tagging/run.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/env bash
22

3+
set -ex
4+
5+
export CGO_ENABLED=1
6+
37
if [ ! -f ./sherpa-onnx-zipformer-small-audio-tagging-2024-04-15/model.int8.onnx ]; then
48
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/audio-tagging-models/sherpa-onnx-zipformer-small-audio-tagging-2024-04-15.tar.bz2
59

go-api-examples/keyword-spotting-from-file/run.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -ex
44

5+
export CGO_ENABLED=1
6+
57
if [ ! -f ./sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01/tokens.txt ]; then
68
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/kws-models/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2
79
tar xvf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2

go-api-examples/non-streaming-canary-decode-files/run.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -ex
44

5+
export CGO_ENABLED=1
6+
57
if [ ! -f sherpa-onnx-nemo-canary-180m-flash-en-es-de-fr-int8/encoder.int8.onnx ]; then
68
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-nemo-canary-180m-flash-en-es-de-fr-int8.tar.bz2
79
tar xvf sherpa-onnx-nemo-canary-180m-flash-en-es-de-fr-int8.tar.bz2

go-api-examples/non-streaming-decode-files/run-dolphin-ctc-base.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -ex
44

5+
export CGO_ENABLED=1
6+
57
if [ ! -f ./sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02/model.int8.onnx ]; then
68
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02.tar.bz2
79
tar xvf sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02.tar.bz2

go-api-examples/non-streaming-decode-files/run-fire-red-asr.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -ex
44

5+
export CGO_ENABLED=1
6+
57
if [ ! -f ./sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/encoder.int8.onnx ]; then
68
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2
79
tar xvf sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2

go-api-examples/non-streaming-decode-files/run-moonshine.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -ex
44

5+
export CGO_ENABLED=1
6+
57
if [ ! -f ./sherpa-onnx-moonshine-tiny-en-int8/tokens.txt ]; then
68
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-moonshine-tiny-en-int8.tar.bz2
79
tar xvf sherpa-onnx-moonshine-tiny-en-int8.tar.bz2

go-api-examples/non-streaming-decode-files/run-nemo-ctc.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -ex
44

5+
export CGO_ENABLED=1
6+
57
if [ ! -d sherpa-onnx-nemo-ctc-en-conformer-medium ]; then
68
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-nemo-ctc-en-conformer-medium.tar.bz2
79
tar xvf sherpa-onnx-nemo-ctc-en-conformer-medium.tar.bz2

go-api-examples/non-streaming-decode-files/run-paraformer-itn.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -ex
44

5+
export CGO_ENABLED=1
6+
57
if [ ! -d sherpa-onnx-paraformer-zh-2023-09-14 ]; then
68
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
79
tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2

go-api-examples/non-streaming-decode-files/run-paraformer.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -ex
44

5+
export CGO_ENABLED=1
6+
57
if [ ! -d sherpa-onnx-paraformer-zh-2023-09-14 ]; then
68
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
79
tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2

0 commit comments

Comments
 (0)