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

perlPackages.XMLParser fails to cross-compile #36675

Closed
bgamari opened this issue Mar 9, 2018 · 20 comments
Closed

perlPackages.XMLParser fails to cross-compile #36675

bgamari opened this issue Mar 9, 2018 · 20 comments
Labels
6.topic: cross-compilation Building packages on a different platform than they will be used on

Comments

@bgamari
Copy link
Contributor

bgamari commented Mar 9, 2018

Issue description

Cross-compiling perlPackages.XMLParser on nixpkgs' staging branch (e.g. with @shlevy's perl cross-compilation patch, 306d5cd) fails.

Steps to reproduce

$ git -C nixpkgs show
commit 306d5cdf03ad6375861a20b8885ef38699ca3c23
...
$ cat test.nix
let
  nixpkgs = import ./nixpkgs {};
  crossPkgs = import ./nixpkgs { crossSystem = nixpkgs.lib.systems.examples.armv7l-hf-multiplatform; };
in crossPkgs.perlPackages.XMLParser
$ nix-build ./test.nix
...
patching sources
configuring
patching ./samples/xmlfilter...
patching ./samples/canonical...
patching ./samples/xmlstats...
patching ./samples/xmlcomments...

Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' package with your
OS package manager. See 'README'.

Or you can download expat from:

http://sourceforge.net/projects/expat/

If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:

    EXPATLIBPATH=...  To set the directory in which to find libexpat

    EXPATINCPATH=...  To set the directory in which to find expat.h

For example:

    perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include

Note that if you build against a shareable library in a non-standard location
you may (on some platforms) also have to set your LD_LIBRARY_PATH environment
variable at run time for perl to find the library.

Checking if your kit is complete...
Warning: prerequisite LWP 0 not found.
Looks good
ERROR from evaluation of /tmp/nix-build-perl-XML-Parser-2.41-arm-unknown-linux-gnueabihf.drv-0/XML-Parser-2.41/Expat/Makefile.PL: Can't load module Tie::Hash::NamedCapture, dynamic loading not available in this perl.
  (You may need to build a new perl executable which either supports
  dynamic loading or has the Tie::Hash::NamedCapture module statically linked into it.)
 at /nix/store/1v96mbpfg5g9n58b74q5yafdfbhl1kj9-perl-5.24.3-arm-unknown-linux-gnueabihf/lib/perl5/5.24.3/English.pm line 155.
Compilation failed in require at /nix/store/1v96mbpfg5g9n58b74q5yafdfbhl1kj9-perl-5.24.3-arm-unknown-linux-gnueabihf/lib/perl5/5.24.3/English.pm line 155.
BEGIN failed--compilation aborted at /nix/store/1v96mbpfg5g9n58b74q5yafdfbhl1kj9-perl-5.24.3-arm-unknown-linux-gnueabihf/lib/perl5/5.24.3/English.pm line 155.
Compilation failed in require at ./Makefile.PL line 3.
BEGIN failed--compilation aborted at ./Makefile.PL line 3.
builder for '/nix/store/g4qzia34nq5r4zizhp3vhl712lavqrkd-perl-XML-Parser-2.41-arm-unknown-linux-gnueabihf.drv' failed with exit code 255
error: build of '/nix/store/g4qzia34nq5r4zizhp3vhl712lavqrkd-perl-XML-Parser-2.41-arm-unknown-linux-gnueabihf.drv' failed

Technical details

Hmmm...

$ nix-shell -p nix-info --run "nix-info -m"
error: undefined variable 'nix-info' at (string):1:94
(use '--show-trace' to show detailed location information)
@shlevy
Copy link
Member

shlevy commented Mar 11, 2018

@bgamari I'm not really sure what's causing this, and am not sure when I'll have a chance to dig in... sorry!

@bgamari
Copy link
Contributor Author

bgamari commented Mar 11, 2018

Perhaps we should back out the perl cross-compilation support until this is fixed? This is currently a bit of a regression from master.

@shlevy
Copy link
Member

shlevy commented Mar 11, 2018

Wait, how did this work on master? You can't cross-compile perl modules at all there.

@bgamari
Copy link
Contributor Author

bgamari commented Mar 11, 2018 via email

@shlevy
Copy link
Member

shlevy commented Mar 12, 2018

I'm a bit hesitant to revert an unambiguous if partial improvement for the pure true cross-country case, but I don't want to gratuitously break things, even inherently impure/unsupported things like binfmt for cross. Do you have any thoughts on how you can fit your needs without requiring us to solve all binfmt-capable cases at once?

@bgamari
Copy link
Contributor Author

bgamari commented Mar 12, 2018

I'm a bit hesitant to revert an unambiguous if partial improvement for the pure true cross-country case

Quite understandable; I also don't mind just reverting the patch in my branch.

@shlevy
Copy link
Member

shlevy commented Mar 12, 2018

cross-country

😅

Anyway, I'd like to look at a full build-native perl for cross-compilation, and hopefully when we can get that in it will address this or make it easier to debug.

@bgamari
Copy link
Contributor Author

bgamari commented Mar 27, 2018

@shlevy fixed this in (IIRC) cb88f21.

@bgamari bgamari closed this as completed Mar 27, 2018
@bgamari
Copy link
Contributor Author

bgamari commented Apr 23, 2018

Hmmm, is this actually fixed, @shlevy? I still seem to be seeing it on a variant of cd2cb15.

@shlevy
Copy link
Member

shlevy commented Apr 23, 2018

What error are you getting?

@bgamari
Copy link
Contributor Author

bgamari commented Apr 23, 2018

The same error as was reported above:

ERROR from evaluation of /tmp/nix-build-perl-XML-Parser-2.41-arm-unknown-linux-gnueabihf.drv-0/XML-Parser-2.41/Expat/Makefile.PL: Can't load module Tie::Hash::NamedCapture, dynamic loading not available in this perl.
  (You may need to build a new perl executable which either supports
  dynamic loading or has the Tie::Hash::NamedCapture module statically linked into it.)
 at /nix/store/1v96mbpfg5g9n58b74q5yafdfbhl1kj9-perl-5.24.3-arm-unknown-linux-gnueabihf/lib/perl5/5.24.3/English.pm line 155.
Compilation failed in require at /nix/store/1v96mbpfg5g9n58b74q5yafdfbhl1kj9-perl-5.24.3-arm-unknown-linux-gnueabihf/lib/perl5/5.24.3/English.pm line 155.
BEGIN failed--compilation aborted at /nix/store/1v96mbpfg5g9n58b74q5yafdfbhl1kj9-perl-5.24.3-arm-unknown-linux-gnueabihf/lib/perl5/5.24.3/English.pm line 155.
Compilation failed in require at ./Makefile.PL line 3.
BEGIN failed--compilation aborted at ./Makefile.PL line 3.

@shlevy
Copy link
Member

shlevy commented Apr 24, 2018

Did this ever work for you since my perl cross changes?

@bgamari
Copy link
Contributor Author

bgamari commented Apr 24, 2018

I thought so but this seems to suggest I was wrong. Reopening.

@bgamari bgamari reopened this Apr 24, 2018
@dtzWill
Copy link
Member

dtzWill commented Apr 24, 2018

subscribes

@ElvishJerricco
Copy link
Contributor

ElvishJerricco commented Jun 4, 2018

I'm also getting this. I think it's caused by the check_lib usage. http://search.cpan.org/~mattn/Devel-CheckLib-1.13/lib/Devel/CheckLib.pm Looks like it will use the native C compiler that was used to build perl to check if the linker flags work. Obviously this won't work when cross compiling. Derp that's just a warning.

@ElvishJerricco
Copy link
Contributor

In the meantime, I'm reverting 54a13b0 locally as a workaround. That commit broke @shlevy's work on cross compiling NixOS.

@bgamari
Copy link
Contributor Author

bgamari commented Jul 31, 2018

I don't mean to instigate a scripting-language-war but it seems like a nice way around this issue would be to reimplement these scripts in a language more suitable to cross-compilation (e.g. Python). Continuing to use perl in this capacity is almost certain to be a persistent source of cross-compilation headaches.

@shlevy
Copy link
Member

shlevy commented Jul 31, 2018

💯

@ElvishJerricco
Copy link
Contributor

Yea. Eliminating as much perl as possible from NixOS would be a big win IMO.

@c0bw3b c0bw3b added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Nov 21, 2018
@c0bw3b
Copy link
Contributor

c0bw3b commented Nov 21, 2018

Fixed in #48258

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
Projects
None yet
Development

No branches or pull requests

5 participants