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

Rust 1.73.0 fails to build on powerpc-unknown-freebsd (regression from 1.72.0) #116845

Open
pkubaj opened this issue Oct 17, 2023 · 6 comments
Open
Labels
C-bug Category: This is a bug. O-freebsd Operating system: FreeBSD P-medium Medium priority regression-untriaged Untriaged performance or correctness regression.

Comments

@pkubaj
Copy link
Contributor

pkubaj commented Oct 17, 2023

This is FreeBSD 14.0-RC1 on powerpc (powerpc64 and powerpc64le build and work fine).
1.72.0 builds fine, but 1.73.0:

    Checking core v0.0.0 (/wrkdirs/usr/ports/lang/rust/work/rustc-1.73.0-src/library/core)
     Running `CARGO=/wrkdirs/usr/ports/lang/rust/work/bootstrap/bin/cargo CARGO_CRATE_NAME=core CARGO_MANIFEST_DIR=/wrkdirs/usr/ports/lang/rust/work/rustc-1.73.0-src/library/core CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='The Rust Core Library' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=core CARGO_PKG_README='' CARGO_PKG_REPOSITORY='https://github.com/rust-lang/rust.git' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.0.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 LD_LIBRARY_PATH='/wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/stage2-std/powerpc-unknown-freebsd/doc/release/deps:/wrkdirs/usr/ports/lang/rust/work/bootstrap/lib' /wrkdirs/usr/ports/lang/rust/work/_build/bootstrap/debug/rustc
--crate-name core --edition=2021 library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=153 --crate-type lib --emit=dep-info,metadata -C opt-level=3 -C embed-bitcode=no -Zunstable-options --check-cfg 'names()' --check-cfg 'values()' -C metadata=790b88ec91d684ee -C extra-filename=-790b88ec91d684ee --out-dir /wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/stage2-std/powerpc-unknown-freebsd/doc/powerpc-unknown-freebsd/release/deps --target powerpc-unknown-freebsd -C linker=/wrkdirs/usr/ports/lang/rust/work/ld-wrapper -L dependency=/wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/stage2-std/powerpc-unknown-freebsd/doc/powerpc-unknown-freebsd/release/deps -L dependency=/wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/stage2-std/powerpc-unknown-freebsd/doc/release/deps -L/usr/local/lib/gcc12 -Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options '--check-cfg=values(bootstrap)' '--check-cfg=values(stdarch_intel_sde)' '--check-cfg=values(no_fp_fmt_parse)' '--check-cfg=values(no_global_oom_handling)' '--check-cfg=values(no_rc)' '--check-cfg=values(no_sync)' '--check-cfg=values(freebsd12)' '--check-cfg=values(freebsd13)' '--check-cfg=values(backtrace_in_libstd)' '--check-cfg=values(target_vendor,"unikraft")' '--check-cfg=values(target_env,"libnx")' '--check-cfg=values(target_os,"teeos")' '--check-cfg=values(target_arch,"asmjs","spirv","nvptx","xtensa","mips32r6","mips64r6","csky")' -Zmacro-backtrace -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Zunstable-options -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Cembed-bitcode=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/1.73.0/")' -Z binary-dep-depinfo`
error[E0004]: non-exhaustive patterns: `ControlFlow::Continue(_)` not covered
    --> library/core/src/iter/traits/iterator.rs:3022:32
     |
