Page MenuHomeFreeBSD

lang/rust: Update to 1.60.0
ClosedPublic

Authored by mikael on Apr 7 2022, 3:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Mar 10, 4:22 PM
Unknown Object (File)
Sun, Mar 10, 4:22 PM
Unknown Object (File)
Sun, Mar 10, 4:22 PM
Unknown Object (File)
Sun, Mar 10, 4:22 PM
Unknown Object (File)
Sun, Mar 10, 4:22 PM
Unknown Object (File)
Sun, Mar 10, 3:50 PM
Unknown Object (File)
Sat, Feb 24, 12:45 AM
Unknown Object (File)
Feb 11 2024, 5:35 AM

Details

Reviewers
None
Group Reviewers
rust
Commits
R11:e57dfbf32324: lang/rust: Update to 1.60.0
Summary
Test Plan

Poudriere 14 aarch64 ok
Poudriere 14 amd64 ok
Poudriere 13 powerpc64le - ok
Poudriere 13 powerpc64 - ok
Poudriere 13 powerpc - ok

Exp-run: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263442

Broken ports:

devel/racer (marked broken):
error[E0635]: unknown feature `thread_local_const_init`
  --> /wrkdirs/usr/ports/devel/racer/work/racer-2.1.48/cargo-crates/rustc-ap-rustc_span-722.0.0/src/lib.rs:23:12
