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

libpsl: don't depend on python when we cross compile #344211

Closed
wants to merge 2 commits into from

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Sep 24, 2024

this is quite a big dependency that we don't want.

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/)
  • 24.11 Release Notes (or backporting 23.11 and 24.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.

Add a 👍 reaction to pull requests you find important.

@Mic92
Copy link
Member Author

Mic92 commented Sep 24, 2024

@ofborg build pkgsStatic.curl curl

@ofborg ofborg bot added 6.topic: cross-compilation Building packages on a different platform than they will be used on 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Sep 24, 2024
@Mic92
Copy link
Member Author

Mic92 commented Sep 25, 2024

@ofborg build pkgsCross.aarch64-multiplatform.curl

Copy link
Member

@alyssais alyssais left a comment

Choose a reason for hiding this comment

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

I don't think it makes sense to artificially restrict functionality that would otherwise work when cross compiling. There's not any reason to assume that people want this functionality when doing native builds, but not when cross compiling, except when cross compiling to platforms where it shouldn't work.

I think this should be an option (so people can choose when avoid the big dependency, even in native cases), and it should default to only including the Python stuff in cases where that's possible, i.e. not when cross compiling to a platform Python doesn't support cross compiling to. We can use the list in their configure script. It might be nice if it was exposed in python3's passthru, so that other packages could do the same thing without having to repeat the list.

@@ -12,6 +12,7 @@
, python3
, buildPackages
, publicsuffix-list
, enablePython3 ? python3.availableOn stdenv.hostPlatform
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we go.

Copy link
Member

@alyssais alyssais left a comment

Choose a reason for hiding this comment

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

This won't work, because Python's meta.platforms lists platforms Python can be built for, but it can't encode that it can't be cross compiled to those platforms. For example, Python supports being built natively on NetBSD, but not being cross compiled to it. We need a separate list of which platforms Python supports being cross compiled to.

@@ -655,6 +655,8 @@ in with passthru; stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = with pkgsBuildBuild.python3.pkgs; [ sphinxHook python-docs-theme ];
};

availableOn = platform: !platform.isStatic && lib.meta.availableOn platform self;
Copy link
Member

Choose a reason for hiding this comment

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

Python can be built statically. Even if it didn't, we could encode that using badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ], with no need to invent a new helper.

@Mic92
Copy link
Member Author

Mic92 commented Sep 25, 2024

This won't work, because Python's meta.platforms lists platforms Python can be built for, but it can't encode that it can't be cross compiled to those platforms. For example, Python supports being built natively on NetBSD, but not being cross compiled to it. We need a separate list of which platforms Python supports being cross compiled to.

Ok. I don't want to spend more time on fixing this. I will disable cross-compilation in the nix repository until someone else fixes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: python 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants