denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.89k stars 5.39k forks source link

[upstream] Build failures on aarch64 Linux with glibc 2.26.1 on latest Rust compiler #20131

Closed LukeChannings closed 7 months ago

LukeChannings commented 1 year ago

I have been compiling Deno against glibc 2.26.1 (ubuntu 16.04) for increased compatibility, most notably AWS Lambda.

The release of deno_cache_dir v0.5.0 depends on a later version which has forced an upgrade to Ubuntu 18.04 (glibc 2.30)

It fails with the following error:

#18 179.0    Compiling deno_cache_dir v0.5.0
#18 180.5 error: linking with `cc` failed: exit status: 1
#18 180.5   |
#18 180.5   = note: LC_ALL="C" PATH="/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "-Wl,--version-script=/tmp/rustcRUJo55/list" "-Wl,--no-undefined-version" "/tmp/rustcRUJo55/symbols.o" "/deno/target/release/deps/deno_cache_dir-8cd1e1be67d058cd.deno_cache_dir.bf5665095537e8b5-cgu.0.rcgu.o" "/deno/target/release/deps/deno_cache_dir-8cd1e1be67d058cd.4qp5mhu02gfvfcfl.rcgu.o" "-Wl,--as-needed" "-L" "/deno/target/release/deps" "-L" "/deno/target/release/build/ring-6c8cedad92a22f15/out" "-L" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/deno/target/release/deps/libserde_json-e03c70682fa7e370.rlib" "/deno/target/release/deps/libryu-f5b0e8b3015522f8.rlib" "/deno/target/release/deps/libitoa-0d042663236bb011.rlib" "/deno/target/release/deps/liblog-fa937a2f3f3ab897.rlib" "/deno/target/release/deps/libparking_lot-d4926d1f42203871.rlib" "/deno/target/release/deps/libparking_lot_core-450cdaa49b2afb0a.rlib" "/deno/target/release/deps/libcfg_if-38889dd09f4a491e.rlib" "/deno/target/release/deps/libsmallvec-6d1aebb7a8998e19.rlib" "/deno/target/release/deps/liblock_api-d7d91fcb547223e4.rlib" "/deno/target/release/deps/libscopeguard-f50f1aef82cc20bf.rlib" "/deno/target/release/deps/libindexmap-e6bad887b381ff97.rlib" "/deno/target/release/deps/libequivalent-8cb2cf8bd8c60702.rlib" "/deno/target/release/deps/libhashbrown-5b842ca54ce03c1f.rlib" "/deno/target/release/deps/libdeno_media_type-0ef0bf74110a6814.rlib" "/deno/target/release/deps/libdata_url-090a63930aa396ce.rlib" "/deno/target/release/deps/libthiserror-02a335d27a569383.rlib" "/deno/target/release/deps/libring-5a3bcffb9fc73ee5.rlib" "/deno/target/release/deps/libspin-1129cfebe598ed67.rlib" "/deno/target/release/deps/libuntrusted-a5dcc30bcb4f8a25.rlib" "/deno/target/release/deps/libonce_cell-980fd0d198baddfa.rlib" "/deno/target/release/deps/liblibc-abb1a91c0c67b773.rlib" "/deno/target/release/deps/liburl-12800c7d33fe26d0.rlib" "/deno/target/release/deps/libidna-426e9ae2e2003357.rlib" "/deno/target/release/deps/libunicode_normalization-64d503e613bf6c92.rlib" "/deno/target/release/deps/libtinyvec-5655d95fed51f64c.rlib" "/deno/target/release/deps/libtinyvec_macros-cfde70f85c067b2a.rlib" "/deno/target/release/deps/libunicode_bidi-3264b114da7c7b69.rlib" "/deno/target/release/deps/libform_urlencoded-d0e256eac59b13e6.rlib" "/deno/target/release/deps/libpercent_encoding-b9b191ae89425e92.rlib" "/deno/target/release/deps/libserde-6c2a55a9c90e51d6.rlib" "/deno/target/release/deps/libanyhow-da72a87212c1a104.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-49f405f32420fd6a.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libpanic_unwind-2b2d0fc0b0e1e1ec.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libobject-7cc15c5f0c23404e.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libmemchr-424f9a552277b8de.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libaddr2line-be9e9c3394ea9d59.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libgimli-650021992b21b3a2.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_demangle-f3c8c0feb6f7f8aa.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd_detect-d7ab6e8d31d95747.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libhashbrown-29bef78daca585c7.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-0bb4fc54e64e1928.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libminiz_oxide-dcacb73e0fc82c6c.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libadler-5978245ddc0addd7.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libunwind-fd9fde115279cb3c.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcfg_if-50edd0de903dc776.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-74bb96f0ab3e26e0.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liballoc-60a4032889f46560.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-140890b14fd90465.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcore-67fe04957e868f3a.rlib" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-f261afcc57c36219.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/root/.rustup/toolchains/1.71.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/deno/target/release/deps/libdeno_cache_dir-8cd1e1be67d058cd.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
#18 180.5   = note: /usr/bin/ld: GFp_armcap_P: undefined version:
#18 180.5           /usr/bin/ld: failed to set dynamic section sizes: Bad value

This is certainly a low priority, but I can't actually find the source for deno_cache_dir outside of crates.io - is it hosted in this repo?

sigmaSd commented 1 year ago

The source is here https://github.com/denoland/deno_cache/tree/main/rs_lib

lino-levan commented 1 year ago

Hey Luke, cool to see you around.

dsherret commented 1 year ago

I wonder what caused that. The upgrade seems very tame for the dependencies that were bumped https://github.com/denoland/deno/pull/20092/files#diff-13ee4b2252c9e516a0547f2891aa2105c3ca71c6d7a1e682c69be97998dfc87e (I didn't dig into it in that much detail though)

mmastrac commented 1 year ago

Not sure what is causing it, but this looks like https://github.com/rust-lang/rust/issues/113104

mmastrac commented 1 year ago

@LukeChannings A comment related Rust bug report suggests that using lld may be able to work around this.

https://github.com/rust-lang/rust/issues/111888#issuecomment-1567421827

LukeChannings commented 1 year ago

I compile with the default build-essential toolchain on Ubuntu 16.04 (Xenial) - I haven't been able to compile with clang+llvm-9 or clang+llvm-16 because of compatibility issues with Xenial:

#21 17.63   = note: clang: /lib/aarch64-linux-gnu/libtinfo.so.6: version `NCURSES6_TINFO_5.0.19991023' not found (required by clang)
#21 17.63           clang: /lib/aarch64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by clang)
#21 17.63           clang: /lib/aarch64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by clang)
#21 17.63           clang: /usr/lib/aarch64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by clang)
#21 17.63           clang: /usr/lib/aarch64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by clang)

Looks like it wants glibc >= 2.27, but Xenial has 2.26.1. There are also no APT packages for clang+llvm-9 for aarch64 + xenial, so I can't rule out a misconfiguration of the release bundle (clang+llvm-<version>-aarch64-linux-gnu.tar.xz from llvm-project).

clang+llvm 9 is the earliest I tested, as well as Xenial's APT clang. I am not experienced in configuring clang+llvm though.

mmastrac commented 1 year ago

@LukeChannings As an alternative, can you see if codegen-units = 1 works for you?

saethlin commented 1 year ago

How exactly are people compiling deno_cache_dir? It's a library and this sounds like reports from end users? So I'm guessing this is embedded in some larger build system? I am not an Ubuntu/Debian user but I'll start EC2 instances or Docker containers to imitate whatever environment is producing these errors, if someone can tell me what to do on a fresh system to produce them.

I tried to reproduce these errors on Arch with RUSTFLAGS="-Ccodegen-units=4096" cargo +stable build --target=aarch64-unknown-linux-gnu --release in a download of deno_cache_dir 0.5.0 from crates.io with no success.

LukeChannings commented 1 year ago

@mmastrac

@LukeChannings As an alternative, can you see if codegen-units = 1 works for you?

Compiling with RUSTFLAGS="-Ccodegen-units=1" RUST_BACKTRACE=full cargo build --release --locked --bin deno I get the same error.

