whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

Golang binding fails to build on Alpine Linux 3.20 and Debian 12 Bookworm

Open SummerStorm opened this issue 1 year ago • 0 comments
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.

SummerStorm avatar Jul 19 '24 23:07 SummerStorm