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

Error in github.com/3d0c/gmf downloading stage #19

Open
teploff opened this issue Oct 29, 2022 · 2 comments
Open

Error in github.com/3d0c/gmf downloading stage #19

teploff opened this issue Oct 29, 2022 · 2 comments

Comments

@teploff
Copy link

teploff commented Oct 29, 2022

Hi @denismakogon! Thank you so much for your help repository.

I'm trying to launch my web service with github.com/3d0c/gmf library in docker.

I've checked your recommendations to create image, and I'm catching the error in go packages download. The error is:

# github.com/3d0c/gmf
/usr/bin/ld: $WORK/b334/_x011.o: in function `gmf_get_timecode':
/go/pkg/mod/github.com/3d0c/gmf@v0.0.0-20220906170454-be727bc5b56c/frame_go112.go:36: undefined reference to `av_timecode_make_smpte_tc_string2'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `FcWeightToOpenTypeDouble'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined reference to `fribidi_get_bracket'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined reference to `fribidi_get_par_embedding_levels_ex'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `FcWeightFromOpenTypeDouble'
collect2: error: ld returned 1 exit status

Have you ever faced with its problem?

My full Dockerfile is:

FROM ghcr.io/denismakogon/ffmpeg-debian:5.0.1-golang-1 as build-stage

RUN go version
RUN pkg-config --libs libavformat

WORKDIR /app
COPY . .

RUN go build -o videophash /app/cmd/main.go


FROM ghcr.io/denismakogon/ffmpeg-debian:5.0.1-runtime

WORKDIR /app
COPY --from=builder /app/ ./

ENTRYPOINT ["./videophash", "--config=./configs/config.yaml"]

Also I'm trying to build it from sources in your images like:

RUN wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/ffmpeg/7:5.1.1-1ubuntu1/ffmpeg_5.1.1.orig.tar.xz
RUN tar -C /usr/local -xvf ffmpeg_5.1.1.orig.tar.xz

RUN cd /usr/local/ffmpeg-5.1.1 && ./configure --disable-x86asm --prefix=/usr/local/ffmpeg --enable-shared && make && make install && cd -

But It didn't help.

I will be happy if you help me. Have a nice day!

@denismakogon
Copy link
Owner

Hey @teploff! Sorry for taking that long. I didn't have a chance to check what has happened recently, but would appreciate any help at this moment!

@seth-epps
Copy link

seth-epps commented Jan 11, 2023

Very late, but commenting in case this might help someone else out later.

I'll preface this by noting I have very little background with pkg-config and cgo so this may be entirely incorrect

I was running into the same issue and it looks like it could be because the pkg-config paths are still pointing at the /opt/ffmpeg prefix, but everything is copied from/to /usr/local and missing the libraries from /opt/ffmpeg/lib.

❯ docker container run --rm -it ghcr.io/denismakogon/ffmpeg-debian:5.0.1-golang-1 /bin/bash
root@c988a3bb2c84:/go# pkg-config --libs libavutil
-L/opt/ffmpeg/lib -lavutil
root@c988a3bb2c84:/go# cat /usr/local/lib/pkgconfig/libavutil.pc
prefix=/opt/ffmpeg
exec_prefix=${prefix}
libdir=/opt/ffmpeg/lib
includedir=/opt/ffmpeg/include

Name: libavutil
Description: FFmpeg utility library
Version: 57.17.100
Requires:
Requires.private:
Conflicts:
Libs: -L${libdir}  -lavutil
Libs.private: -pthread -lva-drm -lva -lm -lva -latomic
Cflags: -I${includedir}

This is probably a less than ideal workaround, however, I've got it working by just rolling my own build. I wanted to get it running in a distroless container, but it was just too much of a hassle fighting with the missing dependencies. It takes most of the base build from ghcr.io/denismakogon/ffmpeg-debian:base and keeps the image relatively small, but unfortunately the ffmpeg libraries occupy a fair amount of space (238M /opt/ffmpeg/lib).

FROM docker.io/library/golang:1.19-bullseye as build
RUN apt-get update -y && apt-get install -y --no-install-recommends \
    libva-drm2 \
    libva2 && \
    apt-get autoremove -y && \
    apt-get clean && \
	rm -rf /var/lib/apt/lists/*

ENV LD_LIBRARY_PATH=/opt/ffmpeg/lib
ENV PKG_CONFIG_PATH=/opt/ffmpeg/lib/pkgconfig

COPY --from=ghcr.io/denismakogon/ffmpeg-debian:5.0.1-build /opt/ffmpeg /opt/ffmpeg

WORKDIR /build

COPY go.mod ./
COPY go.sum ./

RUN go mod download

COPY main.go ./

RUN go build -o /ffmpeg-tester


FROM debian:bullseye-slim as base
RUN apt-get -yqq update && \
     apt-get install -yq --no-install-recommends \
     ca-certificates \
     expat \
     libgomp1 \
     libva-drm2 \
     libva2 && \
     apt-get autoremove -y && \
     apt-get clean -y && \
	 rm -rf /var/lib/apt/lists/*

ENV LD_LIBRARY_PATH=/opt/ffmpeg/lib
ENV PKG_CONFIG_PATH=/opt/ffmpeg/lib/pkgconfig

COPY --from=build /opt/ffmpeg/lib /opt/ffmpeg/lib
COPY --from=build /ffmpeg-tester /ffmpeg-tester
COPY tests-sample.mp4 /samples/tests-sample.mp4

CMD ["/ffmpeg-tester", "-src", "/samples/tests-sample.mp4"]

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

3 participants