-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
buildPerlPackage: fix patchShebangs when cross-compiling #95623
Conversation
74c044c
to
6b9f9ec
Compare
Yes, packages need miniperl at build time. |
@ofborg build pkgsCross.aarch64-multiplatform.perlPackages.XMLTwig pkgsCross.aarch64-multiplatform.perlPackages.XMLParser pkgsCross.aarch64-multiplatform.perlPackages.NetDBus pkgsCross.aarch64-multiplatform.perlPackages.FileSlurp |
|
6b9f9ec
to
ec0c5d7
Compare
Yeah, the The important part is that plain |
Yes, I think it would. |
ec0c5d7
to
d61f1a4
Compare
I updated this PR to rename the dev output to mini. This does not cause any rebuilds for native Perl, and fixes the shebang in XMLTwig. @ofborg build pkgsCross.armv7l-hf-multiplatform.perlPackages.XMLTwig pkgsCross.armv7l-hf-multiplatform.perlPackages.XMLParser pkgsCross.armv7l-hf-multiplatform.perlPackages.NetDBus pkgsCross.armv7l-hf-multiplatform.perlPackages.FileSlurp |
@volth I'm sorry I don't do cross compilation so I don't know much about it. Then again if it has your approval it should probably be merged... |
@Ericson2314 for general cross-compilation hygiene check |
@@ -28,7 +28,7 @@ let | |||
|
|||
# TODO: Add a "dev" output containing the header files. | |||
outputs = [ "out" "man" "devdoc" ] ++ | |||
optional crossCompiling "dev"; | |||
optional crossCompiling "mini"; |
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.
Possibly over paranoid, but might be nice to add a comment here that if we add a "mini" output to non-cross perl in the future we may want to check perl-modules/generic/default.nix to ensure it's still 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.
Renaming mini
to miniperl
would make it more clear imho.
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 approach looks good to me, but don't have an env to properly test cross compilation.
This situation is very confusing me. There is a tradition of putting build-platform binaries in the "dev" output, but it is generally the last resort. Here are my questions:
|
I've built Building using QEMU gives a working
However on pkgCross, dependencies for
|
The Perl cross infrastructure in nixpkgs is based on the perl-cross project which provides a custom build system and patches to make it possible to cross-compile Perl.
Perl has native (XS) modules, although I know very little about the build process.
It also contains pure Perl stubs for native modules that are needed at build time.
miniperl is wrapped to add certain directories from the host perl to
I'm not sure what this would entail in this case.
This is because the cross setup hook uses |
Tested that |
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, well, this looks good. Reading https://arsv.github.io/perl-cross/design.html it looks like mini Perl is a holdover from the regular build. It shouldn't be needed at all for the cross build as it is just for bootstrapping, but I am fully sympathetic that Perl was too much of a mess to fix that.
Because it is weird, it's good that we renamed the output so we can figure out what's using it.
Motivation for this change
Cross-compiled
perl.dev
contains miniperl compiled for the build arch. When perl is added tobuildInputs
,perl.dev
ends up in$HOST_PATH
, causingpatchShebangs
to use${perl.dev}/bin/perl
as the shebang. A fix is to explicitly only includeperl.out
inbuildInputs
. This bug only occurs with Perl packages with executable scripts, for exampleXMLTwig
.This PR does not affect native builds, because native Perl does not have a
dev
output. I have only tested this PR with cross-compiledXMLTwig
. I attempted to test git and hydra, but they both depend on ModuleBuild, which currently cannot be cross-compiled.cc @alyssais @volth @worldofpeace
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)