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

spidermonkey: specify rust target #266560

Closed
wants to merge 1 commit into from

Conversation

yu-re-ka
Copy link
Contributor

@yu-re-ka yu-re-ka commented Nov 10, 2023

In some cases the logic for mapping autoconf targets to rustc targets in spidermonkey's configure scripts fails. Simply tell it what rustc target to use since we already know.

Fixes pkgsMusl.spidermonkey

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

In some cases the logic for mapping autoconf targets to rustc targets in spidermonkey's configure scripts fails. Simply tell it what rustc target to use since we already know.

Fixes pkgsMusl.spidermonkey
@alyssais
Copy link
Member

How come this isn't a problem for Firefox?

alyssais added a commit to alyssais/nixpkgs that referenced this pull request Jan 29, 2024
rustc 1.73.0 introduced a new x86_64-unikraft-linux-musl target.  This
triple is a bit of a lie — the kernel in this case is unikraft, which
isn't Linux, it just tries to be compatible with it.  But this
User-Agent-like string of a triple now exists, and with it comes some
fallout.

Spidermonkey asks rustc for the list of supported targets, then picks
the one that best matches the GNU triple it's building for, which in
the native case config.guess will say is x86_64-pc-linux-musl.  Prior
to rustc 1.73.0, all was well, because there was only one x86_64 musl
triple, but now there are two: x86_64-unknown-linux-musl, and
x86_64-unikraft-linux-musl, and neither of those are obviously closer
than the other to x86_64-pc-linux-musl to Spidermonkey's build system.
As a result, it can't decide which target to pass to rustc, and bails
out.

We can fix this by telling Spidermonkey what platform it should be
building for, rather than letting it guess, which previously we did
only when cross compiling.  This approach is already used in the
Firefox derivation (which is why it was not affected by the rustc
update), so it's been well tested already.

Closes: NixOS#266560
Closes: NixOS#282923
alyssais added a commit to alyssais/nixpkgs that referenced this pull request Jan 29, 2024
rustc 1.73.0 introduced a new x86_64-unikraft-linux-musl target.  This
triple is a bit of a lie — the kernel in this case is unikraft, which
isn't Linux, it just tries to be compatible with it.  But this
User-Agent-like string of a triple now exists, and with it comes some
fallout.

Spidermonkey asks rustc for the list of supported targets, then picks
the one that best matches the GNU triple it's building for, which in
the native case config.guess will say is x86_64-pc-linux-musl.  Prior
to rustc 1.73.0, all was well, because there was only one x86_64 musl
triple, but now there are two: x86_64-unknown-linux-musl, and
x86_64-unikraft-linux-musl, and neither of those are obviously closer
than the other to x86_64-pc-linux-musl to Spidermonkey's build system.
As a result, it can't decide which target to pass to rustc, and bails
out.

We can fix this by telling Spidermonkey what platform it should be
building for, rather than letting it guess, which previously we did
only when cross compiling.  This approach is already used in the
Firefox derivation (which is why it was not affected by the rustc
update), so it's been well tested already.

Closes: NixOS#266560
Closes: NixOS#282923
@alyssais
Copy link
Member

How come this isn't a problem for Firefox?

I figured out the answer, and it led me to a much simpler fix: #284838

alyssais added a commit to alyssais/nixpkgs that referenced this pull request Jan 29, 2024
rustc 1.73.0 introduced a new x86_64-unikraft-linux-musl target.  This
triple is a bit of a lie — the kernel in this case is unikraft, which
isn't Linux, it just tries to be compatible with it.  But this
User-Agent-like string of a triple now exists, and with it comes some
fallout.

Spidermonkey asks rustc for the list of supported targets, then picks
the one that best matches the GNU triple it's building for, which in
the native case config.guess will say is x86_64-pc-linux-musl.  Prior
to rustc 1.73.0, all was well, because there was only one x86_64 musl
triple, but now there are two: x86_64-unknown-linux-musl, and
x86_64-unikraft-linux-musl, and neither of those are obviously closer
than the other to x86_64-pc-linux-musl to Spidermonkey's build system.
As a result, it can't decide which target to pass to rustc, and bails
out.

We can fix this by telling Spidermonkey what platform it should be
building for, rather than letting it guess, which previously we did
only when cross compiling.  This approach is already used in the
Firefox derivation (which is why it was not affected by the rustc
update), so it's been well tested already.

Closes: NixOS#266560
Closes: NixOS#282923
@yu-re-ka yu-re-ka closed this Feb 1, 2024
alyssais added a commit that referenced this pull request Feb 1, 2024
rustc 1.73.0 introduced a new x86_64-unikraft-linux-musl target.  This
triple is a bit of a lie — the kernel in this case is unikraft, which
isn't Linux, it just tries to be compatible with it.  But this
User-Agent-like string of a triple now exists, and with it comes some
fallout.

Spidermonkey asks rustc for the list of supported targets, then picks
the one that best matches the GNU triple it's building for, which in
the native case config.guess will say is x86_64-pc-linux-musl.  Prior
to rustc 1.73.0, all was well, because there was only one x86_64 musl
triple, but now there are two: x86_64-unknown-linux-musl, and
x86_64-unikraft-linux-musl, and neither of those are obviously closer
than the other to x86_64-pc-linux-musl to Spidermonkey's build system.
As a result, it can't decide which target to pass to rustc, and bails
out.

We can fix this by telling Spidermonkey what platform it should be
building for, rather than letting it guess, which previously we did
only when cross compiling.  This approach is already used in the
Firefox derivation (which is why it was not affected by the rustc
update), so it's been well tested already.

Closes: #266560
Closes: #282923
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants