Git Product home page Git Product logo

Comments (13)

wader avatar wader commented on July 24, 2024 1

@binoculars seen this before?

from static-ffmpeg.

wader avatar wader commented on July 24, 2024

Hey, no worries and it seems like the latest update PR #284 failed on the same thing, a bit weird. So don't think you have done anything wrong, will investigate.

from static-ffmpeg.

wader avatar wader commented on July 24, 2024

Some progress: alpine has updated pkgconf to 1.9.4 and configure seems to be happy with pkgconf 1.9.3, they produce slightly different link commands for the the failing test:

1.9.3:
gcc -fopenmp -Wl,-z,stack-size=2097152 -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -Wl,-z,noexecstack -fPIE -static-pie -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include -I/usr/include/libpng16 -L/usr/lib -L/lib -L/lib -L/lib -L/usr/lib -L/usr/lib -o test test.o -lbluray -lxml2 -lz -llzma -lm -lfreetype -lz -lbz2 -lpng16 -lz -lbrotlidec -lbrotlicommon -lfontconfig -lexpat -lm

1.94:
gcc -fopenmp -Wl,-z,stack-size=2097152 -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -Wl,-z,noexecstack -fPIE -static-pie -I/usr/local/include -I/usr/include/freetype2 -I/usr/include/libxml2 -I/usr/include/libpng16 -L/usr/local/lib -L/lib -o test test.o -lbluray -lxml2 -lz -llzma -lm -lfontconfig -lfreetype -lbrotlicommon -lexpat -lm -lbz2 -lbrotlidec -lpng16 -lz

i suspect library link order issue... hmmm, will continue later, let me know if you figure something out

from static-ffmpeg.

binoculars avatar binoculars commented on July 24, 2024

I saw something similar a few months ago on alpine edge. Not sure of the pkgconf version at the time, but here is a gist of the build log: https://gist.github.com/binoculars/a97a45b2ad32a8289a302fd340143f93

The workaround was to build libbluray without freetype.

Also we're building libbrotli in ffbuilds. I'm not sure if that makes any difference here but I likely would've just used the static alpine package over building from source if it didn't error on alpine edge.

from static-ffmpeg.

wader avatar wader commented on July 24, 2024

Thanks, that rings a bell. Yeah would be nice to use the alpine package, will digg a bit more.

It seems like the link error depend on the order of -lbrotlidec -lbrotlicommon, -lbrotlidec before -lbrotlicommon works and for some reason pkgconf 1.9.4 switches them around it seems. Strange. Here is the NEWS file https://gitea.treehouse.systems/ariadne/pkgconf/src/branch/master/NEWS. Also it seems like there was some security problem with 1.9.3, might explain why alpine stable updated it... would have been nice to have those versions more sticky

1.9.3:
~/pkgconf # PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig /usr/local/bin/pkgconf    --libs --static libbluray
-lbluray -L/usr/lib -lxml2 -L/lib -lz -llzma -lm -lfreetype -L/lib -L/lib -lz -lbz2 -lpng16 -lz -lbrotlidec -L/usr/lib -lbrotlicommon -lfontconfig -L/usr/lib -lexpat -lm

1.9.4:
~/pkgconf # PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig /usr/local/bin/pkgconf    --libs --static libbluray
-lbluray -L/usr/lib -L/usr/lib -lxml2 -L/lib -lz -llzma -lm -lfontconfig -lfreetype -lbrotlicommon -lexpat -lm -lbz2 -lbrotlidec -lpng16 -lz

from static-ffmpeg.

wader avatar wader commented on July 24, 2024

This might be related pkgconf/pkgconf#268

from static-ffmpeg.

wader avatar wader commented on July 24, 2024

A bit confused about the read-only segment has dynamic relocations and that it works with different link order, is a side-effect of the undefined references somehow?

from static-ffmpeg.

wader avatar wader commented on July 24, 2024
# pkg-config --simulate --static --libs libbluray
node 'virtual:world' {
    dependency 'libbluray';
    dependency 'freetype2' {
        comparator = '>=';
        version = '21.0.15';
    };
};
node 'libbluray' {
    version = '1.3.4';
};
node 'libxml-2.0' {
    version = '2.10.3';
};
node 'freetype2' {
    version = '24.3.18';
};
node 'zlib' {
    version = '1.2.13';
};
node 'bzip2' {
    version = '1.0.8';
};
node 'libpng' {
    version = '1.6.38';
};
node 'libbrotlidec' {
    version = '1.0.9';
};
node 'libbrotlicommon' {
    version = '1.0.9';
};
node 'fontconfig' {
    version = '2.14.1';
};
node 'expat' {
    version = '2.5.0';
};
node 'freetype2' {
    version = '24.3.18';
};
node 'libxml-2.0' {
    version = '2.10.3';
};
node 'fontconfig' {
    version = '2.14.1';
};
node 'freetype2' {
    version = '24.3.18';
};
node 'libbrotlicommon' {
    version = '1.0.9';
};
node 'expat' {
    version = '2.5.0';
};
node 'bzip2' {
    version = '1.0.8';
};
node 'libbrotlidec' {
    version = '1.0.9';
};
node 'libpng' {
    version = '1.6.38';
};
node 'zlib' {
    version = '1.2.13';
};

