Skip to content

stable-x86_64-pc-windows-gnu: Conflicts with static libgcc #67960

Closed

Description

@1480c1

Attempting to compile statically FFmpeg with rav1e's c api causes some linking error

D:/DEV/media-autobuild/media-autobuild_suite/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/DEV/media-autobuild/media-autobuild_suite/local64/lib/librav1e.a(compiler_builtins-477d6ada7584f678.compiler_builtins.1c0g4lf3-cgu.0.rcgu.o): in function `___chkstk_ms':
C:\Users\VssAdministrator\.cargo\registry\src\github.life-white.uk-1ecc6299db9ec823\compiler_builtins-0.1.18\src/x86_64.rs:15: multiple definition of `___chkstk_ms'; D:/DEV/media-autobuild/media-autobuild_suite/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/libgcc.a(_chkstk_ms.o):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status

Orignially reported m-ab-s/media-autobuild_suite#1483

Activity

  1. added
    A-linkageArea: linking into static, shared libraries and binaries
    C-bugCategory: This is a bug.
    O-windows-gnuToolchain: GNU, Operating system: Windows
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Jan 7, 2020
  2. added a commit that references this issue on Apr 7, 2020
  3. added a commit that references this issue on Apr 7, 2020
  4. mati865 commented on Aug 12, 2020

    @mati865
    Member

    @1480c1 could you retest with nightly or provide steps to reproduce the error?

  5. 1480c1 commented on Aug 12, 2020

    @1480c1
    Author

    Sure, I can try once I have time.
    The way I encountered it was trying to compile rav1e(rust but using cargo-c to generate a c library) https://github.com/xiph/rav1e with FFmpeg(C) and compiling them both static. I will try to see if I can get steps to reproduce exactly or if there's a simpler way

  6. 1480c1 commented on Aug 13, 2020

    @1480c1
    Author

    Hmm, seems like I am no longer able to reproduced inside a clean VM with just msys2 installed

    #!/usr/bin/bash
    
    mkdir rusty
    
    export CARGO_HOME="$PWD/rusty" RUSTUP_HOME="$PWD/rusty"
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$PWD/rusty/lib/pkgconfig
    export CFLAGS+=" -static -static-libgcc" LDFLAGS+=" -static-libgcc"
    
    
    curl https://sh.rustup.rs -sSo rustup.sh
    ./rustup.sh -v -y --no-modify-path --default-host=${MSYSTEM_CARCH:-x86_64}-pc-windows-gnu --default-toolchain=stable
    
    export PATH=$PATH:$PWD/rusty/bin
    
    # cargo version at this time: cargo 1.45.1 (f242df6ed 2020-07-22)
    
    cargo install cargo-c
    
    git clone --branch master --depth 1 https://github.com/xiph/rav1e.git || {
        git -C rav1e fetch
        git remote set-head -a origin
        git -C rav1e reset --hard origin/HEAD
    }
    
    (
        cd rav1e &&
            cargo capi install --release --prefix "$PWD/local" --jobs "$(nproc)" &&
            install -Dp -t "$CARGO_HOME/lib" "./local/lib/librav1e.a" && 
            install -Dp -t "$CARGO_HOME/lib/pkgconfig" "./local/lib/pkgconfig/rav1e.pc" && 
            install -Dp -t "$CARGO_HOME/include/rav1e" "./local/include/rav1e"/*.h
    ) || exit
    
    git clone --branch master --depth 1 https://git.ffmpeg.org/ffmpeg.git || {
        git -C ffmpeg fetch
        git remote set-head -a origin
        git -C ffmpeg reset --hard origin/HEAD
    }
    
    find . -name rav1e.dll -o -name librav1e.dll.a -delete
    
    (
        cd ffmpeg &&
            ./configure --enable-librav1e --disable-shared --enable-static --disable-ffprobe --pkg-config-flags=--static &&
            make -j "$(nproc)"
    ) || exit
    ./ffmpeg/ffmpeg -h encoder=librav1e
    ffmpeg version git-2020-08-12-bb59bdb Copyright (c) 2000-2020 the FFmpeg developers
      built with gcc 10.2.0 (Rev1, Built by MSYS2 project)
      configuration: --enable-librav1e --disable-shared --enable-static --disable-ffprobe --pkg-config-flags=--static
      libavutil      56. 58.100 / 56. 58.100
      libavcodec     58.100.100 / 58.100.100
      libavformat    58. 50.100 / 58. 50.100
      libavdevice    58. 11.101 / 58. 11.101
      libavfilter     7. 87.100 /  7. 87.100
      libswscale      5.  8.100 /  5.  8.100
      libswresample   3.  8.100 /  3.  8.100
    Encoder librav1e [librav1e AV1]:
        General capabilities: delay threads
        Threading capabilities: auto
        Supported pixel formats: yuv420p yuvj420p yuv420p10le yuv420p12le yuv422p yuvj422p yuv422p10l420p yuv420p10le yuv420p12le yuv422p yuvje yuv444p12le422p yuv422p10le yuv422p12le yuv444p yuvj444p yuv444p10le yuv444p12le             ... use constant quantizer mode (from -1 to 255) (defaul
    librav1e AVOptions:
      -qp                <int>        E..V...... what speed preset to use (from -1 to 10) (default -1... use constant quantizer mode (from -1
    to 255) (default -1)                     ... number of tiles encode with (from -1 to I64_MAX) (de
      -speed             <int>        E..V...... what speed preset to use (from -1 to 10) (default -1)
      -tiles             <int>        E..V...... number of tiles encode with (from -1 to I64_MAX) (default 0)
      -tile-rows         <int>        E..V...... number of tiles rows to encode with (from -1 to I64_MAX) (default 0)
      -tile-columns      <int>        E..V...... number of tiles columns to encode with (from -1 to I64_MAX) (default 0)
      -rav1e-params      <dictionary> E..V...... set the rav1e configuration using a :-separated list of key=value parameters
    

    I guess I will close this issue now

  7. mati865 commented on Aug 13, 2020

    @mati865
    Member

    Thank you for testing this again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleO-windows-gnuToolchain: GNU, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions