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

lib/systems: fix uname.processor for powerpc and mips64 #189967

Merged
merged 1 commit into from Jan 2, 2023
Merged

lib/systems: fix uname.processor for powerpc and mips64 #189967

merged 1 commit into from Jan 2, 2023

Conversation

ghost
Copy link

@ghost ghost commented Sep 6, 2022

Description of changes

Cross-compilation of anything downstream of gtk3 requires qemu (due to gobject-introspection); qemu is built with --target-list=*-linux-user. Without this commit, those qemu builds will fail on a powerpc64le buildPlatform due to qemu being configured with --cpu=powerpc64le instead of --cpu=ppc64le. Unfortunately the build failure message from qemu in this situation is extremely cryptic.

The root cause turns out not to be the qemu expression, but rather the fact that on powerpc64le hostPlatform.uname.processor returns the gnu-name (powerpc64le) for the cpu instead of the linux-name (ppc64le) for the cpu.

Things done
  • Built on platform(s)
    • powerpc64le-linux
    • mips64el-linux (cross from powerpc64le-linux)
  • Tested compilation of many packages that depend on this change: full workstation environment
  • Tested basic functionality of many binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Sep 6, 2022
@ghost ghost marked this pull request as ready for review September 6, 2022 22:46
@ghost
Copy link
Author

ghost commented Sep 6, 2022

I originally opened this PR before #189958 merged. Now that that PR has merged, the motivation for this PR is much simpler: it makes hostPlatform.uname.processor match uname -m:

# uname -a
Linux talos 4.19.0-20-powerpc64le #1 SMP Debian 4.19.235-1 (2022-03-17) ppc64le GNU/Linux
# uname -m
ppc64le

@bobby285271 bobby285271 added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Sep 10, 2022
@ghost ghost marked this pull request as draft October 2, 2022 05:33
@ghost
Copy link
Author

ghost commented Oct 2, 2022

mips64el needs an analogous fix, so I've pushed 4383fe1b772f138a09b3ce09999335fbee7269aa onto this PR instead of opening a separate one in order to avoid creating a merge conflict with myself.

Without 4383fe1b772f138a09b3ce09999335fbee7269aa, the qemu builds needed for cross-compiling to mips64el will fail. With it, they succeed.

@ghost ghost marked this pull request as ready for review October 2, 2022 05:52
@ghost ghost changed the title lib/systems: fix uname.processor for powerpc lib/systems: fix uname.processor for powerpc and mips64 Oct 2, 2022
@bobby285271 bobby285271 removed the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Oct 2, 2022
@ghost ghost requested review from Artturin and removed request for matthewbauer, Ericson2314, nbp and alyssais January 1, 2023 22:33
Cross-compilation of anything downstream of gtk3 requires qemu (due to
gobject-introspection) with --target-list=*-linux-user.  Without this commit,
those qemu builds will fail on a powerpc64le host due to qemu being configured
with --cpu=powerpc64le instead of --cpu=ppc64le.  Unfortunately the build
failure message from qemu in this situation is extremely cryptic.

The root cause turns out not to be the qemu expression, but rather the fact that
on powerpc64le hostPlatform.uname.processor returns the gnu-name (powerpc64le)
for the cpu instead of the linux-name (ppc64le) for the cpu.

uname.processor on mips64el also needs adjustment -- the Linux-name is "mips64"
for both big and little endian (unlike powerpc64, where the Linux-name includes
a "le" suffix):

```
nix@oak:/tmp$ uname -m; lscpu | head -n2
mips64
Architecture:        mips64
Byte Order:          Little Endian
```

uname.processor on powerpc32 has also been adjusted.
@Artturin Artturin merged commit e68b89c into NixOS:master Jan 2, 2023
@ghost ghost deleted the pr/systems/uname/powerpc branch January 3, 2023 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants