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

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

Closed
1480c1 opened this issue Jan 7, 2020 · 4 comments
Closed

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

1480c1 opened this issue Jan 7, 2020 · 4 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example O-windows-gnu Toolchain: GNU, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@1480c1
Copy link

1480c1 commented Jan 7, 2020

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.com-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

@jonas-schievink jonas-schievink added A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-windows-gnu Toolchain: GNU, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Jan 7, 2020
Centril added a commit to Centril/rust that referenced this issue Apr 7, 2020
…nits, r=alexcrichton

Keep codegen units unmerged when building compiler builtins

Make it possible to control how mono items are partitioned into code generation
units, when compiling the compiler builtins, by retaining the original partitioning.

Helps with rust-lang#48625, rust-lang#61063, rust-lang#67960, rust-lang#70489.

r? @alexcrichton
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 7, 2020
…nits, r=alexcrichton

Keep codegen units unmerged when building compiler builtins

Make it possible to control how mono items are partitioned into code generation
units, when compiling the compiler builtins, by retaining the original partitioning.

Helps with rust-lang#48625, rust-lang#61063, rust-lang#67960, rust-lang#70489.

r? @alexcrichton
@mati865
Copy link
Contributor

mati865 commented Aug 12, 2020

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

@1480c1
Copy link
Author

1480c1 commented Aug 12, 2020

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

@1480c1
Copy link
Author

1480c1 commented Aug 13, 2020

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

@1480c1 1480c1 closed this as completed Aug 13, 2020
@mati865
Copy link
Contributor

mati865 commented Aug 13, 2020

Thank you for testing this again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example O-windows-gnu Toolchain: GNU, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants