Skip to content

perl: crosscompile perl failed with xconfig.h:114:3: error: invalid preprocessing directive #HAS_FDOPENDIR #418939

@enkerewpo

Description

@enkerewpo

Nixpkgs version

  • Unstable (25.11)

Describe the bug

I'm trying to crosscompile loongarch NixOS (minimal.nix) on x64 machine, but encountered perl compilation error:

...

Ok, back to the top-level configure
Generating config.h and xconfig.h
Extracting config.h (with variable substitutions)
Extracting xconfig.h (with variable substitutions)
Generating Makefile.config

Configuration completed for cross build

      build platform:  x86_64-linux
          C compiler:  gcc
              linker:  gcc
                  ar:  ar
              ranlib:  ranlib
             objdump:  objdump

     target platform:  loongarch64-linux
          C compiler:  loongarch64-unknown-linux-gnu-gcc
                  ld:  loongarch64-unknown-linux-gnu-gcc
                  ar:  loongarch64-unknown-linux-gnu-ar
              ranlib:  loongarch64-unknown-linux-gnu-ranlib
             objdump:  loongarch64-unknown-linux-gnu-objdump

              prefix:  /nix/store/rl5kvfr954gxcbk0r2b68rnfdyccqd2k-perl-loongarch64-unknown-linux-gnu-5.40.0
             sysroot:  
 installation prefix:  
         executables:  /nix/store/rl5kvfr954gxcbk0r2b68rnfdyccqd2k-perl-loongarch64-unknown-linux-gnu-5.40.0/bin
             scripts:  /nix/store/rl5kvfr954gxcbk0r2b68rnfdyccqd2k-perl-loongarch64-unknown-linux-gnu-5.40.0/bin
             privlib:  /nix/store/rl5kvfr954gxcbk0r2b68rnfdyccqd2k-perl-loongarch64-unknown-linux-gnu-5.40.0/lib/perl5/5.40.0
             archlib:  /nix/store/rl5kvfr954gxcbk0r2b68rnfdyccqd2k-perl-loongarch64-unknown-linux-gnu-5.40.0/lib/perl5/5.40.0/loongarch64-linux
 section 1 man pages:  /nix/store/rl5kvfr954gxcbk0r2b68rnfdyccqd2k-perl-loongarch64-unknown-linux-gnu-5.40.0/share/man/man1  (with '1' extension)
 section 3 man pages:  /nix/store/rl5kvfr954gxcbk0r2b68rnfdyccqd2k-perl-loongarch64-unknown-linux-gnu-5.40.0/share/man/man3  (with '3' extension)

configurePhase completed in 1 minutes 7 seconds
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
build flags: SHELL=/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash
make crosspatch
make[1]: Entering directory '/build/perl-5.40.0'
patch -p1 -i cnf/diffs/perl5-5.40.0/makemaker.patch && touch cnf/diffs/perl5-5.40.0/makemaker.appliedpatching file cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
patch -p1 -i cnf/diffs/perl5-5.40.0/findext.patch && touch cnf/diffs/perl5-5.40.0/findext.applied
patching file win32/FindExt.pm
patch -p1 -i cnf/diffs/perl5-5.40.0/test-checkcase.patch && touch cnf/diffs/perl5-5.40.0/test-checkcase.applied
patching file t/porting/checkcase.t
patch -p1 -i cnf/diffs/perl5-5.40.0/constant.patch && touch cnf/diffs/perl5-5.40.0/constant.applied
patching file cpan/ExtUtils-Constant/t/Constant.t
patch -p1 -i cnf/diffs/perl5-5.40.0/liblist.patch && touch cnf/diffs/perl5-5.40.0/liblist.applied
patching file cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
patch -p1 -i cnf/diffs/perl5-5.40.0/dynaloader.patch && touch cnf/diffs/perl5-5.40.0/dynaloader.applied
patching file ext/DynaLoader/hints/linux.pl
patch -p1 -i cnf/diffs/perl5-5.40.0/xconfig.patch && touch cnf/diffs/perl5-5.40.0/xconfig.applied
patching file perl.h
patching file perl_langinfo.h
patching file locale.c
patch -p1 -i cnf/diffs/perl5-5.40.0/installscripts.patch && touch cnf/diffs/perl5-5.40.0/installscripts.applied
patching file installman
patching file installperl
patch -p1 -i cnf/diffs/perl5-5.40.0/test-makemaker.patch && touch cnf/diffs/perl5-5.40.0/test-makemaker.applied
patching file cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Utils.pm
patch -p1 -i cnf/diffs/perl5-5.40.0/posix-makefile.patch && touch cnf/diffs/perl5-5.40.0/posix-makefile.applied
patching file ext/POSIX/Makefile.PL
make[1]: Leaving directory '/build/perl-5.40.0'
make miniperl
make[1]: Entering directory '/build/perl-5.40.0'
gcc -DPERL_CORE -DUSE_CROSS_COMPILE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fwrapv -fno-strict-aliasing -c -o miniperlmain.host.o miniperlmain.c
In file included from perl.h:49,
                 from miniperlmain.c:57:
xconfig.h:114:3: error: invalid preprocessing directive #HAS_FDOPENDIR
  114 | # HAS_FDOPENDIR         /**/
      |   ^~~~~~~~~~~~~
In file included from perl.h:7874:
sv_inline.h:566:1: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  566 | Perl_SvPVXtrue(pTHX_ SV *sv)
      | ^~~~~~~~~~~~~~
sv_inline.h:536:1: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  536 | Perl_newSV_type_mortal(pTHX_ const svtype type)
      | ^~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:114: miniperlmain.host.o] Error 1
make[1]: Leaving directory '/build/perl-5.40.0'
make: *** [Makefile:85: all] Error 2

Steps to reproduce

use nix to cross build latest git version of nixos/perl package with target loongarch64-linux and host machine x86_64

Expected behaviour

should compile

Screenshots

No response

Relevant log output

Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.1.0-35-amd64, Debian GNU/Linux, 12 (bookworm), 20240831T094530Z
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.28.2
  • channels(root): "nixpkgs"
  • nixpkgs: /nix/store/hk6qzjbqrvm6wmdj37pl7k5ip9iypbay-nixpkgs/nixpkgs

Notify maintainers


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions