Opened 3 years ago

Closed 2 years ago

#15634 closed enhancement (fixed)

rustc-1.56.0

Reported by: Xi Ruoyao Owned by: pierre
Priority: normal Milestone: 11.1
Component: BOOK Version: git
Severity: normal Keywords:
Cc:

Description

The reason to upgrade rustc is we'll need to adapt for LLVM-13 and OpenSSL-3.

Attachments (2)

seamonkey-2.53.9.1-rustc_1560-1.patch (3.2 KB ) - added by Douglas R. Reno 2 years ago.
seamonkey-2.53.9.1-rustc_1560-2.patch (46.5 KB ) - added by Douglas R. Reno 2 years ago.

Download all attachments as: .zip

Change History (23)

comment:1 by ken@…, 3 years ago

Searching for the release notes for rust-1.55.0 took me to https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-55-2021-09-09 (9th September) but the text there says that 1.56.0 was released on 2021-10-21 (nice time machine) and has been upgraded to llvm 13. I guess that where they are preparing their notes for the eventual release.

The bigger questions are:

  1. Can LLVM-13 compile our current rustc-1.52.0 using system llvm ? If not, can it compile 1.55.0 like that ? If not, no point using llvm-13 until 1.56.0 is released.
  1. OpenSSL-3 : what is all this about ? Do you have a link saying that a specific rustc version (presumably 1.55.0?) has been adapted for the openssl changes ?
  1. If we have to upgrade rustc for llvm-13 or openssl-3, which packages will break ? (Can't answer that without knowing which version of rustc we'll need).

in reply to:  1 ; comment:2 by Xi Ruoyao, 3 years ago

Replying to ken@…:

Searching for the release notes for rust-1.55.0 took me to https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-55-2021-09-09 (9th September) but the text there says that 1.56.0 was released on 2021-10-21 (nice time machine) and has been upgraded to llvm 13. I guess that where they are preparing their notes for the eventual release.

The bigger questions are:

  1. Can LLVM-13 compile our current rustc-1.52.0 using system llvm ? If not, can it compile 1.55.0 like that ? If not, no point using llvm-13 until 1.56.0 is released.

It can compile 1.55.0 (and 1.54.0 I think, not tested). But in 1.55.0 the shipped LLVM is still 12. In 1.56.0 the shipped LLVM will be upgraded to 13.

  1. OpenSSL-3 : what is all this about ? Do you have a link saying that a specific rustc version (presumably 1.55.0?) has been adapted for the openssl changes ?

1.54.0 does not build with OpenSSL 3.

https://github.com/rust-lang/rust/pull/86529

  1. If we have to upgrade rustc for llvm-13 or openssl-3, which packages will break ? (Can't answer that without knowing which version of rustc we'll need).

With 1.55.0 js78 and librsvg fine. Not sure about firefox.

in reply to:  2 comment:3 by ken@…, 3 years ago

Replying to Xi Ruoyao:

Replying to ken@…:

1.54.0 does not build with OpenSSL 3.

https://github.com/rust-lang/rust/pull/86529

  1. If we have to upgrade rustc for llvm-13 or openssl-3, which packages will break ? (Can't answer that without knowing which version of rustc we'll need).

With 1.55.0 js78 and librsvg fine. Not sure about firefox.

I suggest we wait until 1.56.0 before someone looks at this - updating rust to 1.55.0 using shipped llvm, looking to see what breaks, and then repeating for 1.56.0 seems a waste of effort.

in reply to:  2 ; comment:4 by ken@…, 3 years ago

Replying to Xi Ruoyao:

Replying to ken@…:

1.54.0 does not build with OpenSSL 3.

https://github.com/rust-lang/rust/pull/86529

  1. If we have to upgrade rustc for llvm-13 or openssl-3, which packages will break ? (Can't answer that without knowing which version of rustc we'll need).

With 1.55.0 js78 and librsvg fine. Not sure about firefox.

I suggest we wait until 1.56.0 before someone looks at this - updating rust to 1.55.0 using shipped llvm, looking to see what breaks, and then repeating for 1.56.0 seems a waste of effort.

If something newer than 1.52.0 but older than 1.56.0 happens to break things then by that point we will be in a better place to find a known fix. OTOH, if 1.56.0 happens to break things then we'll be back on the bleeding edge.

in reply to:  4 comment:5 by Xi Ruoyao, 3 years ago

Summary: rustc-1.55.0rustc-1.55.0 (wait for 1.56.0)

I suggest we wait until 1.56.0 before someone looks at this - updating rust to 1.55.0 using shipped llvm, looking to see what breaks, and then repeating for 1.56.0 seems a waste of effort.

Agree.

comment:6 by pierre, 3 years ago

Summary: rustc-1.55.0 (wait for 1.56.0)rustc-1.56.0

1.56.0 is out. Release Notes at https://github.com/rust-lang/rust/blob/master/RELEASES.md

There is nothing about openssl-3.

comment:7 by pierre, 3 years ago

Owner: changed from blfs-book to pierre
Status: newassigned

comment:8 by pierre, 3 years ago

I've tried to rebuild js78, librsvg, potrace, cbindgen, gdb, mercurial, mesa, libreoffice, firefox and seamonkey, with llvm-13 and rustc-1.56.0. Everything went ok, except seamonkey that fails with several errors of the type:

4:13.94 error: type parameters must be declared prior to const parameters
 4:13.94   --> /sources/seamonkey/seamonkey-2.53.9.1/third_party/rust/packed_simd/src/codegen/llvm.rs:20:54
 4:13.94    |
 4:13.94 20 | pub unsafe fn __shuffle_vector2<const IDX: [u32; 2], T, U>(x: T, y: T) -> U
 4:13.94    |                                ----------------------^--^- help: reorder the parameters: lifetimes, then types, then consts: `<T, U, const IDX: [u32; 2]>`

Note that packed_simd does not seem to be built on firefox (otherwise, since llvm.rs is the same file as on seamonkey, it would error similarly, I guess)

in reply to:  8 ; comment:9 by ken@…, 3 years ago

Replying to pierre:

I've tried to rebuild js78, librsvg, potrace, cbindgen, gdb, mercurial, mesa, libreoffice, firefox and seamonkey, with llvm-13 and rustc-1.56.0. Everything went ok, except seamonkey that fails with several errors of the type:

4:13.94 error: type parameters must be declared prior to const parameters
 4:13.94   --> /sources/seamonkey/seamonkey-2.53.9.1/third_party/rust/packed_simd/src/codegen/llvm.rs:20:54
 4:13.94    |
 4:13.94 20 | pub unsafe fn __shuffle_vector2<const IDX: [u32; 2], T, U>(x: T, y: T) -> U
 4:13.94    |                                ----------------------^--^- help: reorder the parameters: lifetimes, then types, then consts: `<T, U, const IDX: [u32; 2]>`

Note that packed_simd does not seem to be built on firefox (otherwise, since llvm.rs is the same file as on seamonkey, it would error similarly, I guess)

Probably related to https://github.com/rust-lang/packed_simd/issues/328 and that might be fixed by https://github.com/rust-lang/packed_simd/pull/329 but I have no idea how to patch it - the patch.crates-io addition to cargo.toml supposedly should solve it, but for me rust manipulation might as well be written in greek (and I'm nowhere near getting a working rust at the moment).

in reply to:  9 comment:10 by ken@…, 3 years ago

Replying to ken@…:

Probably related to https://github.com/rust-lang/packed_simd/issues/328 and that might be fixed by https://github.com/rust-lang/packed_simd/pull/329 but I have no idea how to patch it - the patch.crates-io addition to cargo.toml supposedly should solve it, but for me rust manipulation might as well be written in greek (and I'm nowhere near getting a working rust at the moment).

Except I didn't read far enough - that branch has been deleted. Looks as if packed_simd needs to be updated to 0.3.6, I assume that even though the code change is tiny, a patch to achieve it will be enormous. But https://github.com/rust-lang/packed_simd maybe shows a way.

comment:11 by Douglas R. Reno, 2 years ago

Try this:

[source."https://github.com/hsivonen/packed_simd"]
git = "https://github.com/hsivonen/packed_simd"
replace-with = "vendored-sources"
rev = "8b4bd7d8229660a749dbe419a57ea01df9de5453"

instead of:

[source."https://github.com/hsivonen/packed_simd"]
git = "https://github.com/hsivonen/packed_simd"
replace-with = "vendored-sources"
rev = "6a16f954950401b92b4e220fbf2dfaf6f00e1fb2"

Inside of .cargo/config.in

Looking at those two commits, it looks like the one from Firefox (the first one I listed) does some additional stuff with 1.56.x, including the following commits on top of the ones for seamonkey:

https://github.com/hsivonen/packed_simd/commit/c621dcc01236d02aa9d380cfe29e9a0a94f60442 - support rustc-1.56.x

