rust-lang / rust-lang/rust

Linking failed with `f16`: `undefined symbol: __floatuntihf` on Ubuntu 20.04

Open
#132,614 7 comments 0 reactions 1 assignee View on GitHub

@tgross35 is already working on this.

Since Nov 4, 2024.

A-linkage C-bug F-f16_and_f128 requires-nightly T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Problem

I'm getting a linking failure on the following program on an Ubuntu 20.04 with x86_64:

#![feature(f16)]

fn main() {
    let _f = (256u128 + 0) as f16;
}
$ cargo +nightly-2024-11-03 --version --verbose
cargo 1.84.0-nightly (031049782 2024-11-01)
release: 1.84.0-nightly
commit-hash: 0310497822a7a673a330a5dd068b7aaa579a265e
commit-date: 2024-11-01
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 20.4.0 (focal) [64-bit]
$ cargo +nightly-2024-11-03 build
   Compiling float_ex v0.1.0 (/home/ubuntu/examples/tmp/float_ex)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/ubuntu/.vscode-server/cli/servers/Stable-65edc4939843c90c34d61f4ce11704f09d3e5cb6/server/bin/remote-cli:/home/ubuntu/.elan/bin:/home/ubuntu/.opam/4.13.1+options/bin:/home/ubuntu/.local/bin:/home/ubuntu/bin:/home/ubuntu/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ubuntu/.dotnet/tools:/home/ubuntu/git/aws-viewer-for-cbmc:/home/ubuntu/git/kani/scripts:/home/ubuntu/git/kissat/build:/home/ubuntu/git/cadical/build:/home/ubuntu/git/cryptominisat/build:/home/ubuntu/git/smack-deps/corral:/home/ubuntu/sources/dafny:/home/ubuntu/git/aeneas/charon/bin:/home/ubuntu/git/aeneas/bin:/home/ubuntu/git/aws-viewer-for-cbmc:/home/ubuntu/git/kani/scripts:/home/ubuntu/git/kissat/build:/home/ubuntu/git/cadical/build:/home/ubuntu/git/cryptominisat/build:/home/ubuntu/git/smack-deps/corral:/home/ubuntu/sources/dafny:/home/ubuntu/git/aeneas/charon/bin:/home/ubuntu/git/aeneas/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcRMryV9/symbols.o" "/home/ubuntu/examples/tmp/float_ex/target/debug/deps/float_ex-554be11968b54f52.1upxk7wgb5be1ozir5i3pcti1.rcgu.o" "/home/ubuntu/examples/tmp/float_ex/target/debug/deps/float_ex-554be11968b54f52.54olmofqxnpy7pq9qy9o2t30g.rcgu.o" "/home/ubuntu/examples/tmp/float_ex/target/debug/deps/float_ex-554be11968b54f52.ch6aaog2yzci5htmyt918ewsf.rcgu.o" "/home/ubuntu/examples/tmp/float_ex/target/debug/deps/float_ex-554be11968b54f52.ci5nx2nl5wy1uyl56j4qhrd42.rcgu.o" "/home/ubuntu/examples/tmp/float_ex/target/debug/deps/float_ex-554be11968b54f52.cs3lb7ej2s3cvd9jn4tnp3blj.rcgu.o" "/home/ubuntu/examples/tmp/float_ex/target/debug/deps/float_ex-554be11968b54f52.626egnrzk7ba7cgmeqeckoth3.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-af54019eb310b9f4.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e370a2465b65d07c.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-8f87839a255517a7.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-16ad4ab169e45609.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-28d1468ba8d7b07b.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-fa4f9f6976fb516c.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-cbd1d7b1bf5aede2.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f1683a071fd1db0a.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-9972421ad1fb0fa7.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-dc54626494bdf80e.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-b64145080abdbf70.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-6b915e9383d4c977.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-32ca42ea576f8b75.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-1fa702f5e51b232e.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-799d520624f8b2e0.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-1af26327f6fe922d.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-395a38b8e0851c9b.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-d453bab70303062c.rlib" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-9ec1a83853f387f8.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-B/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/ubuntu/.rustup/toolchains/nightly-2024-11-03-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/ubuntu/examples/tmp/float_ex/target/debug/deps/float_ex-554be11968b54f52" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: rust-lld: error: undefined symbol: __floatuntihf
          >>> referenced by main.rs:0 (src/main.rs:0)
          >>>               /home/ubuntu/examples/tmp/float_ex/target/debug/deps/float_ex-554be11968b54f52.ch6aaog2yzci5htmyt918ewsf.rcgu.o:(float_ex::main::hdd9d458336af3037)
          >>> did you mean: __floatuntidf
          >>> defined in: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libgcc_s.so.1
          collect2: error: ld returned 1 exit status
          

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

No response

Possible Solution(s)

No response

Notes

No response

Version

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.