[go: nahoru, domu]

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

chromium: Enable Rust #782

Merged
merged 3 commits into from
Jan 30, 2024
Merged

chromium: Enable Rust #782

merged 3 commits into from
Jan 30, 2024

Conversation

MaxIhlenfeldt
Copy link
Collaborator
@MaxIhlenfeldt MaxIhlenfeldt commented Jan 22, 2024

This adds a dependency on OE's Rust recipe, as well as all the necessary changes to make Chromium successfully use that toolchain.

This change will also mean we don't support any Yocto release older than kirkstone, as that is the first release with Rust in OE that isn't EOL yet. Most notably, we will drop support for dunfell.

This adds a dependency on OE's Rust recipe, as well as all the necessary
changes to make Chromium successfully use that toolchain.

Signed-off-by: Max Ihlenfeldt <max@igalia.com>
@MaxIhlenfeldt MaxIhlenfeldt linked an issue Jan 22, 2024 that may be closed by this pull request
@MaxIhlenfeldt
Copy link
Collaborator Author

Some comments:

  • @nrpt-m as always, testing would be greatly appreciated! As discussed, this patch will mean we don't support dunfell any more. Also, please use https://git.yoctoproject.org/meta-lts-mixins/log/?h=kirkstone/rust-1.68 for kirkstone. I suspect the build will still fail even with that mixin because the Rust version is too old; but we should confirm it before adding a mixin with a newer version.
  • iiuc, one usually doesn't depend on rust(-native) directly, but inherits from the cargo class. I chose not to do that because it created some problems (I'm not 100% sure what it was, but I think the libstd-rs libraries were still being installed despite the line in rust_%.bbappend). cc @rwmacleod (I think you are/were involved in meta-rust development?)
  • As soon as I get confirmation from someone else that the build works, I'll submit 0025-Make-toolchain_supports_rust_thin_lto-configurable.patch upstream. I've talked to danakj@, she seemed open to accepting it.

Signed-off-by: Max Ihlenfeldt <max@igalia.com>
@rwmacleod
Copy link
Contributor

@MaxIhlenfeldt These days I'm mostly involved in Rust in trying to help @sundeep-kokkonda and @Yashinde145 so I've mentioned this thread to them and I see that Sundeep cloned meta-browser so he may reply to your question.

Also, for kirkstone, @g-scott-murray mentioned today that he is working on an update to (1.70?) of the rust mixin layer and that they are interested in chromium for AGL as you might already know.

@nrpt-m
Copy link
Contributor
nrpt-m commented Jan 23, 2024

Some comments:

  • @nrpt-m as always, testing would be greatly appreciated! As discussed, this patch will mean we don't support dunfell any more. Also, please use https://git.yoctoproject.org/meta-lts-mixins/log/?h=kirkstone/rust-1.68 for kirkstone. I suspect the build will still fail even with that mixin because the Rust version is too old; but we should confirm it before adding a mixin with a newer version.

@MaxIhlenfeldt ,
Have successfully compiled the current chromium-120.0.6099.224 version after applying the patches mentioned in this PR. Have used poky/kirkstone source and all other required layers in kirkstone branch along with this https://git.yoctoproject.org/meta-lts-mixins/log/?h=kirkstone/rust-1.68 layer.

Have attached the console.log file as well.
console-latest.log

@MaxIhlenfeldt
Copy link
Collaborator Author

Great to hear it works with the 1.68 mixin on kirkstone already!

@MaxIhlenfeldt
Copy link
Collaborator Author

One note, as Rust is a hard requirement for Chromium 121, it'd be easiest to have this PR merged before I start working on the update. I'd also like to do a separate PR that removes all dunfell-specific patches first. But if it takes too long to merge this, I can start working on the update already.

@MaxIhlenfeldt
Copy link
Collaborator Author

The toolchain_supports_rust_thin_lto patch has been accepted upstream as https://crrev.com/c/5233602, so I moved the patch file to files/backports and updated its Upstream-Status.

@MaxIhlenfeldt
Copy link
Collaborator Author

@kraj @rakuco gentle ping as merging this before starting to work on the (already released) 121 update would be best.

Copy link
Collaborator
@kraj kraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@otavio otavio merged commit 701272a into OSSystems:master Jan 30, 2024
Copy link
Collaborator
@rakuco rakuco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay here. I know very little about Rust and how its toolchain works, so I can't really review the changes here but fully trust you and the others on this one.

Thanks for all the hard work, and I'm glad to see dunfell support finally going away!

virtual/libgl \
"
DEPEND:append:runtime-llvm = " compiler-rt-native libcxx-native"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, does this mean that this line was completely broken before?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was working before, but when Rust is enabled Chromium needs to link against the target clang runtime libraries, see https://source.chromium.org/chromium/chromium/src/+/main:build/config/compiler/BUILD.gn;l=1660-1668;drc=ab6484854e1fb7a38160336acc6b34b6ecdda628.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but does it mean the previous variable name was incorrect and therefore the assignment did not have any effect?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, I overlooked that I changed that as well. Yes, that might have indeed been the case 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. That might explain some of the bug reports we've had over the years :-) Glad to see it's been fixed.

@rakuco
Copy link
Collaborator
rakuco commented Jan 30, 2024

This change will also mean we don't support any Yocto release older than kirkstone, as that is the first release with Rust in OE that isn't EOL yet. Most notably, we will drop support for dunfell.

@otavio @kraj @MaxIhlenfeldt we'd normally create a "dunfell" branch at the commit ea731e8; I wonder if it makes sense given dunfell as a whole is going EoL in just a few months.

@otavio
Copy link
Member
otavio commented Jan 30, 2024

I am not opposed as this is the last working version.

@rakuco
Copy link
Collaborator
rakuco commented Jan 30, 2024

I am not opposed as this is the last working version.

Done!

MaxIhlenfeldt added a commit to MaxIhlenfeldt/meta-browser that referenced this pull request May 8, 2024
Fixes OSSystems#792.

Build and patch changes:
------------------------

In OSSystems#782, we decided to depend on rust instead of libstd-rs, because the
latter didn't include libprofiler_builtins and also used a naming scheme
that trips up Chromium.

However, in OSSystems#791 we decided to patch Chromium so that it doesn't need
libprofiler_builtins any more, because the master version of the rust
recipe also doesn't include it.

Finally, while investigating OSSystems#792 it turned out that our approach breaks
as soon as we have something that depends on libstd-rs in our dependency
graph. In that scenario, both libstd-rs and rust (the latter due to our
bbappend file) install Rust libraries to /usr/lib/rustlib. This first
leads to Chromium build system errors (due to libstd-rs's naming
scheme), and after fixing these to Rust compiler errors due to multiple
versions being present.

The conclusion is now that we can depend on libstd-rs we should do so.
This only requires a small change to Chromium's Rust build scripts to
adapt them to the slightly different naming scheme.

License changes:
----------------

Added licenses: none.

Removed licenses: none.

Updated licenses: none.

Test-built:
-----------

* chromium-wayland:
 - nanbield, clang, MACHINE=qemuarm64

* chromium-x11:
 - master, clang,   MACHINE=qemuarm

Signed-off-by: Max Ihlenfeldt <max@igalia.com>
MaxIhlenfeldt added a commit to MaxIhlenfeldt/meta-browser that referenced this pull request May 8, 2024
Fixes OSSystems#792.

Build and patch changes:
------------------------

In OSSystems#782, we decided to depend on rust instead of libstd-rs, because the
latter didn't include libprofiler_builtins and also used a naming scheme
that trips up Chromium.

However, in OSSystems#791 we decided to patch Chromium so that it doesn't need
libprofiler_builtins any more, because the master version of the rust
recipe also doesn't include it.

Finally, while investigating OSSystems#792 it turned out that our approach breaks
as soon as we have something that depends on libstd-rs in our dependency
graph. In that scenario, both libstd-rs and rust (the latter due to our
bbappend file) install Rust libraries to /usr/lib/rustlib. This first
leads to Chromium build system errors (due to libstd-rs's naming
scheme), and after fixing these to Rust compiler errors due to multiple
versions being present.

The conclusion is now that we can depend on libstd-rs we should do so.
This only requires a small change to Chromium's Rust build scripts to
adapt them to the slightly different naming scheme.

License changes:
----------------

Added licenses: none.

Removed licenses: none.

Updated licenses: none.

Test-built:
-----------

* chromium-wayland:
 - nanbield, clang, MACHINE=qemuarm64

* chromium-x11:
 - master, clang,   MACHINE=qemuarm

Signed-off-by: Max Ihlenfeldt <max@igalia.com>
MaxIhlenfeldt added a commit to MaxIhlenfeldt/meta-browser that referenced this pull request May 8, 2024
Fixes OSSystems#792.

Build and patch changes:
------------------------

In OSSystems#782, we decided to depend on rust instead of libstd-rs, because the
latter didn't include libprofiler_builtins and also used a naming scheme
that trips up Chromium.

However, in OSSystems#791 we decided to patch Chromium so that it doesn't need
libprofiler_builtins any more, because the master version of the rust
recipe also doesn't include it.

Finally, while investigating OSSystems#792 it turned out that our approach breaks
as soon as we have something that depends on libstd-rs in our dependency
graph. In that scenario, both libstd-rs and rust (the latter due to our
bbappend file) install Rust libraries to /usr/lib/rustlib. This first
leads to Chromium build system errors (due to libstd-rs's naming
scheme), and after fixing these to Rust compiler errors due to multiple
versions being present.

The conclusion is now that we can depend on libstd-rs we should do so.
This only requires a small change to Chromium's Rust build scripts to
adapt them to the slightly different naming scheme.

License changes:
----------------

Added licenses: none.

Removed licenses: none.

Updated licenses: none.

Test-built:
-----------

* chromium-wayland:
 - nanbield, clang, MACHINE=qemuarm64

* chromium-x11:
 - master, clang,   MACHINE=qemuarm

Signed-off-by: Max Ihlenfeldt <max@igalia.com>
MaxIhlenfeldt added a commit that referenced this pull request May 13, 2024
chromium: Depend on libstd-rs instead of rust

Fixes #792.

Build and patch changes:
------------------------

In #782, we decided to depend on rust instead of libstd-rs, because the
latter didn't include libprofiler_builtins and also used a naming scheme
that trips up Chromium.

However, in #791 we decided to patch Chromium so that it doesn't need
libprofiler_builtins any more, because the master version of the rust
recipe also doesn't include it.

Finally, while investigating #792 it turned out that our approach breaks
as soon as we have something that depends on libstd-rs in our dependency
graph. In that scenario, both libstd-rs and rust (the latter due to our
bbappend file) install Rust libraries to /usr/lib/rustlib. This first
leads to Chromium build system errors (due to libstd-rs's naming
scheme), and after fixing these to Rust compiler errors due to multiple
versions being present.

The conclusion is now that we can depend on libstd-rs we should do so.
This only requires a small change to Chromium's Rust build scripts to
adapt them to the slightly different naming scheme.

Also, while we're already reworking our Rust setup, we can remove the
remaining part of our bbappend for the rust recipe and instead inherit
the `rust-common` class, thereby inheriting `rust-target-config` (which
needs stuff from `rust-common`). This means we get the `target.json`
files the Rust compiler needs installed in the directory pointed to by
the `RUST_TARGET_PATH` environment variable.

License changes:
----------------

Added licenses: none.

Removed licenses: none.

Updated licenses: none.

Test-built:
-----------

* chromium-wayland:
 - nanbield, clang, MACHINE=qemuarm64

* chromium-x11:
 - master, clang,   MACHINE=qemuarm

Signed-off-by: Max Ihlenfeldt <max@igalia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

chromium: Prepare for Rust.
6 participants