3022 |             move |(), x| match f(&x).branch() {
     |                                ^^^^^^^^^^^^^^ pattern `ControlFlow::Continue(_)` not covered
     |
note: `ControlFlow<R, bool>` defined here
    --> library/core/src/ops/control_flow.rs:89:5
     |
85   | pub enum ControlFlow<B, C = ()> {
     |          -----------
...
89   |     Continue(C),
     |     ^^^^^^^^ not covered
     = note: the matched value is of type `ControlFlow<R, bool>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
     |
3025 ~                 ControlFlow::Break(r) => ControlFlow::Break(FromResidual::from_residual(r)),
3026 ~                 ControlFlow::Continue(_) => todo!(),
     |

warning: variable does not need to be mutable
    --> library/core/src/iter/traits/iterator.rs:3016:13
     |
3016 |             mut f: impl FnMut(&I) -> V,
     |             ----^
     |             |
     |             help: remove this `mut`
     |
     = note: `#[warn(unused_mut)]` on by default

For more information about this error, try `rustc --explain E0004`.

Did not run successfully: exit status: 1
@pkubaj pkubaj added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Oct 17, 2023
@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 Oct 17, 2023
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Oct 18, 2023
@he32
Copy link
Contributor

he32 commented Oct 21, 2023

I see a similar problem on NetBSD/macppc 10.0_BETA (32-bit powerpc) when rust is built with the embedded LLVM. In my case, the errors emitted are:

   Compiling cc v1.0.79
     Running `/usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/build/bootstrap/debug/rustc --crate-name cc --edition=2018 /usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/vendor/cc/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="jobserver"' --cfg 'feature="parallel"' -Zunstable-options --check-cfg 'values(feature, "jobserver", "parallel")' --check-cfg 'names()' --check-cfg 'values()' -C metadata=91e1216a03968704 -C extra-filename=-91e1216a03968704 --out-dir /usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/build/powerpc-unknown-netbsd/stage2-tools/release/deps -L dependency=/usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/build/powerpc-unknown-netbsd/stage2-tools/release/deps --extern jobserver=/usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/build/powerpc-unknown-netbsd/stage2-tools/release/deps/libjobserver-fb2cbaa448fd5a50.rmeta --cap-lints allow -Z binary-dep-depinfo`
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
    --> /usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/vendor/cc/src/lib.rs:1585:38
     |
1585 |                 let crt_flag = match self.static_crt {
     |                                      ^^^^^^^^^^^^^^^ pattern `Some(_)` not covered
     |
note: `Option<bool>` defined here
    --> /usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/library/core/src/option.rs:571:5
     |
563  | pub enum Option<T> {
     | ------------------
...
571  |     Some(#[stable(feature = "rust1", since = "1.0.0")] T),
     |     ^^^^ not covered
     = note: the matched value is of type `Option<bool>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
     |
1597 ~                     },
1598 +                     Some(_) => todo!()
     |

For more information about this error, try `rustc --explain E0004`.

Did not run successfully: exit status: 1

However, if, instead, rust is built with an external LLVM, version 15.0.7, the build succeeds(!)

The LLVM embedded in rust version 1.73.0 appears to be version 17.0.2.

@nikic
Copy link
Contributor

nikic commented Oct 21, 2023

Can you please try beta (or alternatively LLVM 17.0.3)? It contains a miscompilation fix for PowerPC targets that may be relevant.

@he32
Copy link
Contributor

he32 commented Oct 21, 2023

Hmm, I've not done that before. Is there a tar-ball available of beta which includes all the vendored sources (something which my current build setup relies on)? Or... It may be easier to extract the diff between llvm 17.0.2 and 17.0.3 and apply that, as a test.

@pkubaj
Copy link
Contributor Author

pkubaj commented Oct 22, 2023

I backported the one-line change from llvm/llvm-project@491a91e#diff-909a72141a3ecd6bfde54a6344f80d2a194c3eb79622c5845f6c7c119145af6f and it fixes Rust's build. Since it looks like there are more platforms experiencing this issue (not just FreeBSD and the LLVM bug mentions also 64-bit POWER, even though Rust builds fine for me on 64-bits), would it be possible to release 1.73.1 with this patch (or LLVM 17.0.3)?

@he32
Copy link
Contributor

he32 commented Oct 22, 2023

I wedged in the 17.0.3 changes, and with that my build of 1.73.0 succeeds on NetBSD/macppc 10.0_BETA.

wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this issue Oct 22, 2023
This gets us back to building rust with the internal LLVM
on NetBSD/macppc.  Ref.
rust-lang/rust#116845
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 15, 2023
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Nov 16, 2023
Pkgsrc changes:
 * Adjust patches and cargo checksums to new versions.
 * For an external LLVM, set dependency of llvm >= 15, in accordance
   with the upstream changes.
 * Add a patch with a backport from LLVM 17.0.3 fixing codegen for
   PPC, ref. rust-lang/rust#116845

Upstream changes:

Version 1.73.0 (2023-10-05)
==========================

Language
--------

- [Uplift `clippy::fn_null_check` lint as `useless_ptr_null_checks`.]
  (rust-lang/rust#111717)
- [Make `noop_method_call` warn by default.]
  (rust-lang/rust#111916)
- [Support interpolated block for `try` and `async` in macros.]
  (rust-lang/rust#112953)
- [Make `unconditional_recursion` lint detect recursive drops.]
  (rust-lang/rust#113902)
- [Future compatibility warning for some impls being incorrectly
  considered not overlapping.]
  (rust-lang/rust#114023)
- [The `invalid_reference_casting` lint is now **deny-by-default**
  (instead of allow-by-default)]
  (rust-lang/rust#112431

Compiler
--------

- [Write version information in a `.comment` section like GCC/Clang.]
  (rust-lang/rust#97550)
- [Add documentation on v0 symbol mangling.]
  (rust-lang/rust#97571)
- [Stabilize `extern "thiscall"` and `"thiscall-unwind"` ABIs.]
  (rust-lang/rust#114562)
- [Only check outlives goals on impl compared to trait.]
  (rust-lang/rust#109356)
- [Infer type in irrefutable slice patterns with fixed length as array.]
  (rust-lang/rust#113199)
- [Discard default auto trait impls if explicit ones exist.]
  (rust-lang/rust#113312)
- Add several new tier 3 targets:
    - [`aarch64-unknown-teeos`]
      (rust-lang/rust#113480)
    - [`csky-unknown-linux-gnuabiv2`]
      (rust-lang/rust#113658)
    - [`riscv64-linux-android`]
      (rust-lang/rust#112858)
    - [`riscv64gc-unknown-hermit`]
      (rust-lang/rust#114004)
    - [`x86_64-unikraft-linux-musl`]
      (rust-lang/rust#113411)
    - [`x86_64-unknown-linux-ohos`]
      (rust-lang/rust#113061)
- [Add `wasm32-wasi-preview1-threads` as a tier 2 target.]
  (rust-lang/rust#112922)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

Libraries
---------

- [Add `Read`, `Write` and `Seek` impls for `Arc<File>`.]
  (rust-lang/rust#94748)
- [Merge functionality of `io::Sink` into `io::Empty`.]
  (rust-lang/rust#98154)
- [Implement `RefUnwindSafe` for `Backtrace`]
  (rust-lang/rust#100455)
- [Make `ExitStatus` implement `Default`]
  (rust-lang/rust#106425)
- [`impl SliceIndex<str> for (Bound<usize>, Bound<usize>)`]
  (rust-lang/rust#111081)
- [Change default panic handler message format.]
  (rust-lang/rust#112849)
- [Cleaner `assert_eq!` & `assert_ne!` panic messages.]
  (rust-lang/rust#111071)
- [Correct the (deprecated) Android `stat` struct definitions.]
  (rust-lang/rust#113130)

Stabilized APIs
---------------

- [Unsigned `{integer}::div_ceil`]
  (https://doc.rust-lang.org/stable/std/primitiv e.u32.html#method.div_ceil)
- [Unsigned `{integer}::next_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.next_multiple_of)
- [Unsigned `{integer}::checked_next_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.checked_next_multiple_of)
- [`std::ffi::FromBytesUntilNulError`]
  (https://doc.rust-lang.org/stable/std/ffi/struct.FromBytesUntilNulError.html)
- [`std::os::unix::fs::chown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.chown.html)
- [`std::os::unix::fs::fchown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.fchown.html)
- [`std::os::unix::fs::lfchown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.lchown.html)
- [`LocalKey::<Cell<T>>::get`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.get)
- [`LocalKey::<Cell<T>>::set`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set)
- [`LocalKey::<Cell<T>>::take`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take)
- [`LocalKey::<Cell<T>>::replace`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace)
- [`LocalKey::<RefCell<T>>::with_borrow`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow)
- [`LocalKey::<RefCell<T>>::with_borrow_mut`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow_mut)
- [`LocalKey::<RefCell<T>>::set`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set-1)
- [`LocalKey::<RefCell<T>>::take`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take-1)
- [`LocalKey::<RefCell<T>>::replace`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace-1)

These APIs are now stable in const contexts:

- [`rc::Weak::new`]
  (https://doc.rust-lang.org/stable/alloc/rc/struct.Weak.html#method.new)
- [`sync::Weak::new`]
  (https://doc.rust-lang.org/stable/alloc/sync/struct.Weak.html#method.new)
- [`NonNull::as_ref`]
  (https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.as_ref)

Cargo
-----

- [Encode URL params correctly for `SourceId` in `Cargo.lock`.]
  (rust-lang/cargo#12280)
- [Bail out an error when using `cargo::` in custom build script.]
  (rust-lang/cargo#12332)

Misc
----

Compatibility Notes
-------------------

- [Update the minimum external LLVM to 15.]
  (rust-lang/rust#114148)
- [Check for non-defining uses of return position `impl Trait`.]
  (rust-lang/rust#112842)

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they
represent significant improvements to the performance or internals
of rustc and related tools.

- [Remove LLVM pointee types, supporting only opaque pointers.]
  (rust-lang/rust#105545)
- [Port PGO/LTO/BOLT optimized build pipeline to Rust.]
  (rust-lang/rust#112235)
- [Replace in-tree `rustc_apfloat` with the new version of the crate.]
  (rust-lang/rust#113843)
- [Update to LLVM 17.]
  (rust-lang/rust#114048)
- [Add `internal_features` lint for internal unstable features.]
  (rust-lang/rust#108955)
- [Mention style for new syntax in tracking issue template.]
  (rust-lang/rust#113586)
@workingjubilee workingjubilee added the O-freebsd Operating system: FreeBSD label Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-freebsd Operating system: FreeBSD P-medium Medium priority regression-untriaged Untriaged performance or correctness regression.
Projects
None yet
Development

No branches or pull requests

7 participants