@saethlin

My project is at LukeChannings/deno-arm64. You can reproduce it by reverting Dockerfile.compile from FROM ubuntu:18.04 to FROM ubuntu:16.04 (use build.sh).

I'm compiling on an M1 MBP.

mmastrac commented 1 year ago

I can repro using that repo:

#17 200.4   = note: /usr/bin/ld: GFp_armcap_P: undefined version:
#17 200.4           /usr/bin/ld: failed to set dynamic section sizes: Bad value
#17 200.4           collect2: error: ld returned 1 exit status
#17 200.4
#17 200.4
#17 200.4 error: could not compile `deno_cache_dir` (lib) due to previous error
#17 200.4 warning: build failed, waiting for other jobs to finish...
#17 ERROR: executor failed running [/bin/bash -c RUST_BACKTRACE=full cargo build --release --locked --bin deno]: exit code: 101
saethlin commented 1 year ago

This linker error arises due to using ring in a cdylib crate. deno_cache_dir is a cdylib, so that's why you get it here.

I can reproduce this on x86_64 Linux in an Ubuntu 16.04 container without deno_cache_dir, by taking any ring checkout, modifying its Cargo.toml so that under [lib] we have crate-type = ["cdylib"] then running cargo build --target=aarch64-unknown-linux-gnu (you'll need the cross-linker installed and configured).

I'll try to minimize this a bit more then open a fresh issue on rust-lang/rust. I don't think we have seen this bug before.

mmastrac commented 1 year ago

@dsherret Something interesting to note above -- do we have a reason to use cdylib for deno_cache_dir?

dsherret commented 1 year ago

@mmastrac it's used for the wasm build. It could maybe be separated out to a separate crate in the repo.

saethlin commented 1 year ago

@LukeChannings Why did you say that there is a dependency on a newer glibc, as opposed to some other factor in the build?

LukeChannings commented 1 year ago

I don't have solid reasons, it's just what the problem was the last time my builds failed because of a linker issue. Not specifically glibc, but the toolchain associated with a particular version of it I suppose.

That assumption was further reinforced by it being resolved when I upgraded to a later version. glibc 2.26 is pretty old :D

mmastrac commented 1 year ago

This appears to be fixed by https://github.com/rust-lang/rust/pull/115114

@LukeChannings as a temporarily workaround, cargo +nightly build --release should work. At least it worked for me here!

LukeChannings commented 1 year ago

Hmm, I'm actually still getting the same error, using:

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
RUN rustup toolchain install nightly --allow-downgrade --profile minimal --component clippy
RUN RUST_BACKTRACE=full cargo +nightly build --release --locked --bin deno
saethlin commented 1 year ago

Are you sure the Docker cache isn't holding onto an old nightly? I wiped mine and it now builds successfully on nightly.

LukeChannings commented 1 year ago

I made double sure, using nightly-aarch64-unknown-linux-gnu unchanged - rustc 1.74.0-nightly (58eefc33a 2023-08-24):

#19 [14/17] RUN rm /deno/rust-toolchain.toml
#19 DONE 0.1s

#20 [15/17] RUN rustup toolchain list
#20 0.277 nightly-aarch64-unknown-linux-gnu (default)
#20 0.277 1.71.0-aarch64-unknown-linux-gnu
#20 DONE 0.3s

#21 [16/17] RUN rustup default nightly-aarch64-unknown-linux-gnu
#0 0.139 info: using existing install for 'nightly-aarch64-unknown-linux-gnu'
#21 0.140 info: default toolchain set to 'nightly-aarch64-unknown-linux-gnu'
#21 0.140
#21 0.156   nightly-aarch64-unknown-linux-gnu unchanged - rustc 1.74.0-nightly (58eefc33a 2023-08-24)
#21 0.156
#21 DONE 0.2s

...

#22 168.0    Compiling deno_cache_dir v0.5.0
#22 169.5 error: linking with `cc` failed: exit status: 1
#22 169.5   |
#22 169.5   = note: LC_ALL="C" PATH="/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "-Wl,--version-script=/tmp/rustc3ax2zk/list" "-Wl,--no-undefined-version" "/tmp/rustc3ax2zk/symbols.o" "/deno/target/release/deps/deno_cache_dir-6054fb50f75baf1c.deno_cache_dir.350c3c54d2ab56f9-cgu.0.rcgu.o" "/deno/target/release/deps/deno_cache_dir-6054fb50f75baf1c.rfekdhfwlsni0fk.rcgu.o" "-Wl,--as-needed" "-L" "/deno/target/release/deps" "-L" "/deno/target/release/build/ring-2939e6066a348c9a/out" "-L" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/deno/target/release/deps/libserde_json-c832739bfb9c0ed2.rlib" "/deno/target/release/deps/libryu-7afa220e94d10f72.rlib" "/deno/target/release/deps/libitoa-84857e50ccfaceac.rlib" "/deno/target/release/deps/liblog-59cedd0b530a3b1b.rlib" "/deno/target/release/deps/libparking_lot-4eddb692d81d816b.rlib" "/deno/target/release/deps/libparking_lot_core-eaaab14c52389969.rlib" "/deno/target/release/deps/libcfg_if-fe94bc9999797264.rlib" "/deno/target/release/deps/libsmallvec-70aa848d0dbbc10f.rlib" "/deno/target/release/deps/liblock_api-f3fefd1c3fe5b5ca.rlib" "/deno/target/release/deps/libscopeguard-aea7e224ece6e6b7.rlib" "/deno/target/release/deps/libindexmap-30882b1064cfacd7.rlib" "/deno/target/release/deps/libequivalent-eb9ea6a5ee4bebfc.rlib" "/deno/target/release/deps/libhashbrown-439aba572f7bfa72.rlib" "/deno/target/release/deps/libdeno_media_type-23f60a2d0bd8b691.rlib" "/deno/target/release/deps/libdata_url-f7f5b8e92b698532.rlib" "/deno/target/release/deps/libthiserror-021d1400e1f0d3f7.rlib" "/deno/target/release/deps/libring-8b05abba77d95494.rlib" "/deno/target/release/deps/libspin-88ea1d99c9014a5c.rlib" "/deno/target/release/deps/libuntrusted-8c06cd3df835a013.rlib" "/deno/target/release/deps/libonce_cell-6766a18f6597e079.rlib" "/deno/target/release/deps/liblibc-55de32f377cf66f3.rlib" "/deno/target/release/deps/liburl-6aa1bc15f3178431.rlib" "/deno/target/release/deps/libidna-2b70e9402cf8cc11.rlib" "/deno/target/release/deps/libunicode_normalization-ac8e4bf75e359cf6.rlib" "/deno/target/release/deps/libtinyvec-d2cfa16d55880fc8.rlib" "/deno/target/release/deps/libtinyvec_macros-ca96cd7f919ba18d.rlib" "/deno/target/release/deps/libunicode_bidi-8d9023f1207616ec.rlib" "/deno/target/release/deps/libform_urlencoded-6d1e4e04737ce208.rlib" "/deno/target/release/deps/libpercent_encoding-3bc1c0541cddf02c.rlib" "/deno/target/release/deps/libserde-50724e16405095f8.rlib" "/deno/target/release/deps/libanyhow-402cb88059a872af.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-9249011ac669c6aa.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libpanic_unwind-07b7377bcc6c1c10.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libobject-0d9203f1bbcc9c52.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libmemchr-965fc6f1ed3ca067.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libaddr2line-061e8c52da28e161.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libgimli-d12569e26f470fd7.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_demangle-f274666a6c52a253.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd_detect-54388e8058ba42cb.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libhashbrown-0dd441117509bd9e.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-8445b29fbb6bf0ba.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libminiz_oxide-d039e232acbcba06.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libadler-efda95455ee24079.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libunwind-9e8acb5588b2388c.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcfg_if-3c73b8d20a001064.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-88684a4275d72a43.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liballoc-ffb43355384990e9.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-d67d6fef36d10faf.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcore-0853063f4f3ed5e5.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-5da48b5d3d68969b.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/deno/target/release/deps/libdeno_cache_dir-6054fb50f75baf1c.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
#22 169.5   = note: /usr/bin/ld: GFp_armcap_P: undefined version:
#22 169.5           /usr/bin/ld: failed to set dynamic section sizes: Bad value
#22 169.5           collect2: error: ld returned 1 exit status
#22 169.5
#22 169.5
#22 169.5 error: could not compile `deno_cache_dir` (lib) due to previous error
#22 169.5 warning: build failed, waiting for other jobs to finish...
#22 ERROR: process "/bin/bash -c RUST_BACKTRACE=full cargo +nightly build --release --locked --bin deno" did not complete successfully: exit code: 101
------
 > [17/17] RUN RUST_BACKTRACE=full cargo +nightly build --release --locked --bin deno:
#22 169.5 error: linking with `cc` failed: exit status: 1
#22 169.5   |
#22 169.5   = note: LC_ALL="C" PATH="/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "-Wl,--version-script=/tmp/rustc3ax2zk/list" "-Wl,--no-undefined-version" "/tmp/rustc3ax2zk/symbols.o" "/deno/target/release/deps/deno_cache_dir-6054fb50f75baf1c.deno_cache_dir.350c3c54d2ab56f9-cgu.0.rcgu.o" "/deno/target/release/deps/deno_cache_dir-6054fb50f75baf1c.rfekdhfwlsni0fk.rcgu.o" "-Wl,--as-needed" "-L" "/deno/target/release/deps" "-L" "/deno/target/release/build/ring-2939e6066a348c9a/out" "-L" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/deno/target/release/deps/libserde_json-c832739bfb9c0ed2.rlib" "/deno/target/release/deps/libryu-7afa220e94d10f72.rlib" "/deno/target/release/deps/libitoa-84857e50ccfaceac.rlib" "/deno/target/release/deps/liblog-59cedd0b530a3b1b.rlib" "/deno/target/release/deps/libparking_lot-4eddb692d81d816b.rlib" "/deno/target/release/deps/libparking_lot_core-eaaab14c52389969.rlib" "/deno/target/release/deps/libcfg_if-fe94bc9999797264.rlib" "/deno/target/release/deps/libsmallvec-70aa848d0dbbc10f.rlib" "/deno/target/release/deps/liblock_api-f3fefd1c3fe5b5ca.rlib" "/deno/target/release/deps/libscopeguard-aea7e224ece6e6b7.rlib" "/deno/target/release/deps/libindexmap-30882b1064cfacd7.rlib" "/deno/target/release/deps/libequivalent-eb9ea6a5ee4bebfc.rlib" "/deno/target/release/deps/libhashbrown-439aba572f7bfa72.rlib" "/deno/target/release/deps/libdeno_media_type-23f60a2d0bd8b691.rlib" "/deno/target/release/deps/libdata_url-f7f5b8e92b698532.rlib" "/deno/target/release/deps/libthiserror-021d1400e1f0d3f7.rlib" "/deno/target/release/deps/libring-8b05abba77d95494.rlib" "/deno/target/release/deps/libspin-88ea1d99c9014a5c.rlib" "/deno/target/release/deps/libuntrusted-8c06cd3df835a013.rlib" "/deno/target/release/deps/libonce_cell-6766a18f6597e079.rlib" "/deno/target/release/deps/liblibc-55de32f377cf66f3.rlib" "/deno/target/release/deps/liburl-6aa1bc15f3178431.rlib" "/deno/target/release/deps/libidna-2b70e9402cf8cc11.rlib" "/deno/target/release/deps/libunicode_normalization-ac8e4bf75e359cf6.rlib" "/deno/target/release/deps/libtinyvec-d2cfa16d55880fc8.rlib" "/deno/target/release/deps/libtinyvec_macros-ca96cd7f919ba18d.rlib" "/deno/target/release/deps/libunicode_bidi-8d9023f1207616ec.rlib" "/deno/target/release/deps/libform_urlencoded-6d1e4e04737ce208.rlib" "/deno/target/release/deps/libpercent_encoding-3bc1c0541cddf02c.rlib" "/deno/target/release/deps/libserde-50724e16405095f8.rlib" "/deno/target/release/deps/libanyhow-402cb88059a872af.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-9249011ac669c6aa.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libpanic_unwind-07b7377bcc6c1c10.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libobject-0d9203f1bbcc9c52.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libmemchr-965fc6f1ed3ca067.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libaddr2line-061e8c52da28e161.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libgimli-d12569e26f470fd7.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_demangle-f274666a6c52a253.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd_detect-54388e8058ba42cb.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libhashbrown-0dd441117509bd9e.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-8445b29fbb6bf0ba.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libminiz_oxide-d039e232acbcba06.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libadler-efda95455ee24079.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libunwind-9e8acb5588b2388c.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcfg_if-3c73b8d20a001064.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-88684a4275d72a43.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liballoc-ffb43355384990e9.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-d67d6fef36d10faf.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcore-0853063f4f3ed5e5.rlib" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-5da48b5d3d68969b.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/deno/target/release/deps/libdeno_cache_dir-6054fb50f75baf1c.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
#22 169.5   = note: /usr/bin/ld: GFp_armcap_P: undefined version:
#22 169.5           /usr/bin/ld: failed to set dynamic section sizes: Bad value
#22 169.5           collect2: error: ld returned 1 exit status
#22 169.5
#22 169.5
#22 169.5 error: could not compile `deno_cache_dir` (lib) due to previous error
#22 169.5 warning: build failed, waiting for other jobs to finish...
------
Dockerfile.compile:37
--------------------
  35 |     RUN rustup default nightly-aarch64-unknown-linux-gnu
  36 |
  37 | >>> RUN RUST_BACKTRACE=full cargo +nightly build --release --locked --bin deno

Note: I deleted rust_toolchain.toml specifically to make sure there are no other toolchains that might somehow be used - it was also failing with the same error when I didn't remove it.

Full Dockerfile:

FROM ubuntu:16.04

SHELL ["/bin/bash", "-c"]

RUN apt-get update -y
RUN DEBIAN_FRONTEND="noninteractive" TZ="Europe/London" apt-get install -y python curl build-essential unzip git libtool autoconf cmake

ENV PATH="/root/.cargo/bin:${PATH}"

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
RUN rustup toolchain install nightly --allow-downgrade --profile minimal --component clippy

ARG DENO_VERSION

RUN git config --global core.symlinks true
RUN git clone --recurse-submodules https://github.com/denoland/deno.git /deno

WORKDIR /deno

RUN if [ "${DENO_VERSION:0:6}" == "canary" ]; then \
      git checkout "${DENO_VERSION:7}" ; \
    else \
      git checkout "${DENO_VERSION}" ; \
    fi

ADD deno_upgrade_release_url.patch /deno/

RUN patch -p1 < deno_upgrade_release_url.patch

RUN rustup target add wasm32-unknown-unknown
RUN rustup target add wasm32-wasi

RUN rm /deno/rust-toolchain.toml
RUN rustup toolchain list
RUN rustup default nightly-aarch64-unknown-linux-gnu

RUN RUST_BACKTRACE=full cargo +nightly build --release --locked --bin deno
saethlin commented 1 year ago

Using nightly, I can only reproduce this linker error on my M1, not my Linux desktop. Which is incredibly strange to me. What's your host?

I'll try to re-minimize this on my M1 this weekend.

LukeChannings commented 1 year ago

My host is also an M1 Mac. The original error was reproduced in CI, I can try to find some time next week to reproduce it with the latest nightly in that environment - I've just been using Docker on my M1 Mac.

Something strange must be afoot though, since as we know the containers are running in a virtualised Linux guest. I'm not adding any weirdness with QEMU either.

saethlin commented 1 year ago

Ok I'm just daft; the reason the full reproducer only doesn't link on M1 is because the offending static is aarch64-only.

I've also fixed my reproducer and updated the Rust issue with it.

briansmith commented 12 months ago

Thanks for investigating this. I filed a ring issue to fix this: https://github.com/briansmith/ring/issues/1808. Plan to fix it soon.

mmastrac commented 7 months ago

I believe this was closed upstream by @briansmith so I'll close this for now.