from static-ffmpeg.

wader avatar wader commented on July 24, 2024

Minimized reproduction Dockerfile:

FROM alpine:3.17.1 AS builder

RUN apk add --no-cache \
  coreutils \
  wget \
  rust cargo cargo-c \
  openssl-dev openssl-libs-static \
  ca-certificates \
  bash \
  tar \
  build-base \
  autoconf automake \
  libtool \
  diffutils \
  yasm nasm \
  git \
  libpng-dev libpng-static \
  zlib-dev zlib-static \
  bzip2-dev bzip2-static \
  libxml2-dev libxml2-static \
  expat-dev expat-static \
  fontconfig-dev fontconfig-static \
  freetype freetype-dev freetype-static \
  giflib giflib-dev \
  fribidi-dev fribidi-static \
  brotli-dev brotli-static \
  xxd \
  xz-dev xz-static

# -O3 makes sure we compile with optimization. setting CFLAGS/CXXFLAGS seems to override
# default automake cflags.
# -static-libgcc is needed to make gcc not include gcc_s as "as-needed" shared library which
# cmake will include as a implicit library.
# other options to get hardened build (same as ffmpeg hardened)
ARG CFLAGS="-O3 -s -static-libgcc -fno-strict-overflow -fstack-protector-all -fPIC"
ARG CXXFLAGS="-O3 -s -static-libgcc -fno-strict-overflow -fstack-protector-all -fPIC"
ARG LDFLAGS="-Wl,-z,relro,-z,now"

# retry dns and some http codes that might be transient errors
ARG WGET_OPTS="--retry-on-host-error --retry-on-http-error=429,500,502,503"

ARG LIBBLURAY_VERSION=1.3.4
ARG LIBBLURAY_URL="https://code.videolan.org/videolan/libbluray/-/archive/$LIBBLURAY_VERSION/libbluray-$LIBBLURAY_VERSION.tar.gz"
ARG LIBBLURAY_SHA256=9820df5c3e87777be116ca225ad7ee026a3ff42b2447c7fe641910fb23aad3c2
RUN \
  wget $WGET_OPTS -O libbluray.tar.gz "$LIBBLURAY_URL" && \
  echo "$LIBBLURAY_SHA256  libbluray.tar.gz" | sha256sum --status -c - && \
  tar xf libbluray.tar.gz &&  cd libbluray-* && git clone https://code.videolan.org/videolan/libudfread.git contrib/libudfread && \
  autoreconf -fiv && ./configure --with-pic --disable-doxygen-doc --disable-doxygen-dot --enable-static --disable-shared --disable-examples --disable-bdjava-jar && \
  make -j$(nproc) install

ARG FFMPEG_VERSION=5.1.2
ARG FFMPEG_URL="https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
ARG FFMPEG_SHA256=39a0bcc8d98549f16c570624678246a6ac736c066cebdb409f9502e915b22f2b
RUN \
  wget  $WGET_OPTS -O ffmpeg.tar.bz2 "$FFMPEG_URL" && \
  echo "$FFMPEG_SHA256  ffmpeg.tar.bz2" | sha256sum --status -c - && \
  tar xf ffmpeg.tar.bz2 && \
  cd ffmpeg-* && \
  sed -i 's/add_ldexeflags -fPIE -pie/add_ldexeflags -fPIE -static-pie/' configure && \
  ./configure \
  --pkg-config-flags="--static" \
  --extra-cflags="-fopenmp" \
  --extra-ldflags="-fopenmp -Wl,-z,stack-size=2097152" \
  --toolchain=hardened \
  --disable-debug \
  --disable-shared \
  --disable-ffplay \
  --enable-static \
  --enable-gpl \
  --enable-version3 \
  --enable-nonfree \
  --enable-fontconfig \
  --enable-gray \
  --enable-iconv \
  --enable-libbluray \
  || cat ffbuild/config.log

can be run as docker build . 2>&1 | cat - to see all output

from static-ffmpeg.

wader avatar wader commented on July 24, 2024

@binoculars possible workaround for now #286

from static-ffmpeg.

wader avatar wader commented on July 24, 2024

Seems to have worked 🥳

@fasihi01-duplicate Please try again with latest master

from static-ffmpeg.

fasihi01 avatar fasihi01 commented on July 24, 2024

Successfully built 5cdb3385f186

Thank you very much for your efforts!

from static-ffmpeg.

wader avatar wader commented on July 24, 2024

👍 Thanks for the report and hopefully we can remove the lib order hack eventually

from static-ffmpeg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.