Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Golang Bindings Error #418

Closed
mbaxamb3333 opened this issue Jan 17, 2023 · 9 comments
Closed

Golang Bindings Error #418

mbaxamb3333 opened this issue Jan 17, 2023 · 9 comments

Comments

@mbaxamb3333
Copy link

I would like to start by saying a big thank you for all the work that you put into maintaining and developing this project.
My issue is with regards to the golang bindings.
As I try to initialise the model, I get the following error.

../go/pkg/mod/github.com/ggerganov/whisper.cpp/bindings/[email protected]/params.go:11:10: fatal error: 'whisper.h' file not found
#include <whisper.h>

Does anyone has any idea why this might happen?

@mbaxamb3333
Copy link
Author

The same thing happens when I try to run the whisper_test file.

Running tool: /opt/homebrew/bin/go test -timeout 30s -coverprofile=/var/folders/y0/dbsx2zd55lz31wt__nmdgm840000gn/T/vscode-goJry90s/go-code-cover github.com/ggerganov/whisper.cpp/bindings/go

github.com/ggerganov/whisper.cpp/bindings/go

/var/folders/y0/dbsx2zd55lz31wt__nmdgm840000gn/T/go-build3341714362/b084/params.cover.go:11:10: fatal error: 'whisper.h' file not found
#include <whisper.h>
^~~~~~~~~~~
1 error generated.
FAIL github.com/ggerganov/whisper.cpp/bindings/go [build failed]
FAIL

@mbaxamb3333
Copy link
Author

When I run the tests from the make file everything works fine, whilst when I run the package test, it fails with the error above

@mbaxamb3333
Copy link
Author

Screenshot 2023-01-17 at 13 10 09

@ggerganov
Copy link
Owner

I believe this has been resolved at some point.
Feel free to reopen if problem persists

@jaybinks
Copy link
Contributor

jaybinks commented Feb 16, 2023 via email

@hemant-saikia
Copy link

@jaybinks Do we not have to tell compiler to look into the include/ subdirectory in whisper.cpp

@ggerganov
INCLUDE_PATH and LIBRARY_PATH in bindings/go/Makefile refer to the parent folder, but the whisper.h file and ggml.h files are in whisper.cpp/include/ and whisper.cpp/ggml/include folders respectively.

Isn't that why the missing .h file error pops up. Do we need to update the Makefile? Or copy the .h files to parent dir.

fatal error: 'whisper.h' file not found
#include <whisper.h>

What am I missing here?

@ggerganov
Copy link
Owner

Yes, likely caused by the recent #2256. Feel free to open a PR with fixes

@byoungdale
Copy link

I started working on this issue. I have a draft pull request #2376. I got the issue with the changed paths to the header files fixed, but I am still getting errors with ggml symbols:

  "_ggml_view_tensor", referenced from:
      whisper_build_graph_encoder(whisper_context&, whisper_state&) in libwhisper.a[2](whisper.o)
      whisper_build_graph_cross(whisper_context&, whisper_state&) in libwhisper.a[2](whisper.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: *** [examples/go-whisper] Error 1

This is not the whole output. Just the end. I will keep taking a look when I can. But, wanted to put here in case anyone else made a better idea more quickly.

@9nut
Copy link

9nut commented Aug 23, 2024

This is my HACK to get past this and verify it works.

diff --git a/bindings/go/Makefile b/bindings/go/Makefile
index 4f3a416..1480a59 100644
--- a/bindings/go/Makefile
+++ b/bindings/go/Makefile
@@ -14,11 +14,11 @@ GGML_METAL_PATH_RESOURCES := $(abspath ../..)
 BUILD_DIR := build
 MODELS_DIR := models
 EXAMPLES_DIR := $(wildcard examples/*)
-INCLUDE_PATH := $(abspath ../..)
-LIBRARY_PATH := $(abspath ../..)
+INCLUDE_PATH := $(abspath ../../include):$(abspath ../../ggml/include)
+LIBRARY_PATH := $(abspath ../../)
 
 ifeq ($(UNAME_S),Darwin)
-       EXT_LDFLAGS := -framework Foundation -framework Metal -framework MetalKit
+       EXT_LDFLAGS := -framework Foundation -framework Metal -framework MetalKit -framework Accelerate $(wildcard ../../ggml/src/ggml*.o)
 endif
 
 all: clean whisper examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants