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
Remove legacy cross, add aliases #42060
Conversation
lib/systems/examples.nix
Outdated
}; | ||
|
||
avr-atmel = { | ||
config = "avr-atmel-linux-avrabi"; |
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.
Surely it must be none
not linux
?
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, thanks.
lib/systems/examples.nix
Outdated
avr-atmel = { | ||
config = "avr-atmel-linux-avrabi"; | ||
platform = { | ||
kernelArch = "avr"; |
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.
AVR is a 8-bit microcontroller, it doesn't run Linux.
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.
Ok hopefully it will not be needed with "none" above.
lib/systems/parse.nix
Outdated
@@ -95,6 +95,8 @@ rec { | |||
|
|||
wasm32 = { bits = 32; significantByte = littleEndian; family = "wasm"; }; | |||
wasm64 = { bits = 64; significantByte = littleEndian; family = "wasm"; }; | |||
|
|||
avr = { bits = 32; significantByte = littleEndian; family = "avr"; }; |
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.
Ditto.
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.
The family is optional, it can be skipped.
pkgs/top-level/aliases.nix
Outdated
arm-frc-linux-gnueabi-binutils = pkgsCross.arm-frc-linux-gnueabi.buildPackages.binutils; | ||
arm-frc-linux-gnueabi-gcc = pkgsCross.arm-frc-linux-gnueabi.buildPackages.gcc; | ||
|
||
gcc-arm-embedded-4_8 = pkgsCross.armv7l-hf-multiplatform.buildPackages.gcc48; |
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.
These don't look at all the same. gcc-arm-embedded
has things like soft-float libraries, some embedded libc, etc.
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.
Ok I'll look into it. Is there another example platform that fits better? I can add a new one, my thought was that gcc-arm-embedded was just kind of a generic "arm" toolchain - I probably misunderstood the use case though.
pkgs/top-level/aliases.nix
Outdated
|
||
avrgcclibc = throw "avrgcclibs are now separate packages, install avrbinutils, avrgcc and avrlibc"; | ||
avrbinutils = pkgsCross.avr-atmel.buildPackages.binutils; | ||
avrgcc = pkgsCross.avr-atmel.buildPackages.gcc; |
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.
Is this going to contain wrapped versions of the toolchains? I doubt that's going to work for the 8-bit micros since all the hardening stuff etc. is irrelevant and probably harmful.
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 wonder how to handle that. There is a gcc-unwrapped 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.
Actually, maybe we can disable hardening for certain target platforms?
How has this been tested? |
pkgs/top-level/all-packages.nix
Outdated
# Useful attribute of systems to cross compile to. | ||
pkgsCross = lib.mapAttrs (n: crossSystem: | ||
nixpkgsFun { inherit crossSystem; }) | ||
lib.systems.examples; |
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.
Do people like doing this? We do it in reflex-platform & it works out nicely for convenience.
/cc @Ericson2314
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.
The main thing is that packages inside nixpkgs shouldn't depend on this. Maybe we can make it some sort of default overlay that the tarball job can disable?
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.
Sounds good
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.
👍
Maybe this should be split off from the rest of PR? 😇
Seems review-able and useful independently :).
Omg pkgsCross would be amazing!! Maybe next we could add a muslPkgs or something for musl-native builds. Regardless, this would help users quite a bit I think-- even veteran nixpkgs users often aren't sure how to invoke things for cross (and even for those that do this is a lot nicer than some complicated argument!). Will hopefully look through this more closely soon :). |
Yes, there are definitely use cases for |
Yeah, I would definitely like a "versatile" solution so that we don't need to do one for each possible permutation. Would |
Either of these sound great to me! 😁 |
Okay giving up on gcc-arm-embedded for now because it definitely require more information than I originally thought. We now just remove:
and the arm-frc-linux-gnueabi stuff is already removed so we provide aliases for it too. |
@GrahamcOfBorg build pkgsCross.avr-atmel.stdenv.cc.cc arm-frc-linux-gnueabi-gcc |
Failure on x86_64-linux (full log) Partial log (click to expand)
|
Failure on aarch64-linux (full log) Partial log (click to expand)
|
pkgs/top-level/all-packages.nix
Outdated
inherit pkgs; | ||
|
||
|
||
# Override system. This is useful to build i686 packages on x86_64-linux. | ||
forceSystem = system: kernel: nixpkgsFun { |
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.
@matthewbauer I think all nixpkgsFun
uses from all-packages.nix
can be removed with this.
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.
Awesome - there was one left for xbursttools that we can replace with nixpkgsCross.
pkgs/top-level/stage.nix
Outdated
# Used by wine, firefox with debugging version of Flash, ... | ||
pkgsi686Linux = forceSystem "i686-linux" "i386"; | ||
|
||
callPackage_i686 = if stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" |
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.
if stdenv.hostPlatform.isx86
I think we can simplify this now
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.
Okay to just remove the check? It should be done in another place.
@GrahamcOfBorg build pkgsCross.avr-atmel.stdenv.cc.cc arm-frc-linux-gnueabi-gcc xbursttools |
pkgs/top-level/all-packages.nix
Outdated
}; | ||
in | ||
pkgsCross.buildPackages.gccCrossStageStatic; | ||
gccCross = pkgsCross.ben-nanonote.buildPackages.gcc; |
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.
Should this be gcc or gccCrossStageStatic? @Ericson2314
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.
gccCrossStageStatic
. No libc
is needed.
Failure on x86_64-darwin (full log) Partial log (click to expand)
|
@GrahamcOfBorg build pkgsCross.avr-atmel.stdenv.cc.cc arm-frc-linux-gnueabi-gcc xbursttools |
Failure on x86_64-linux (full log) Attempted: pkgsCross.avr-atmel.stdenv.cc.cc, arm-frc-linux-gnueabi-gcc, xbursttools Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: gcc-arm-embedded Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: gcc-arm-embedded Partial log (click to expand)
|
Failure on x86_64-darwin (full log) Attempted: pkgsCross.avr-atmel.stdenv.cc.cc, arm-frc-linux-gnueabi-gcc, xbursttools Partial log (click to expand)
|
Failure on x86_64-darwin (full log) Attempted: pkgsCross.avr-atmel.stdenv.cc.cc, arm-frc-linux-gnueabi-gcc, xbursttools Partial log (click to expand)
|
Success on x86_64-darwin (full log) Attempted: gcc-arm-embedded Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: gcc-arm-embedded Partial log (click to expand)
|
Success on x86_64-darwin (full log) Attempted: gcc-arm-embedded Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: gcc-arm-embedded Partial log (click to expand)
|
pkgsLocal <3<3<3 Brief pkgsCross testing of musl things looks good too (seems to work same, and have identical hashes, as the much more cumbersome |
Evaluating
|
I think that's okay. The same thing will happen when trying any other cross libc. Eventually we want to make libc just an ordinary library but there is still too much dependence on the compiler. You should be able to do:
(I think it will fail at some point though). |
(apparently there are conflicts to resolve, FWIW!) Is there a TODO of things left to address? |
@GrahamcOfBorg build arm-frc-linux-gnueabi-gcc I think the main thing is to make sure the new toolchains are close enough to what they are replacing. This could take a while & my main goal is to just have this stuff ready by August when master branches off. If anyone can look at the avrlibc stuff that would be helpful - have no idea why it fails. |
Failure on x86_64-darwin (full log) Partial log (click to expand)
|
Failure on aarch64-linux (full log) Partial log (click to expand)
|
Failure on x86_64-linux (full log) Partial log (click to expand)
|
More discussion in NixOS@ea67004 This readds some attributes that previously referred to chips used in the First Robotic Competition. arm-frc-linux-gnueabi is the relevant quadruple.
This can now use new cross compilation infrastructure. Aliases are provided.
These toolchains are no longer supported anymore according to https://www.arm-blog.com/arm-toolchain-from-mentor-is-dead/.
e431914
to
2827a4f
Compare
Closing for now |
Motivation for this change
This removes the legacy cross stuff & replace with equivalent aliases.
In addition,
pkgsCross
attribute is introduced which maps each of the example platforms to a cross compilation package set.We also need to add eglibc attribute (which has apparently never been packaged!) The AVR alias is also apparently broken.
Related: #39087
/cc @Ericson2314