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

ENV var RUSTFLAGS="-L..." seems to be ignored #347

Open
MagicalTux opened this issue Oct 2, 2023 · 11 comments
Open

ENV var RUSTFLAGS="-L..." seems to be ignored #347

MagicalTux opened this issue Oct 2, 2023 · 11 comments
Labels
A-Cargo-problem A problem related to cargo itself bug Something isn't working

Comments

@MagicalTux
Copy link

I'm building packages on a system where some libraries might be found in non-standard paths that can typically be queried from pkg-config, but because some packages just assume libs to be in /usr/lib etc I also pass location to those libraries via env vars as -L flags to ensure the linker knows where to find the libraries.

This works fine for cargo build but cargo cbuild fails because it can't find a library despite running in the same environment.

export RUSTFLAGS= -L/pkg/main/sys-libs.llvm-libunwind.libs.linux.amd64/lib64 -L/pkg/main/sys-libs.zlib.core.1.2.13.linux.amd64/lib

cargo cbuild --release --target-dir="capi" --prefix="/pkg/main/${PKG}.core.${PVRF}" --libdir="/pkg/main/${PKG}.libs.${PVRF}/lib$LIB_SUFFIX"

(bunch of successful stuff)

error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib/llvm/14/bin:/usr/lib/llvm/13/bin:/etc/eselect/wine/bin:/opt/cuda/bin:/home/magicaltux/go/bin:/home/magicaltux/.local/bin:/home/magicaltux/dev/flutter/bin:/home/magicaltux/dev/android-studio/bin:/home/magicaltux/Android/Sdk/emulator:/home/magicaltux/Android/Sdk/tools:/home/magicaltux/Android/Sdk/tools/bin:/home/magicaltux/Android/Sdk/platform-tools" VSLANG="1033" "cc" "-m64" "/tmp/rustcltUtcN/symbols.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-a6882d018f128829/build_script_build-a6882d018f128829.build_script_build.b53c17c6700fdef2-cgu.0.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-a6882d018f128829/build_script_build-a6882d018f128829.359cqbz5zfaun8ko.rcgu.o" "-Wl,--as-needed" "-L" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ec5aec7cbe282607.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-16787ad3d30d9011.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libobject-45d041e89c4c6efd.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b2d1202b2eac77af.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-0115c0637bd4a1b8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-869f581e7228cfb6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-fccc770ab8b2cd55.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f15b7f83ddb00b50.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-c56a3594b2d2c256.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-e35e1225d232d10e.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-51bdf68e7a8e34d8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libadler-7b875a5ffe4786d6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-5d73ca3c9a141e08.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d55081bd33a1786a.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-599f991a733eeec3.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-19faa6a69b32e042.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-3127d08486db12d4.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcore-e58d2b7f8e6c47fb.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8ded84404648c325.rlib" "-Wl,-Bdynamic" "-lunwind" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-a6882d018f128829/build_script_build-a6882d018f128829" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lunwind: No such file or directory
          collect2: error: ld returned 1 exit status
@lu-zero
Copy link
Owner

lu-zero commented Oct 3, 2023

I'm quite sure rustflags are passed.

RUSTFLAGS=--impossible cargo cbuild --release --target-dir="capi"
Error: CliError { error: Some(failed to run `rustc` to learn about target-specific information

Caused by:
    process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --impossible --target aarch64-apple-darwin --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
    --- stderr
    error: Unrecognized option: 'impossible'

    ), exit_code: 101 }

And they are passed to the final rustc invocation

RUSTFLAGS=-Limpossible cargo cbuild --release --target-dir="capi" -v
...
     Running `rustc --crate-name example_project --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=168 --crate-type staticlib --crate-type cdylib --crate-type lib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C link-arg=-Wl,-install_name,/usr/local/lib/libexample-project.0.1.dylib,-current_version,0.1.0,-compatibility_version,0.1 -C link-arg=-Wl,-headerpad_max_install_names -Cpanic=abort --cfg cargo_c --print native-static-libs --cfg 'feature="capi"' --cfg 'feature="default"' --cfg 'feature="libc"' -C metadata=2eef654fff5f2e22 --out-dir /Users/lu_zero/Sources/rust/cargo-c/example-project/capi/aarch64-apple-darwin/release/deps --target aarch64-apple-darwin -L dependency=/Users/lu_zero/Sources/rust/cargo-c/example-project/capi/aarch64-apple-darwin/release/deps -L dependency=/Users/lu_zero/Sources/rust/cargo-c/example-project/capi/release/deps --extern libc=/Users/lu_zero/Sources/rust/cargo-c/example-project/capi/aarch64-apple-darwin/release/deps/liblibc-2dd610c72c38048f.rlib -Limpossible`

