whisper.cpp
whisper.cpp copied to clipboard
Golang binding fails to build on Alpine Linux 3.20 and Debian 12 Bookworm
trafficstars
The Go binding current has two errors when building make test. The following Dockerfile reproduces error 1:
FROM golang:alpine AS build
RUN apk add --no-cache git make g++
ARG SOURCE=https://github.com/ggerganov/whisper.cpp.git
RUN git clone $SOURCE --depth=1 && \
mv */** . && \
make test
RUN cd bindings/go && make test # fails with: ./params.go:11:10: fatal error: whisper.h: No such file or directory
Error 1 is due to the INCLUDE_PATH being defined as INCLUDE_PATH := $(abspath ../..) when it should be INCLUDE_PATH := -I $(abspath ../..)/include -I $(abspath ../..)/ggml/include.
The following Dockerfile fixes error 1 and reproduces error 2:
FROM golang:alpine AS build
RUN apk add --no-cache git make g++
ARG SOURCE=https://github.com/ggerganov/whisper.cpp.git
RUN git clone $SOURCE --depth=1 && \
mv */** . && \
make test
RUN sed -i 's|INCLUDE_PATH := $(abspath ../..)|INCLUDE_PATH := -I $(abspath ../..)/include -I $(abspath ../..)/ggml/include|' bindings/go/Makefile
RUN cd bindings/go && make whisper # successfully builds libwhisper.a
RUN cd bindings/go && make test # fails with error message:
# $ /bin/sh: /go/include: Permission denied
# $ make: *** [Makefile:46: examples/go-model-download] Error 126
make whisper successfully builds libwhisper.a. But make test fails to build due to possibly a permission error with the build directory. I tried my best to find the cause but came up empty unfortunately.
Any help will be greatly appreciated. Thank you.