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
Fixes meson for systemd-boot AArch64 cross-build #61847
Conversation
It looks like it's incorrect for x86_64 as well? |
Oops! You're right, that's bad sleuthing on my part. Do you have an alternative to special casing both of those? It seems a bit clunky. |
|
||
[properties] | ||
needs_exe_wrapper = true | ||
|
||
[host_machine] | ||
system = '${targetPackages.stdenv.targetPlatform.parsed.kernel.name}' | ||
cpu_family = '${targetPackages.stdenv.targetPlatform.parsed.cpu.family}' | ||
# http://mesonbuild.com/Reference-tables.html#cpu-families | ||
cpu_family = '${if targetPackages.stdenv.isAarch64 then "aarch64" else targetPackages.stdenv.targetPlatform.parsed.cpu.family}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Peeking at lib/systems/parse.nix
, targetPackages.stdenv.targetPlatform.parsed.cpu.name
looks more correct in most cases - for example, for riscv32
and riscv64
targetPackages.stdenv.targetPlatform.parsed.cpu.family
is just riscv
, but targetPackages.stdenv.targetPlatform.parsed.cpu.name
is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct for x86_64
too - x86
would need to be special-cased, given cpu.name
is i686
there, and while it might work, it's not guaranteed to stay, according to meson docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not guaranteed to stay, according to meson docs.
I'm not sure I follow, I don't see anything special about x86
in their docs, but I don't really know where too look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I would make the condition something like:
if targetPackages.stdenv.targetPlatform.isAarch32 then "arm"
else targetPackages.stdenv.targetPlatform.parsed.cpu.name
there's a few more cases like powerpc, riscv, that we probably should handle, but this will take care of most cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to suggest using ….cpu.name
for mesons cpu_family
instead of what we get from ….cpu.family
, as it seemed to fit better.
I did take a closer look:
….cpu.name
is correct for the following meson CPU families:
aarch64
riscv32
riscv64
….cpu.name
is wrong for the following meson CPU families
- 32 bit arm flavours (the armv7*) ones at least
i686
instead ofx86
powerpc
/powerpcle
instead ofppc
- `armv7l
I ignored the ones not available in nixpkgs via pkgsCross
.
In general, this looks very messy, and hard to test / ensure to keep working.
I'd suggest to instead provide a fixed lookup table / lookup attrset in the meson drv, translating from parsed.cpu.name
to mesons cpu_family
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You replied just as I was pushing a new revision :). Yeah I think the attrset approach might end up being better considering the different discrepancies.
Should the attrset only implement overrides from cpu.name
, a missing attribute assumed to be the value of cpu.name
or should the attrset list all known values, and a missing attribute be a throw?
68a96fe
to
814b979
Compare
As documented, it should be `aarch64` for AArch64. * https://mesonbuild.com/Reference-tables.html#cpu-families ``` $ nix eval '((import <nixpkgs> {}).pkgsCross.aarch64-multiplatform.stdenv.targetPlatform.parsed.cpu.family)' "arm" ``` The lookup table will ensure that, at any point, meson does not pick the wrong family.
814b979
to
066a905
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good now. Thanks!
I pulled the latest changes into the systemd PR.
…On Sun, 26 May 2019, 20:30 John Ericson, ***@***.***> wrote:
***@***.**** approved this pull request.
This looks good now. Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#61847?email_source=notifications&email_token=AAE365BMCTT7X263YPUEWTDPXLJKRA5CNFSM4HOP22VKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBZWWLSI#pullrequestreview-242050505>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAE365DXBGRKMX4SDDWHBOTPXLJKRANCNFSM4HOP22VA>
.
|
@samueldr isn't this relatively independent from each other? Or do we just want to avoid one world rebuild and merge this in together with the systemd bump for that reason? |
It's to avoid the rebuild. Though in practice the meson changes could go in. I think it could even go in to master since it should be a no-op for native builds. So, I guess I leave that to @andir depending on how he wants to proceed. |
@samueldr Go ahead an merge it into master. I am all for having changes outside of the systemd PR, if they make sense on their own. I'll happily rebase my PR a few more times if that means we can get changes into nixpkgs incrementally without a big bang change :-) |
Closing in favor of a PR targeting master. |
Note about
cpu_family
:As documented, it should be
aarch64
for AArch64.This explains the new conditional.
family
seems fine for at least,x86_64
i686
andarmv7
.This should be merged together with #61321; dropping the systemd AArch64 change on one of the PRs.
Things done
This was tested when rebased on nixos-unstable. In the current state of staging, something (glib) doesn't build for at-leat cross-compilation, it looks like.
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)cc @andir