wader / static-ffmpeg

Multi-arch docker image with ffmpeg/ffprobe binaries built as hardened static PIE binaries with no external dependencies
https://hub.docker.com/r/mwader/static-ffmpeg/
MIT License
255 stars 62 forks source link

RUST static link symbols collision #501

Closed examedia-video-engineering closed 1 month ago

examedia-video-engineering commented 1 month ago

chekdupsym has found a symbol duplicate, any way to avoid that please? Prefereably without rewriting all rust libs )

examedia-video-engineering commented 1 month ago

I added libzmq to the build it seem to have collision?

libssh.a:sha1_init libzmq.a:sha1_init

wader commented 1 month ago

Hmm strange, is this with a modified Dockerfile? current master build seems to not fail on it.

If you comment out the chekdupsym script does ffmpeg fail to link instead? if really both libssh.a and libzmq.a has a public sha1_init symbol it will probably fail. If this is the case a fix is to somehow rename one of them, maybe convince any of the upstreams to namespace it with som prefix.

wader commented 1 month ago

Aha you added libzmq. Try skip chekdupsym and see if it still fails. If so maybe do ugly patch for now that renames one of the symbols or make it private (static in c). But best would probably be to get one or both of the projects to fix it.

wader commented 1 month ago

Yeap seems so: https://github.com/zeromq/libzmq/blob/b95d94935ed107679fd0ad9efd2f3d47309b6fd3/external/sha1/sha1.h#L68 https://github.com/canonical/libssh/blob/a09a5a5b5dd414bf422ab3ac3c50626eb46e8d67/include/libssh/wrapper.h#L79

maybe also interesting https://github.com/zeromq/libzmq/issues/3676

examedia-video-engineering commented 1 month ago

Aha you added libzmq. Try skip chekdupsym and see if it still fails. If so maybe do ugly patch for now that renames one of the symbols or make it private (static in c). But best would probably be to get one or both of the projects to fix it.

FFmpeg executes ok, but I'm not sure if it'll fail in a specific ZMQ use case... will do an "ugly patch" for zmq I guess. Thank you!

examedia-video-engineering commented 1 month ago
ARG LIBZMQ_VERSION=4.3.5
ARG LIBZMQ_URL="https://github.com/zeromq/libzmq/releases/download/v${LIBZMQ_VERSION}/zeromq-${LIBZMQ_VERSION}.tar.gz"
ARG LIBZMQ_SHA256=6653ef5910f17954861fe72332e68b03ca6e4d9c7160eb3a8de5a5a913bfab43
RUN \
  wget $WGET_OPTS -O zmq.tar.gz "$LIBZMQ_URL" && \
  echo "$LIBZMQ_SHA256  zmq.tar.gz" | sha256sum -c - && \
  tar $TAR_OPTS zmq.tar.gz && cd zeromq-* && \
  grep -r -l sha1_init external/sha1* | xargs sed -i 's/sha1_init/zeromq_sha1_init/g' && \
  ./configure --disable-shared --enable-static && \
  make -j$(nproc) install

seems to work for ZeroMQ :) checkdupsym is now a PASS

wader commented 1 month ago

Thanks! PR https://github.com/wader/static-ffmpeg/pull/502