-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Fix MUSL Linux build #576
Fix MUSL Linux build #576
Conversation
It did not. However, when I commented out the
|
I don't know if this helps, but this is how I build: FROM alpine:3.17.2 AS alpine0
RUN mkdir /whisper && \
wget -q https://github.com/masterful/whisper.cpp/tarball/master -O - | \
tar -xz -C /whisper --strip-components 1
# git alternative
# RUN apk add git &&
# git clone --depth 1 https://github.com/ggerganov/whisper.cpp.git /whisper
WORKDIR /whisper
RUN apk add --quiet g++ make bash wget sdl2-dev alsa-utils
# Workaround build
RUN cat > Makefile.musl <<MAKEFILE
CFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
CXXFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
MAKEFILE
RUN make -f Makefile -f Makefile.musl main stream command talk bench
# Once workaround is no longer necessary
# RUN make main stream command talk bench
RUN bash ./models/download-ggml-model.sh base.en
FROM alpine:3.17.2
COPY --from=alpine0 /whisper/main /usr/local/bin/whisper
COPY --from=alpine0 /whisper/stream /usr/local/bin/stream
COPY --from=alpine0 /whisper/talk /usr/local/bin/talk
COPY --from=alpine0 /whisper/command /usr/local/bin/wcommand
RUN mkdir /root/models
COPY --from=alpine0 /whisper/models/ggml-base.en.bin /root/models/ggml-base.en.bin
RUN apk add --quiet sdl2-dev alsa-utils
WORKDIR /root
# To use stream in a container (linux hosts only):
# docker build . -t whisper
# docker run -it --rm --device /dev/snd:/dev/snd whisper stream Then to extract binaries docker build -t whispercpp .
docker create --name whispercpp whispercpp
docker cp whispercpp:/usr/local/bin/whisper whisper
docker cp whispercpp:/usr/local/bin/stream wstream
docker cp whispercpp:/root/models/ggml-base.en.bin ggml-base.en.bin
docker rm whispercpp |
Directly adding |
I asked ChatGPT
ifneq ($(wildcard /usr/include/musl/*),)
CFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
CXXFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
endif
ifeq ($(shell ldd /bin/ls | grep -q musl && echo true),true)
endif
ifeq ($(shell pkg-config --exists musl && echo true),true)
endif I tested the first and it worked. |
Currently, I have a job to build the binary for MUSL python wheel and seems like it fails as well. 🤔 |
Added the suggestion by ChatGPT |
close #37
@mikeslattery Could you please check if this works on MUSL Linux?