NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.31k stars 13.54k forks source link

Perl fails to cross-compile from macOS #113985

Open siraben opened 3 years ago

siraben commented 3 years ago

Describe the bug Perl fails to cross-compile from macOS.

build log ``` @nix { "action": "setPhase", "phase": "unpackPhase" } unpacking sources unpacking source archive /nix/store/bl6b2p0aw8phljjn0s3xzyghbbzawl2r-perl-5.32.0.tar.gz source root is perl-5.32.0 unpacking source archive /nix/store/pzwzr28mj1h6x49smrb2jp8ayjv5p4ir-4c55233ae95a6aef4d93291fe8ad12709b11e575.tar.gz setting SOURCE_DATE_EPOCH to timestamp 1592671121 of file perl-5.32.0/pod/perlhist.pod @nix { "action": "setPhase", "phase": "patchPhase" } patching sources applying patch /nix/store/mb381gpm9k5wdl37l5ad5pp8w11qzhjg-no-sys-dirs-5.31.patch patching file Configure Hunk #1 FAILED at 106. Hunk #2 FAILED at 1337. Hunk #3 FAILED at 1349. Hunk #4 FAILED at 1391. Hunk #5 FAILED at 2446. Hunk #6 FAILED at 4936. Hunk #7 FAILED at 8600. Hunk #8 FAILED at 19900. 8 out of 8 hunks FAILED -- saving rejects to file Configure.rej patching file ext/Errno/Errno_pm.PL patching file hints/freebsd.sh Hunk #1 succeeded at 127 (offset 8 lines). patching file hints/linux.sh ```

To Reproduce

$ nix build .#pkgsCross.raspberryPi.perl

Expected behavior Perl should cross-compile.

Notify maintainers @edolstra @stigtsp

Also @Ericson2314 @matthewbauer

SCOTT-HAMILTON commented 3 years ago

Running the patch manually gives me this output on nixos :

patching file Configure
Hunk #1 succeeded at 108 (offset 2 lines).
Hunk #2 succeeded at 1427 with fuzz 1 (offset 98 lines).
Hunk #3 succeeded at 1441 with fuzz 1 (offset 101 lines).
Hunk #4 succeeded at 1481 with fuzz 1 (offset 104 lines).
Hunk #5 succeeded at 2537 (offset 107 lines).
Hunk #6 succeeded at 5032 (offset 113 lines).
Hunk #7 succeeded at 8860 (offset 277 lines).
Hunk #8 succeeded at 21005 (offset 1127 lines).
patching file ext/Errno/Errno_pm.PL
patching file hints/freebsd.sh
Hunk #1 succeeded at 127 (offset 8 lines).
patching file hints/linux.sh

The 2 lines offset didn't seem to be considered on your build.

I've cleaned the patch to have no more confusions, could you try this fix here : https://gist.github.com/SCOTT-HAMILTON/7a606041b497a379191cf77ca84c95d4.

One liner (to run in nixpkgs root dir):

curl https://gist.githubusercontent.com/SCOTT-HAMILTON/7a606041b497a379191cf77ca84c95d4/raw/acefe422ba1874e33521c77540008771f8efedd9/macos-cross-rpi-perl-patch-fix.patch | patch -p1
thefloweringash commented 3 years ago

I believe this is a case-insensitive filesystem problem. To cross compile perl nixpkgs uses the arsv/perl-cross. This project has a configure, which collides with the Configure from the perl distribution. I ran into this working on #105026. As a workaround, I renamed perl-cross-${version}/configure to configure.cross before merging into the working directory.

siraben commented 3 years ago

I've cleaned the patch to have no more confusions, could you try this fix here : https://gist.github.com/SCOTT-HAMILTON/7a606041b497a379191cf77ca84c95d4.

Unfortunately since perl is a dependency of many packages I have approximately 200 from-source builds to perform πŸ˜…. Perhaps @SuperSandro2000 can test on his macOS VM?

SuperSandro2000 commented 3 years ago
make[1]: Leaving directory '/private/var/folders/r4/k85s52jx3555ckj0wty615s00000gp/T/nix-build-coreutils-8.32-armv6l-unknown-linux-gnueabihf.drv-0/coreutils-8.32'
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/4ajc7vcrin9dg8qmvczrxp696fj37hbj-coreutils-8.32-armv6l-unknown-linux-gnueabihf
shrinking /nix/store/4ajc7vcrin9dg8qmvczrxp696fj37hbj-coreutils-8.32-armv6l-unknown-linux-gnueabihf/bin/coreutils
shrinking /nix/store/4ajc7vcrin9dg8qmvczrxp696fj37hbj-coreutils-8.32-armv6l-unknown-linux-gnueabihf/libexec/coreutils/libstdbuf.so
armv6l-unknown-linux-gnueabihf-strip is /nix/store/b3yydjvv0rcfnr185493axc1dkkygn6g-armv6l-unknown-linux-gnueabihf-binutils-2.35.1/bin/armv6l-unknown-linux-gnueabihf-strip
stripping (with command armv6l-unknown-linux-gnueabihf-strip and flags -S) in /nix/store/4ajc7vcrin9dg8qmvczrxp696fj37hbj-coreutils-8.32-armv6l-unknown-linux-gnueabihf/libexec  /nix/store/4ajc7vcrin9dg8qmvczrxp696fj37hbj-coreutils-8.32-armv6l-unknown-linux-gnueabihf/bin
patching script interpreter paths in /nix/store/4ajc7vcrin9dg8qmvczrxp696fj37hbj-coreutils-8.32-armv6l-unknown-linux-gnueabihf
checking for references to /private/var/folders/r4/k85s52jx3555ckj0wty615s00000gp/T/nix-build-coreutils-8.32-armv6l-unknown-linux-gnueabihf.drv-0/ in /nix/store/4ajc7vcrin9dg8qmvczrxp696fj37hbj-coreutils-8.32-armv6l-unknown-linux-gnueabihf...
shrinking RPATHs of ELF executables and libraries in /nix/store/phxry1y1vcg8wkaqys41hhg567jilkga-coreutils-8.32-armv6l-unknown-linux-gnueabihf-info
armv6l-unknown-linux-gnueabihf-strip is /nix/store/b3yydjvv0rcfnr185493axc1dkkygn6g-armv6l-unknown-linux-gnueabihf-binutils-2.35.1/bin/armv6l-unknown-linux-gnueabihf-strip
patching script interpreter paths in /nix/store/phxry1y1vcg8wkaqys41hhg567jilkga-coreutils-8.32-armv6l-unknown-linux-gnueabihf-info
checking for references to /private/var/folders/r4/k85s52jx3555ckj0wty615s00000gp/T/nix-build-coreutils-8.32-armv6l-unknown-linux-gnueabihf.drv-0/ in /nix/store/phxry1y1vcg8wkaqys41hhg567jilkga-coreutils-8.32-armv6l-unknown-linux-gnueabihf-info...
building '/nix/store/rp92nrgini7g8dwd3q2d4xag77my97mi-perl-5.32.0-armv6l-unknown-linux-gnueabihf.drv'...
unpacking sources
unpacking source archive /nix/store/bl6b2p0aw8phljjn0s3xzyghbbzawl2r-perl-5.32.0.tar.gz
source root is perl-5.32.0
unpacking source archive /nix/store/pzwzr28mj1h6x49smrb2jp8ayjv5p4ir-4c55233ae95a6aef4d93291fe8ad12709b11e575.tar.gz
setting SOURCE_DATE_EPOCH to timestamp 1592671121 of file perl-5.32.0/pod/perlhist.pod
patching sources
applying patch /nix/store/62lrnnknqh7yccm673cklhh1h58ayi3b-no-sys-dirs-5.31.patch
patching file Configure
Hunk #1 FAILED at 108.
Hunk #2 FAILED at 1435.
Hunk #3 FAILED at 1450.
Hunk #4 FAILED at 1495.
Hunk #5 FAILED at 2553.
Hunk #6 FAILED at 5049.
Hunk #7 FAILED at 8877.
Hunk #8 FAILED at 21027.
8 out of 8 hunks FAILED -- saving rejects to file Configure.rej
patching file ext/Errno/Errno_pm.PL
patching file hints/freebsd.sh
patching file hints/linux.sh
builder for '/nix/store/rp92nrgini7g8dwd3q2d4xag77my97mi-perl-5.32.0-armv6l-unknown-linux-gnueabihf.drv' failed with exit code 1
error: build of '/nix/store/rp92nrgini7g8dwd3q2d4xag77my97mi-perl-5.32.0-armv6l-unknown-linux-gnueabihf.drv' failed
┏━ Currently building:
┃ β–Ά perl-5.32.0-armv6l-unknown-linux-gnueabihf ⏲ 00:00:04
┣━━━ Builds                β”‚ Downloads     β”‚
┗━ 𝚺  β–Ά   1 β”‚ βœ” 180 │⏳   0 β”‚ ⬇ 199 │⏳   0 β”‚ ⏲ 05:52:20
stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info