https://github.com/hsivonen/packed_simd/commit/d9319fb26a0fa6353d49ada21b8a68028c0d30d0 - do a more fine-grained check

https://github.com/hsivonen/packed_simd/commit/8b4bd7d8229660a749dbe419a57ea01df9de5453 - an even better check

I think just replacing the commit hash with "8b4bd7d8229660a749dbe419a57ea01df9de5453" might do the trick.

If that doesn't work, I've attached a patch that might (untested, don't have rustc-1.56.x on my system nor llvm-13... I will upgrade once it's in the book though). The patch I made applies the changes to the source code in third_party/rust/packed_simd/src. Please note that the patch is untested, I just backported the commits to what was already there! I figured out that the patches weren't applied by comparing the commit hash that https://gitlab.com/seamonkey-project/seamonkey-2.53-mozilla/-/tree/2_53_9_1_final/third_party/rust/packed_simd/src has to the one that Firefox has, and then backporting the relevant commits.

by Douglas R. Reno, 2 years ago

comment:12 by Douglas R. Reno, 2 years ago

Note that my patch doesn't have our normal header either

comment:13 by ken@…, 2 years ago

Tried the sed first,

sed -i 's/6a16f954950401b92b4e220fbf2dfaf6f00e1fb2/8b4bd7d8229660a749dbe419a57ea01df9de5453/' .cargo/config.in

but it doesn't fly.

 4:10.45     Updating git repository `https://github.com/hsivonen/packed_simd`
 4:10.45 error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
 4:10.45 Caused by:
 4:10.45   failed to load source for dependency `packed_simd`
 4:10.45 Caused by:
 4:10.45   Unable to update https://github.com/hsivonen/packed_simd?rev=6a16f954950401b92b4e220fbf2dfaf6f00e1fb2#6a16f954
 4:10.45 Caused by:
 4:10.45   failed to clone into: /root/.cargo/git/db/packed_simd-586bce2b3f3a8f5b
 4:10.45 Caused by:
 4:10.45   attempting to update a git repository, but --frozen was specified
 4:10.46 make[4]: *** [/scratch/working/seamonkey-2.53.9.1/config/rules.mk:951: force-cargo-library-build] Error 101
 4:10.46 make[3]: *** [/scratch/working/seamonkey-2.53.9.1/config/recurse.mk:74: toolkit/library/rust/target] Error 2
 4:10.46 make[3]: *** Waiting for unfinished jobs....

I'm done for now, will try the patch later.

comment:14 by pierre, 2 years ago

Tried the sed and commented out the line containing --frozen in config/rules.mk. So the error involving --frozen disappears, but the errors mentioning order of parameters are still there. Then I tried the patch. Same errors in llvm.rs.

Note that I do not have mention of packed_simd in the firefox log, so I think it is not compiled at all. Could be because I have it in my ~/.cargo, though.

Last edited 2 years ago by pierre (previous) (diff)

comment:15 by pierre, 2 years ago

I've removed completely .cargo from my home directory, and am rebuilding firefox: after more than 20 mn, nothing in the log about packed_simd: looks like it is not used... So we might be barking at the wrong tree if we try to fix it.

comment:16 by pierre, 2 years ago

Ah, looks like a fake_simd project is compiled by cargo for firefox... and not packed_simd.

by Douglas R. Reno, 2 years ago

comment:17 by Douglas R. Reno, 2 years ago

Go ahead and try this patch, it should reorder the parameters in the way it wants.

comment:18 by Douglas R. Reno, 2 years ago

Scratch that, this patch won't work. I think I found a workaround though, that forces it to use the copy in third_party/rust (after patching it).

I downloaded the rustc-1.56.0 binary and dropped it in /usr/local for this, but do not have the new LLVM installed (or our version of rustc 1.56 either). This is just for a quick test and then I'll remove it from my system.

Last edited 2 years ago by Douglas R. Reno (previous) (diff)

comment:19 by pierre, 2 years ago

Passing --disable-rust-simd to mozconfig seems to do the trick: the default is --enable for seamonkey, while the default is --disable for firefox-91.

in reply to:  19 comment:20 by ken@…, 2 years ago

Replying to pierre:

Passing --disable-rust-simd to mozconfig seems to do the trick: the default is --enable for seamonkey, while the default is --disable for firefox-91.

Thanks, that builds for me.

comment:21 by pierre, 2 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.