textproc/ripgrep (fixed with https://cgit.freebsd.org/ports/commit/?id=6232f9ef95a4a7df474752319b00f91c5dded612) 
error[E0635]: unknown feature `llvm_asm`
   --> /wrkdirs/usr/ports/textproc/ripgrep/work/ripgrep-13.0.0/cargo-crates/packed_simd_2-0.3.6/src/lib.rs:227:5
games/veloren (fixed in https://cgit.freebsd.org/ports/commit/?id=fbe3e82d8415d60bc45b66379857cd50e6d9a18b)
error[E0635]: unknown feature `llvm_asm`
   --> /wrkdirs/usr/ports/games/veloren/work/veloren-b5bac97c2e533bc61faf39ab0a43a037aa5a5ccf/cargo-crates/packed_simd_2-0.3.6/src/lib.rs:227:5
lang/rust-bootstrap@powerpc (fixed by reverting part of https://github.com/rust-lang/rust/commit/07dae5a97b64100f5abd511f1e2d5a6263a54006)
CMake Error at /usr/local/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/usr/local/freebsd-sysroot/powerpc/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /wrkdirs/usr/ports/lang/rust-bootstrap/work-powerpc/_build/powerpc-unknown-freebsd/llvm/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/local/bin/ninja cmTC_51d93 && [ 50% 1/2] Building C object CMakeFiles/cmTC_51d93.dir/testCCompiler.c.o
    [100% 2/2] Linking C executable cmTC_51d93
    FAILED: cmTC_51d93
    : && /usr/local/freebsd-sysroot/powerpc/bin/cc -ffunction-sections -fdata-sections -fPIC -pipe -fstack-protector-strong -fno-strict-aliasing -fuse-ld=bfd -lz  -fstack-protector-strong CMakeFiles/cmTC_51d93.dir/testCCompiler.c.o -o cmTC_51d93   && :
    cc: error: invalid linker name in argument '-fuse-ld=bfd'

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mikael requested review of this revision.Apr 7 2022, 3:05 PM
mikael created this revision.
mikael edited the test plan for this revision. (Show Details)

Regarding powerpc bootstraps: on 13.1 rust builds fine without bfd. Would it be possible to build bootstraps against 13.1 for powerpc?

Use the following patch for powerpc (assuming 13.1):

--- src/bootstrap/native.rs.orig        2022-04-09 03:06:06.748146000 +0200
+++ src/bootstrap/native.rs     2022-04-09 03:06:17.718886000 +0200
@@ -316,11 +316,6 @@
             }
         }

-        // Workaround for ppc32 lld limitation
-        if target == "powerpc-unknown-freebsd" {
-            ldflags.exe.push(" -fuse-ld=bfd");
-        }
-
         // https://llvm.org/docs/HowToCrossCompileLLVM.html
         if target != builder.config.build {
             builder.ensure(Llvm { target: builder.config.build });

Also remove -fuse-ld from Makefile:

@@ -210,8 +210,6 @@ do-configure:
        @${CHMOD} +x ${WRKDIR}/cc-wrapper
        @${PRINTF} '#!/bin/sh\nexec ${CXX} "$$@" --target=powerpc-unknown-freebsd13.0' > ${WRKDIR}/cxx-wrapper
        @${CHMOD} +x ${WRKDIR}/cxx-wrapper
-       @${PRINTF} '#!/bin/sh\nexec ${CC} -fuse-ld=bfd "$$@" --target=powerpc-unknown-freebsd13.0' > ${WRKDIR}/ld-wrapper
-       @${CHMOD} +x ${WRKDIR}/ld-wrapper
 .endif
 .for _target in ${_RUST_TARGETS}
        @${ECHO_CMD} '[target.${_target}]' >> ${WRKSRC}/config.toml
@@ -223,11 +221,7 @@ do-configure:
        @${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml
        @${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml
 .endif
-.if ${ARCH} == powerpc
-       @${ECHO_CMD} 'linker="${WRKDIR}/ld-wrapper"' >> ${WRKSRC}/config.toml
-.else
        @${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml
-.endif
 .endfor
        @${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml
        @${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml

That makes lang/rust build.
For lang/rust-bootstrap, you will probably also need changing /usr/local/freebsd-sysroot/powerpc/bin/c* (remove -fuse-ld="/usr/local/bin/powerpc-unknown-freebsd13.0-ld.bfd). Since the system compiler is used, build on 13.1

The problem with devel/racer is as follows:

  • racer 2.1.48 doesn't build with rust 1.60.0
  • racer 2.x requires rustc-dev from rust-nightly
  • rustc-dev is not "fabricated" on lang/rust-nightly because we use x.py build instead of x.py dist

Probably time to resurrect https://reviews.freebsd.org/D28520

The problem with devel/racer is as follows:

  • racer 2.1.48 doesn't build with rust 1.60.0
  • racer 2.x requires rustc-dev from rust-nightly
  • rustc-dev is not "fabricated" on lang/rust-nightly because we use x.py build instead of x.py dist

Probably time to resurrect https://reviews.freebsd.org/D28520

Racer 2.2.0 builds fine with rust 1.60.0 and rustc-dev (no need for the nightly version)

@mikael
I'm not sure what happened, but I can now build lang/rust-bootstrap@powerpc without additional patching. Do you want me to upload the bootstrap somewhere?

The problem with devel/racer is as follows:

  • racer 2.1.48 doesn't build with rust 1.60.0
  • racer 2.x requires rustc-dev from rust-nightly
  • rustc-dev is not "fabricated" on lang/rust-nightly because we use x.py build instead of x.py dist

Probably time to resurrect https://reviews.freebsd.org/D28520

Racer 2.2.0 builds fine with rust 1.60.0 and rustc-dev (no need for the nightly version)

devel/racer has always been a problem. Let's remove it or if it builds now put an expiration date on it. People can build it themselves with cargo install or use rls or better rust-analyzer like upstream suggests anyway.

Using x.py dist starts making a whole lot of sense if FreeBSD Ports ever gets the long overdue support for generating subpackages. Every distfile is a natural subpackage.

Please let me know if you want me to test something for this update.

lang/rust/Makefile
10

We should only have one of those. Remove mine. I'm going to ask clusteradm if we can have a /home/rust on freefall. Other groups also have one.

mikael edited the test plan for this revision. (Show Details)

Here is an update. I still have to test a few things marked with XXX in the Makefile.
The DOC doesn't build but there is a patch available now, we should try to import it.
I'm still not sure if we should install rustc-dev on the stable channel (alpine installs it), it's only usefull to build devel/racer. It adds 120MB to rust-1.60.0.pkg

  • Switch to using x.py dist instead of x.py in the do-build phase as we are missing the rustc-dev component (needed for devel/racer)
  • Revert part of [1] as it causes cross build problem with lang/rust-bootstrap@powerpc

devel/racer: Update to 2.2.0

[1] https://github.com/rust-lang/rust/commit/07dae5a97b64100f5abd511f1e2d5a6263a54006

lang/rust/Makefile
9

Just LOCAL/rust

125

This reenables rls on powerpc but it's excluded just above.

126–127

Should it use ${_PACKAGE_VERS} too?

134–136

Options helpers?

WASM_VARS=      _COMPONENTS+="rust-analysis-${_PACKAGE_VERS}-wasm32-unknown-unknown rust-std-${_PACKAGE_VERS}-wasm32-unknown-unknown"
mikael edited the summary of this revision. (Show Details)

Address tobik's comments

tobik added inline comments.
Mk/bsd.gecko.mk
82

@jbeich @cmt gecko Rust 1.60.0 bundles LLVM 14 now. Please advise if there's anything that needs to happen for Gecko ports because of it.

devel/racer/Makefile
17

It's missing DEPRECATED. I think we should point people to rust-analyzer in DEPRECATED.

Mk/bsd.gecko.mk
82
  • Since 6ec985b72d58 bump local LLVM_DEFAULT in Mk/bsd.gecko.mk to match LLVM major version in lang/rust. Required at least by LLD to understand the new bytecode emitted by Rust compiler.
  • Since f4c07f1834f7 create devel/wasi-compiler-rt* matching LLVM major version used by clang* (via LLVM_DEFAULT) and probably rustc (via wasm32-wasi target) then bump LLVM_VERSION in Mk/bsd.gecko.mk. See also WASM sandboxing, bug 260134, powerpc64 workaround (i.e. --without-wasm-sandboxed-libraries).

Firefox upstream upgraded both Rust to 1.60 and Clang to 14, see https://bugzilla.mozilla.org/show_bug.cgi?id=1758780

Not to be the party pooper here, but as of now devel/llvm14 doesn't even build with default options on 13.0 (I think brooks@'s rererevert of the libunwind dependency logic broke it, at least the error matches). Once that's sorted out, I can take care of the wasi-compiler-stuff. Totally excited about having a fourth llvm installation besides base.

This revision was not accepted when it landed; it landed in state Needs Review.May 1 2022, 4:40 PM
This revision was automatically updated to reflect the committed changes.