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

Rustc 1.78 Undefined Reference to getauxval #125067

Closed
tustvold opened this issue May 13, 2024 · 4 comments
Closed

Rustc 1.78 Undefined Reference to getauxval #125067

tustvold opened this issue May 13, 2024 · 4 comments
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues.

Comments

@tustvold
Copy link

Code

I'm afraid the reproducer is in a fairly chunky docker image, with the wonder that is conda, but I suspect there might be a more generic issue here perhaps??

$ docker run --rm  -it --entrypoint bash apache/arrow-dev:amd64-conda-integration@sha256:16d358c1fe5f333d18bae2a648a780481148ad934fe85cf4a3be1b11f3453998

Then within the image

root@58b3b21939e3:/# cargo new foo 
    Creating binary (application) `foo` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
root@58b3b21939e3:/# cd foo
root@58b3b21939e3:/foo# cargo build
   Compiling foo v0.1.0 (/foo)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/root/.cargo/bin:/opt/dotnet:/opt/go/bin:/opt/conda/envs/arrow/bin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcWacfOo/symbols.o" "/foo/target/debug/deps/foo-1a4ca12c419052ea.2ga73dnhid5ktcdv.rcgu.o" "/foo/target/debug/deps/foo-1a4ca12c419052ea.2sed91ksdwnroxtc.rcgu.o" "/foo/target/debug/deps/foo-1a4ca12c419052ea.3aunm4q4skzx542d.rcgu.o" "/foo/target/debug/deps/foo-1a4ca12c419052ea.5g26b3mprkfaopet.rcgu.o" "/foo/target/debug/deps/foo-1a4ca12c419052ea.fp77cgurnrhx8x.rcgu.o" "/foo/target/debug/deps/foo-1a4ca12c419052ea.s8tfh3w4ij6ieny.rcgu.o" "/foo/target/debug/deps/foo-1a4ca12c419052ea.12algo7j8i75wvxr.rcgu.o" "-Wl,--as-needed" "-L" "/foo/target/debug/deps" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-d2ef02247056996e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-fde67f6c4eccaa42.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-2549d0ec992a5666.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-bb9bfc0931d5cad0.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-7c0b91fdc4adc2c5.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-6ec164769e6c2957.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-95326caaef561554.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-704dba0df3717bb7.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-5f0117cb69112303.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-7a95907f1ed0cea5.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-d4aa666f8242aefc.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-9abec8861e966bc7.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-863ac378b60eeb30.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-fc8aa5b7d220f0a9.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-0cc850f1e941238d.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-f7b445210e88e768.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-f37052492751c579.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-fd15ec7f305d48e7.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-d700583125da6701.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/foo/target/debug/deps/foo-1a4ca12c419052ea" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /opt/conda/envs/arrow/bin/../lib/gcc/x86_64-conda-linux-gnu/12.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-d2ef02247056996e.rlib(std-d2ef02247056996e.std.e4dfbc2c3f4b09f1-cgu.0.rcgu.o): in function `std::sys::pal::unix::stack_overflow::imp::sigstack_size':
          /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys/pal/unix/stack_overflow.rs:216: undefined reference to `getauxval'
          /opt/conda/envs/arrow/bin/../lib/gcc/x86_64-conda-linux-gnu/12.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys/pal/unix/stack_overflow.rs:216: undefined reference to `getauxval'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

error: could not compile `foo` (bin "foo") due to 1 previous error

If you downgrade to version 1.77 compilation works as expected

The version of glibc does not appear to be especially old

root@58b3b21939e3:/foo# ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.7) 2.35
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

Version it worked on

It most recently worked on: Rust 1.77

Version with regression

rustc --version --verbose:

cargo 1.78.0 (54d8815d0 2024-03-26)

This appears to have been introduced by #113525 FYI @workingjubilee

@tustvold tustvold added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels May 13, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 13, 2024
@workingjubilee
Copy link
Member

workingjubilee commented May 13, 2024

@tustvold getauxval is in glibc 2.16 and we demand a higher minimum glibc than that. I am struggling to understand how it is possible for you to link our code at all given we pervasively reference other libc symbols in the stdlib. The only thing I can imagine is that a minimum-qualifying libc is not actually linked in (somehow, yes I see the ldd --version invocation, it's possible something else actually gets found on the PATH... somehow...?) and you essentially lucked out before.

@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-discussion Category: Discussion or questions that doesn't represent real issues. and removed C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-untriaged Untriaged performance or correctness regression. labels May 13, 2024
@workingjubilee
Copy link
Member

Yeah, the problem is in what you've done with conda. apache/arrow-rs#5719 (comment)

Our glibc minimum is 2.17 and you have not followed the directions to cause conda to use the required glibc for linkage. You need to change the sysroot_linux-64 version. We raised the glibc requirements past 2.16 in 2022.

@tustvold
Copy link
Author

Thank you, apologies for the noise, I will see about getting the images updated

@tustvold tustvold closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
@alamb
Copy link
Contributor

alamb commented May 13, 2024

Thank you for the quick response @workingjubilee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues.
Projects
None yet
Development

No branches or pull requests

5 participants