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

Add pkgsCross & pkgsLocal #42874

Merged
merged 5 commits into from Jul 2, 2018
Merged

Conversation

matthewbauer
Copy link
Member

Motivation for this change

Taken from #42060.

@Ericson2314
Copy link
Member

So eventually I'd like to prevent / whitelist packages packages from depending on these attributes, but I'll relent for now.

@Ericson2314 Ericson2314 merged commit ccfe1b5 into NixOS:master Jul 2, 2018
@Ericson2314 Ericson2314 deleted the crossPkgs branch July 2, 2018 17:25
@Ericson2314
Copy link
Member

As a first step, we can move this into an overlay and have the tarballs job do a build without.

@dezgeg
Copy link
Contributor

dezgeg commented Jul 2, 2018

Why? The concept is clearly useful for some packages (granted, not many of them).

@matthewbauer
Copy link
Member Author

Yes xbursttools is the only one now using it but it definitely makes sense in that case.

pkgsCross = lib.mapAttrs (n: crossSystem:
nixpkgsFun { inherit crossSystem; })
lib.systems.examples;
pkgsLocal = lib.mapAttrs (n: localSystem:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please call these something more descriptive (pkgsForOtherSystems or something). "local" sounds something totally different like these packages won't ever use remote building.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is just based on crossSystem vs localSystem. I would like to avoid the confusion but not sure how useful it is with a long name like that. Maybe pkgsLocalSystem & pkgsCrossSystem ?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe pkgsForOtherSystems.<example>.{cross,native}?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm... maybe. What about pkgsNative instead of pkgsLocal? I guess that would still invite confusion with something like buildPackages though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe nativePkgsForOtherSystems.<whatever> and crossPkgsForOtherSystems.<whatever>?

@dezgeg
Copy link
Contributor

dezgeg commented Jul 2, 2018

The use cases I know are roughly:

  • firmware flashers depending on cross-built firmware packages (e.g. U-Boot or Trusted Firmware): xbursttools as mentioned, odroid-xu3-bootloader could be using it already, tegra-uboot-flasher if I ever get around to packaging it
  • QEMU/other emulators for those same firmware packages
  • U-Boot on aarch64 might need a ARM cross compiler for some boards in the future
  • Also for an U-Boot dev shell you need a cross compiler for all of the 10+ architectures it supports
  • Kernel on aarch64 might need a ARM cross compiler (this is a tough choice since in native builds on aarch64 the native ARM compiler could be run on some machines, but not for example on the ThunderX machine we currently have on Hydra) in the future/depending on some config options
  • Embedded environments like the Arduino IDE need the AVR / ARM cross compiler + libc (if it's a good idea to un-vendor those in the first place)

Also stdenv_32bit and callPackage_i686 which are conceptually similar are used for many things.

@Ericson2314
Copy link
Member

Ericson2314 commented Jul 3, 2018

@dezgeg That's fine. I guess my fear is people that try to pull the cross tools out from this pkgsCross.xxx.buildPackages to build a cross-compiled executable or binary, when you should package the library normally, and then pull it itself out of pkgsCross.xxx. Put differently, if a package consists of components for different architectures, it's highly advantageous to build those in separate derivations.

@dtzWill
Copy link
Member

dtzWill commented Jul 3, 2018

Whatever naming used would be good to settle on quickly to avoid breaking or need for compatibility aliases. Thanks for working on this, all!

@dezgeg
Copy link
Contributor

dezgeg commented Jul 5, 2018

@Ericson2314 Well, requesting upstreams to make major changes to their build systems to have objects built for different architectures built separately isn't something we should do, but rather accommodate what they need.

For instance, as an U-Boot developer, let's say I'm hacking on some of the 64-bit Allwinner boards that some day in the future might have parts of the early boot code written in ARM code (thus requiring an ARM compiler) due to space constraints. To me it would be a complete implementation detail whether the early boot code is ARM or aarch64, all that I want or need is that make pine64_defconfig; make all compiles the thing from scratch when hacking on it, just like it does with any other board U-Boot supports.

@Ericson2314
Copy link
Member

@dezgeg Yeah I'm relenting :). For certain compilers I do think it's worth it to change upstream, but yes I completely agree with you for these bare-metal cases where the idea of a single host platform breaks down.

matthewbauer added a commit that referenced this pull request Jul 27, 2018
This was removed in PR #42874.
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

5 participants