DanielSWolf/rhubarb-lip-sync

Error detecting segments of speech on Alpine Linux

RankoR opened this issue · 2 comments

I have a test docker image:

FROM azul/zulu-openjdk-alpine:11.0.13-jre-headless AS base

RUN apk add --no-cache libgcc libc6-compat libstdc++

RUN mkdir /app
COPY apps /app/apps
COPY audio.wav /app/audio.wav

WORKDIR /app

CMD ["/app/apps/rhubarb/rhubarb-linux", "/app/audio.wav", "-r", "phonetic", "-f", "json", "-q"]

Then I build it and run, and I get an error:

docker run --rm rhubarb
Rhubarb Lip Sync 1.11.0 processing file /app/audio.wav:
[Fatal] Application terminating with error: Error processing file /app/audio.wav.
Error detecting segments of speech.
No error information

Audio file is valid, and macOS version of rhubarb 1.11.0 works fine with the same file on macOS Monterey.
UPD. Works fine too on Debian 11.

Why it doesn't work on Alpine Linux?

Ok, I've managed to fix it. The problem is that Alpine uses musl instead of glibc, so to get it working we need to recompile it. Sample Dockerfile:

# Build

FROM alpine:3.14.2 AS build

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

ENV RHUBARB_VERSION 1.11.0

RUN apk add --no-cache wget \
	unzip \
	cmake \
	clang \
	clang-dev \
	make \
	gcc \
	g++ \
	libc-dev \
	boost-dev \
	upx

RUN mkdir /src/
RUN mkdir /out/

WORKDIR /src/

RUN set -ex \
	&& wget https://github.com/DanielSWolf/rhubarb-lip-sync/archive/refs/tags/v$RHUBARB_VERSION.zip -O rhubarb-lip-sync-$RHUBARB_VERSION.zip \
	&& unzip rhubarb-lip-sync-$RHUBARB_VERSION.zip \
	&& rm rhubarb-lip-sync-$RHUBARB_VERSION.zip \
	&& cd rhubarb-lip-sync-$RHUBARB_VERSION \
	&& rm -rf build \
	&& mkdir build \
	&& cd build \
	&& cmake .. \
	&& cmake --build . --config Release --target rhubarb \
	&& cmake --build . --config Release --target runTests \
	&& upx --best rhubarb/rhubarb \
	&& cp rhubarb/rhubarb /out/rhubarb


# Run

FROM azul/zulu-openjdk-alpine:11.0.13-jre-headless AS base

RUN apk add --no-cache libc6-compat libstdc++ libgcc

RUN mkdir /app
COPY apps /app/apps
COPY --from=build /out/rhubarb /app/apps/rhubarb/rhubarb-linux
COPY audio.wav /app/audio.wav

WORKDIR /app

CMD ["/app/apps/rhubarb/rhubarb-linux", "/app/audio.wav", "-r", "phonetic", "-f", "json", "-q"]

UPX step is optional. If you want to get a full package, you'll need a JRE image for build. I need only the binary, so raw alpine is fine.

docker run --rm rhubarb
{
  "metadata": {
    "soundFile": "/app/audio.wav",
    "duration": 108.13
  },
  "mouthCues": [
    { "start": 0.00, "end": 0.17, "value": "X" },
...

I'm glad you got it working on Alpine.

I'd have expected implementations of the C standard library to be compatible, so I'm surprised you could build it, but not run it. In my experience, differences between standard library implementations usually show at compile time rather than runtime.