You need to pass rustc-link-search I'm afraid.

@MagicalTux
Copy link
Author

MagicalTux commented Oct 4, 2023

I'm trying to compile a project named rav1e - I have a script that automatically downloads the source, sets the environment needed for compilation, and then invokes cargo build (works) then cargo cbuild (fails). I could patch the Cargo.toml file to add that rustc-link-search argument but that would mean updating rav1e may need to re-patch the file, so ideally a environment variable solution would be best.

Quite obviously RUSTFLAGS are being ignored since cc doesn't receive any extra link search paths, also it means cargo cbuild behavior differs from cargo build in some way.

Maybe there's a different way to get this working, I'll try patching the Cargo.toml file but ideally it would be nice if the environment variable RUSTFLAGS could affect the cc invocation too as cargo build does

@MagicalTux
Copy link
Author

MagicalTux commented Oct 4, 2023

I've run cargo cbuild -v and got the following output:

running cbuild
RUSTFLAGS=-L/pkg/main/sys-libs.llvm-libunwind.libs.linux.amd64/lib64 -L/pkg/main/sys-libs.zlib.core.1.2.13.linux.amd64/lib
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.67
   Compiling unicode-ident v1.0.12
   Compiling crossbeam-utils v0.8.16
   Compiling libc v0.2.148
   Compiling cfg-if v1.0.0
   Compiling rayon-core v1.12.0
   Compiling pkg-config v0.3.27
   Compiling version_check v0.9.4
   Compiling vcpkg v0.2.15
   Compiling serde v1.0.188
     Running `rustc --crate-name autocfg /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/autocfg-1.1.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=97f8b1bd7b155de9 -C extra-filename=-97f8b1bd7b155de9 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name build_script_build --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.67/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=f518623cd41db19c -C extra-filename=-f518623cd41db19c --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/proc-macro2-f518623cd41db19c -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name unicode_ident --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.12/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=d8249f9581950758 -C extra-filename=-d8249f9581950758 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/crossbeam-utils-0.8.16/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=8354ba3c6b1de70e -C extra-filename=-8354ba3c6b1de70e --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/crossbeam-utils-8354ba3c6b1de70e -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name build_script_build /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.148/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=662ccc26ea7fecb8 -C extra-filename=-662ccc26ea7fecb8 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-662ccc26ea7fecb8 -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name cfg_if --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cfg-if-1.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C linker-plugin-lto -C debuginfo=2 -C metadata=8d62c252234d4b58 -C extra-filename=-8d62c252234d4b58 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/x86_64-unknown-linux-gnu/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow -L/pkg/main/sys-libs.llvm-libunwind.libs.linux.amd64/lib64 -L/pkg/main/sys-libs.zlib.core.1.2.13.linux.amd64/lib`
     Running `rustc --crate-name build_script_build --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.0/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=8986c9c43f3796f0 -C extra-filename=-8986c9c43f3796f0 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-8986c9c43f3796f0 -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name build_script_build /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.148/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' -C metadata=d1ea4ffcc89e335c -C extra-filename=-d1ea4ffcc89e335c --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-d1ea4ffcc89e335c -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name pkg_config /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pkg-config-0.3.27/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=14ed9b71b8d44c4a -C extra-filename=-14ed9b71b8d44c4a --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name version_check /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/version_check-0.9.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=e5b6571960a2b70a -C extra-filename=-e5b6571960a2b70a --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name vcpkg /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/vcpkg-0.2.15/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=e0790b349c17a68f -C extra-filename=-e0790b349c17a68f --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.188/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="serde_derive"' --cfg 'feature="std"' -C metadata=d7fdbe1be15abe22 -C extra-filename=-d7fdbe1be15abe22 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/serde-d7fdbe1be15abe22 -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
   Compiling tinyvec_macros v0.1.1
     Running `rustc --crate-name tinyvec_macros --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tinyvec_macros-0.1.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=68f96ecd8cd89902 -C extra-filename=-68f96ecd8cd89902 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
   Compiling tinyvec v1.6.0
     Running `rustc --crate-name tinyvec --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tinyvec-1.6.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="tinyvec_macros"' -C metadata=56e473c6ee457fae -C extra-filename=-56e473c6ee457fae --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --extern tinyvec_macros=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps/libtinyvec_macros-68f96ecd8cd89902.rmeta --cap-lints allow`
     Running `rustc --crate-name cfg_if --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cfg-if-1.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=c245081b27ddf4c4 -C extra-filename=-c245081b27ddf4c4 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib/llvm/14/bin:/usr/lib/llvm/13/bin:/etc/eselect/wine/bin:/opt/cuda/bin:/home/magicaltux/go/bin:/home/magicaltux/.local/bin:/home/magicaltux/dev/flutter/bin:/home/magicaltux/dev/android-studio/bin:/home/magicaltux/Android/Sdk/emulator:/home/magicaltux/Android/Sdk/tools:/home/magicaltux/Android/Sdk/tools/bin:/home/magicaltux/Android/Sdk/platform-tools" VSLANG="1033" "cc" "-m64" "/tmp/rustc9RV2Go/symbols.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-8986c9c43f3796f0/build_script_build-8986c9c43f3796f0.build_script_build.dd8b0d3211047249-cgu.0.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-8986c9c43f3796f0/build_script_build-8986c9c43f3796f0.34u6rx26dehknzo6.rcgu.o" "-Wl,--as-needed" "-L" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ec5aec7cbe282607.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-16787ad3d30d9011.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libobject-45d041e89c4c6efd.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b2d1202b2eac77af.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-0115c0637bd4a1b8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-869f581e7228cfb6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-fccc770ab8b2cd55.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f15b7f83ddb00b50.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-c56a3594b2d2c256.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-e35e1225d232d10e.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-51bdf68e7a8e34d8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libadler-7b875a5ffe4786d6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-5d73ca3c9a141e08.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d55081bd33a1786a.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-599f991a733eeec3.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-19faa6a69b32e042.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-3127d08486db12d4.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcore-e58d2b7f8e6c47fb.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8ded84404648c325.rlib" "-Wl,-Bdynamic" "-lunwind" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-8986c9c43f3796f0/build_script_build-8986c9c43f3796f0" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lunwind: No such file or directory
          collect2: error: ld returned 1 exit status
          

   Compiling scopeguard v1.2.0
error: could not compile `rayon-core` (build script) due to previous error
[more errors]

Out of the 16 calls to rustc happening before the failure, only one has RUSTFLAGS properly added.

Also an extra note, not setting RUSTFLAGS will cause cargo build to fail as well, so it seems cargo build uses those flags appropriately. I have no idea how/what/why as I'm not a rust developer and just trying to have software build, but I'm hoping we can find a way to get things working.

@MagicalTux
Copy link
Author

I tried creating a .cargo/config.toml file as suggested too but this didn't work. I'm guessing it might be because the linking to libunwind isn't coming from the project itself but a dependency? Anyway this had no effect at all:

[target.x86_64-unknown-linux-gnu.unwind]
rustc-link-lib = ["unwind"]
rustc-link-search = ["/pkg/main/sys-libs.llvm-libunwind.libs.linux.amd64/lib64"]
rustc-flags = "-L/pkg/main/sys-libs.llvm-libunwind.libs.linux.amd64/lib64"

@lu-zero
Copy link
Owner

lu-zero commented Oct 4, 2023

I'm trying to compile a project named rav1e - I have a script that automatically downloads the source, sets the environment needed for compilation, and then invokes cargo build (works) then cargo cbuild (fails). I could patch the Cargo.toml file to add that rustc-link-search argument but that would mean updating rav1e may need to re-patch the file, so ideally a environment variable solution would be best.

You do not have to patch anything, see the linked cargo documentation :)

Quite obviously RUSTFLAGS are being ignored since cc doesn't receive any extra link search paths, also it means cargo cbuild behavior differs from cargo build in some way.
Maybe there's a different way to get this working, I'll try patching the Cargo.toml file but ideally it would be nice if the environment variable RUSTFLAGS could affect the cc invocation too as cargo build does

The problems seems rayon-core, you may set also the env var for {target_arch}_RUSTFLAGS and see if that solves the problem. cargo-c implicitly sets the target. Keep in mind that in general if cc-rs is involved you should also set the {target_arch}_{{C,LD},...FLAGS}

I'll document the behaviour better since it is an interesting pitfall.

@MagicalTux
Copy link
Author

I didn't post it in full because it's a huge error log and just added [more errors] but most of the packages fail to build without the proper flags. Cargo by default launches as many compilation threads as I have CPUs and rayon-core just happened to be the first one to fail that time.

I tried setting variables such as x86_64_RUSTFLAGS x86_64_CFLAGS and x86_64_LDFLAGS without any success and couldn't find much information on what {target_arch} would be, I'm not at all a rust dev so any help would be welcome (by the way CPPFLAGS and LDFLAGS are already set by default by my build process).

@MagicalTux
Copy link
Author

I finally got this working with a less clean method, but it's OK since this is run in a temporary environment that is rebuilt on each build.

# replace rustc with a wrapper because cargo-cbuild seems to block any rustflags
rm /bin/rustc
cat >/bin/rustc <<EOF
#!/bin/sh
exec /pkg/main/dev-lang.rust.core/bin/rustc $RUSTFLAGS "\$@"
EOF
chmod +x /bin/rustc

This allows forcing the injection of RUSTFLAGS and build successfully now, I do believe however that cargo-cbuild should honor RUSTFLAGS the same way cargo build does - or provide an alternative to do that.

@lu-zero
Copy link
Owner

lu-zero commented Oct 5, 2023

I looked at it again.

cargo cbuild is equivalent to cargo build --target x86_64-unknown-linux-gnu in your case, so the way to pass rustflags by env should be over CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS.

So the additional rustflags are not passed to the build-only-dependencies while target-dependencies get the rustflags passed.

But your build dependencies also need the same flags.

@MagicalTux
Copy link
Author

I tried adding the following line before cargo cbuild but it didn't seem to have any effect.

export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="$RUSTFLAGS"

Still results in:

running cbuild
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.67
   Compiling unicode-ident v1.0.12
   Compiling crossbeam-utils v0.8.16
   Compiling libc v0.2.148
   Compiling cfg-if v1.0.0
   Compiling rayon-core v1.12.0
   Compiling pkg-config v0.3.27
   Compiling tinyvec_macros v0.1.1
   Compiling version_check v0.9.4
   Compiling serde v1.0.188
     Running `rustc --crate-name autocfg /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/autocfg-1.1.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=97f8b1bd7b155de9 -C extra-filename=-97f8b1bd7b155de9 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name build_script_build --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.67/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=f518623cd41db19c -C extra-filename=-f518623cd41db19c --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/proc-macro2-f518623cd41db19c -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name unicode_ident --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.12/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=d8249f9581950758 -C extra-filename=-d8249f9581950758 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/crossbeam-utils-0.8.16/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=8354ba3c6b1de70e -C extra-filename=-8354ba3c6b1de70e --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/crossbeam-utils-8354ba3c6b1de70e -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name build_script_build /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.148/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=662ccc26ea7fecb8 -C extra-filename=-662ccc26ea7fecb8 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-662ccc26ea7fecb8 -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name cfg_if --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cfg-if-1.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C linker-plugin-lto -C debuginfo=2 -C metadata=8d62c252234d4b58 -C extra-filename=-8d62c252234d4b58 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/x86_64-unknown-linux-gnu/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow -L/pkg/main/sys-libs.llvm-libunwind.libs.linux.amd64/lib64 -L/pkg/main/sys-libs.zlib.core.1.2.13.linux.amd64/lib`
     Running `rustc --crate-name build_script_build --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.0/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=8986c9c43f3796f0 -C extra-filename=-8986c9c43f3796f0 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-8986c9c43f3796f0 -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name pkg_config /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pkg-config-0.3.27/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=14ed9b71b8d44c4a -C extra-filename=-14ed9b71b8d44c4a --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name build_script_build /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.148/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' -C metadata=d1ea4ffcc89e335c -C extra-filename=-d1ea4ffcc89e335c --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-d1ea4ffcc89e335c -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name tinyvec_macros --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tinyvec_macros-0.1.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=68f96ecd8cd89902 -C extra-filename=-68f96ecd8cd89902 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name version_check /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/version_check-0.9.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=e5b6571960a2b70a -C extra-filename=-e5b6571960a2b70a --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
     Running `rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.188/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="serde_derive"' --cfg 'feature="std"' -C metadata=d7fdbe1be15abe22 -C extra-filename=-d7fdbe1be15abe22 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/serde-d7fdbe1be15abe22 -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
   Compiling vcpkg v0.2.15
     Running `rustc --crate-name vcpkg /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/vcpkg-0.2.15/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=e0790b349c17a68f -C extra-filename=-e0790b349c17a68f --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
   Compiling tinyvec v1.6.0
     Running `rustc --crate-name tinyvec --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tinyvec-1.6.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="tinyvec_macros"' -C metadata=56e473c6ee457fae -C extra-filename=-56e473c6ee457fae --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --extern tinyvec_macros=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps/libtinyvec_macros-68f96ecd8cd89902.rmeta --cap-lints allow`
     Running `rustc --crate-name cfg_if --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cfg-if-1.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=c245081b27ddf4c4 -C extra-filename=-c245081b27ddf4c4 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow`
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib/llvm/14/bin:/usr/lib/llvm/13/bin:/etc/eselect/wine/bin:/opt/cuda/bin:/home/magicaltux/go/bin:/home/magicaltux/.local/bin:/home/magicaltux/dev/flutter/bin:/home/magicaltux/dev/android-studio/bin:/home/magicaltux/Android/Sdk/emulator:/home/magicaltux/Android/Sdk/tools:/home/magicaltux/Android/Sdk/tools/bin:/home/magicaltux/Android/Sdk/platform-tools" VSLANG="1033" "cc" "-m64" "/tmp/rustc1YKcop/symbols.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-8986c9c43f3796f0/build_script_build-8986c9c43f3796f0.build_script_build.dd8b0d3211047249-cgu.0.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-8986c9c43f3796f0/build_script_build-8986c9c43f3796f0.34u6rx26dehknzo6.rcgu.o" "-Wl,--as-needed" "-L" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ec5aec7cbe282607.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-16787ad3d30d9011.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libobject-45d041e89c4c6efd.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b2d1202b2eac77af.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-0115c0637bd4a1b8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-869f581e7228cfb6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-fccc770ab8b2cd55.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f15b7f83ddb00b50.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-c56a3594b2d2c256.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-e35e1225d232d10e.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-51bdf68e7a8e34d8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libadler-7b875a5ffe4786d6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-5d73ca3c9a141e08.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d55081bd33a1786a.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-599f991a733eeec3.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-19faa6a69b32e042.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-3127d08486db12d4.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcore-e58d2b7f8e6c47fb.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8ded84404648c325.rlib" "-Wl,-Bdynamic" "-lunwind" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-8986c9c43f3796f0/build_script_build-8986c9c43f3796f0" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lunwind: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: could not compile `rayon-core` (build script) due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name build_script_build --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.0/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=8986c9c43f3796f0 -C extra-filename=-8986c9c43f3796f0 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/rayon-core-8986c9c43f3796f0 -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow` (exit status: 1)
warning: build failed, waiting for other jobs to finish...
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib/llvm/14/bin:/usr/lib/llvm/13/bin:/etc/eselect/wine/bin:/opt/cuda/bin:/home/magicaltux/go/bin:/home/magicaltux/.local/bin:/home/magicaltux/dev/flutter/bin:/home/magicaltux/dev/android-studio/bin:/home/magicaltux/Android/Sdk/emulator:/home/magicaltux/Android/Sdk/tools:/home/magicaltux/Android/Sdk/tools/bin:/home/magicaltux/Android/Sdk/platform-tools" VSLANG="1033" "cc" "-m64" "/tmp/rustcHSJ2uu/symbols.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/crossbeam-utils-8354ba3c6b1de70e/build_script_build-8354ba3c6b1de70e.build_script_build.6018855175b7c7cb-cgu.0.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/crossbeam-utils-8354ba3c6b1de70e/build_script_build-8354ba3c6b1de70e.build_script_build.6018855175b7c7cb-cgu.1.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/crossbeam-utils-8354ba3c6b1de70e/build_script_build-8354ba3c6b1de70e.59fzaco0vqigz2dh.rcgu.o" "-Wl,--as-needed" "-L" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ec5aec7cbe282607.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-16787ad3d30d9011.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libobject-45d041e89c4c6efd.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b2d1202b2eac77af.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-0115c0637bd4a1b8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-869f581e7228cfb6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-fccc770ab8b2cd55.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f15b7f83ddb00b50.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-c56a3594b2d2c256.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-e35e1225d232d10e.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-51bdf68e7a8e34d8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libadler-7b875a5ffe4786d6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-5d73ca3c9a141e08.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d55081bd33a1786a.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-599f991a733eeec3.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-19faa6a69b32e042.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-3127d08486db12d4.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcore-e58d2b7f8e6c47fb.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8ded84404648c325.rlib" "-Wl,-Bdynamic" "-lunwind" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/crossbeam-utils-8354ba3c6b1de70e/build_script_build-8354ba3c6b1de70e" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lunwind: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: could not compile `crossbeam-utils` (build script) due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/crossbeam-utils-0.8.16/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=8354ba3c6b1de70e -C extra-filename=-8354ba3c6b1de70e --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/crossbeam-utils-8354ba3c6b1de70e -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow` (exit status: 1)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib/llvm/14/bin:/usr/lib/llvm/13/bin:/etc/eselect/wine/bin:/opt/cuda/bin:/home/magicaltux/go/bin:/home/magicaltux/.local/bin:/home/magicaltux/dev/flutter/bin:/home/magicaltux/dev/android-studio/bin:/home/magicaltux/Android/Sdk/emulator:/home/magicaltux/Android/Sdk/tools:/home/magicaltux/Android/Sdk/tools/bin:/home/magicaltux/Android/Sdk/platform-tools" VSLANG="1033" "cc" "-m64" "/tmp/rustc8myq4u/symbols.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/serde-d7fdbe1be15abe22/build_script_build-d7fdbe1be15abe22.build_script_build.781a4c4de05a92f8-cgu.0.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/serde-d7fdbe1be15abe22/build_script_build-d7fdbe1be15abe22.build_script_build.781a4c4de05a92f8-cgu.1.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/serde-d7fdbe1be15abe22/build_script_build-d7fdbe1be15abe22.39ipoz3czqnaddxe.rcgu.o" "-Wl,--as-needed" "-L" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ec5aec7cbe282607.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-16787ad3d30d9011.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libobject-45d041e89c4c6efd.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b2d1202b2eac77af.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-0115c0637bd4a1b8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-869f581e7228cfb6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-fccc770ab8b2cd55.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f15b7f83ddb00b50.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-c56a3594b2d2c256.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-e35e1225d232d10e.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-51bdf68e7a8e34d8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libadler-7b875a5ffe4786d6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-5d73ca3c9a141e08.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d55081bd33a1786a.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-599f991a733eeec3.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-19faa6a69b32e042.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-3127d08486db12d4.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcore-e58d2b7f8e6c47fb.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8ded84404648c325.rlib" "-Wl,-Bdynamic" "-lunwind" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/serde-d7fdbe1be15abe22/build_script_build-d7fdbe1be15abe22" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lunwind: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: could not compile `serde` (build script) due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name build_script_build --edition=2018 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.188/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="serde_derive"' --cfg 'feature="std"' -C metadata=d7fdbe1be15abe22 -C extra-filename=-d7fdbe1be15abe22 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/serde-d7fdbe1be15abe22 -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow` (exit status: 1)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib/llvm/14/bin:/usr/lib/llvm/13/bin:/etc/eselect/wine/bin:/opt/cuda/bin:/home/magicaltux/go/bin:/home/magicaltux/.local/bin:/home/magicaltux/dev/flutter/bin:/home/magicaltux/dev/android-studio/bin:/home/magicaltux/Android/Sdk/emulator:/home/magicaltux/Android/Sdk/tools:/home/magicaltux/Android/Sdk/tools/bin:/home/magicaltux/Android/Sdk/platform-tools" VSLANG="1033" "cc" "-m64" "/tmp/rustcpkU9y5/symbols.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/proc-macro2-f518623cd41db19c/build_script_build-f518623cd41db19c.build_script_build.2742115e25838a13-cgu.0.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/proc-macro2-f518623cd41db19c/build_script_build-f518623cd41db19c.build_script_build.2742115e25838a13-cgu.1.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/proc-macro2-f518623cd41db19c/build_script_build-f518623cd41db19c.build_script_build.2742115e25838a13-cgu.2.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/proc-macro2-f518623cd41db19c/build_script_build-f518623cd41db19c.4j9ubmxh7cgs8zhs.rcgu.o" "-Wl,--as-needed" "-L" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ec5aec7cbe282607.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-16787ad3d30d9011.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libobject-45d041e89c4c6efd.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b2d1202b2eac77af.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-0115c0637bd4a1b8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-869f581e7228cfb6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-fccc770ab8b2cd55.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f15b7f83ddb00b50.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-c56a3594b2d2c256.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-e35e1225d232d10e.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-51bdf68e7a8e34d8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libadler-7b875a5ffe4786d6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-5d73ca3c9a141e08.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d55081bd33a1786a.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-599f991a733eeec3.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-19faa6a69b32e042.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-3127d08486db12d4.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcore-e58d2b7f8e6c47fb.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8ded84404648c325.rlib" "-Wl,-Bdynamic" "-lunwind" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/proc-macro2-f518623cd41db19c/build_script_build-f518623cd41db19c" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lunwind: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: could not compile `proc-macro2` (build script) due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name build_script_build --edition=2021 /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.67/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=f518623cd41db19c -C extra-filename=-f518623cd41db19c --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/proc-macro2-f518623cd41db19c -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow` (exit status: 1)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib/llvm/14/bin:/usr/lib/llvm/13/bin:/etc/eselect/wine/bin:/opt/cuda/bin:/home/magicaltux/go/bin:/home/magicaltux/.local/bin:/home/magicaltux/dev/flutter/bin:/home/magicaltux/dev/android-studio/bin:/home/magicaltux/Android/Sdk/emulator:/home/magicaltux/Android/Sdk/tools:/home/magicaltux/Android/Sdk/tools/bin:/home/magicaltux/Android/Sdk/platform-tools" VSLANG="1033" "cc" "-m64" "/tmp/rustcifPvVm/symbols.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-662ccc26ea7fecb8/build_script_build-662ccc26ea7fecb8.build_script_build.ca40ae7591de65fd-cgu.0.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-662ccc26ea7fecb8/build_script_build-662ccc26ea7fecb8.build_script_build.ca40ae7591de65fd-cgu.1.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-662ccc26ea7fecb8/build_script_build-662ccc26ea7fecb8.build_script_build.ca40ae7591de65fd-cgu.2.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-662ccc26ea7fecb8/build_script_build-662ccc26ea7fecb8.build_script_build.ca40ae7591de65fd-cgu.3.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-662ccc26ea7fecb8/build_script_build-662ccc26ea7fecb8.2gtgpsziti4xuzp6.rcgu.o" "-Wl,--as-needed" "-L" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ec5aec7cbe282607.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-16787ad3d30d9011.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libobject-45d041e89c4c6efd.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b2d1202b2eac77af.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-0115c0637bd4a1b8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-869f581e7228cfb6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-fccc770ab8b2cd55.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f15b7f83ddb00b50.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-c56a3594b2d2c256.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-e35e1225d232d10e.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-51bdf68e7a8e34d8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libadler-7b875a5ffe4786d6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-5d73ca3c9a141e08.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d55081bd33a1786a.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-599f991a733eeec3.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-19faa6a69b32e042.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-3127d08486db12d4.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcore-e58d2b7f8e6c47fb.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8ded84404648c325.rlib" "-Wl,-Bdynamic" "-lunwind" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-662ccc26ea7fecb8/build_script_build-662ccc26ea7fecb8" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lunwind: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: could not compile `libc` (build script) due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name build_script_build /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.148/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=662ccc26ea7fecb8 -C extra-filename=-662ccc26ea7fecb8 --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-662ccc26ea7fecb8 -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow` (exit status: 1)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib/llvm/14/bin:/usr/lib/llvm/13/bin:/etc/eselect/wine/bin:/opt/cuda/bin:/home/magicaltux/go/bin:/home/magicaltux/.local/bin:/home/magicaltux/dev/flutter/bin:/home/magicaltux/dev/android-studio/bin:/home/magicaltux/Android/Sdk/emulator:/home/magicaltux/Android/Sdk/tools:/home/magicaltux/Android/Sdk/tools/bin:/home/magicaltux/Android/Sdk/platform-tools" VSLANG="1033" "cc" "-m64" "/tmp/rustcTiqsr4/symbols.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-d1ea4ffcc89e335c/build_script_build-d1ea4ffcc89e335c.build_script_build.660d7f7786a948d1-cgu.0.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-d1ea4ffcc89e335c/build_script_build-d1ea4ffcc89e335c.build_script_build.660d7f7786a948d1-cgu.1.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-d1ea4ffcc89e335c/build_script_build-d1ea4ffcc89e335c.build_script_build.660d7f7786a948d1-cgu.2.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-d1ea4ffcc89e335c/build_script_build-d1ea4ffcc89e335c.build_script_build.660d7f7786a948d1-cgu.3.rcgu.o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-d1ea4ffcc89e335c/build_script_build-d1ea4ffcc89e335c.be6ev8xphwm0sez.rcgu.o" "-Wl,--as-needed" "-L" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ec5aec7cbe282607.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-16787ad3d30d9011.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libobject-45d041e89c4c6efd.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b2d1202b2eac77af.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-0115c0637bd4a1b8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-869f581e7228cfb6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-fccc770ab8b2cd55.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f15b7f83ddb00b50.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-c56a3594b2d2c256.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-e35e1225d232d10e.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-51bdf68e7a8e34d8.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libadler-7b875a5ffe4786d6.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-5d73ca3c9a141e08.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d55081bd33a1786a.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-599f991a733eeec3.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-19faa6a69b32e042.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-3127d08486db12d4.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcore-e58d2b7f8e6c47fb.rlib" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8ded84404648c325.rlib" "-Wl,-Bdynamic" "-lunwind" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/pkg/main/dev-lang.rust.libs.1.72.1.linux.amd64/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-d1ea4ffcc89e335c/build_script_build-d1ea4ffcc89e335c" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lunwind: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: could not compile `libc` (build script) due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name build_script_build /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.148/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=254 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' -C metadata=d1ea4ffcc89e335c -C extra-filename=-d1ea4ffcc89e335c --out-dir /build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/build/libc-d1ea4ffcc89e335c -L dependency=/build/rav1e-0.6.6/work/rav1e-0.6.6/capi/release/deps --cap-lints allow` (exit status: 1)
Error: CliError { error: Some(6 jobs failed), exit_code: 101 }

@lu-zero
Copy link
Owner

lu-zero commented Oct 5, 2023

if you do cargo build --target x86_64-unknown-linux-gnu you have the same problem.

Today and the past days are hectic, so I cannot lookup which is the correct env var to tell cargo to pass flags to the rustc call used to build the build.rs dependencies. RUSTFLAGS acts as blanket only if you do not pass --target and cargo-c has to do that.

You found a good corner case to tackle.

@lu-zero lu-zero added bug Something isn't working A-Cargo-problem A problem related to cargo itself labels Oct 5, 2023
@lu-zero
Copy link
Owner

lu-zero commented Mar 28, 2024

Once rust-lang/cargo#9452 hits stable your problem would be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Cargo-problem A problem related to cargo itself bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants