[Nix-dev] Re: ./configure errors in Perl

Tony White tonywhite100 at googlemail.com
Tue Jun 23 17:51:44 CEST 2009


2009/6/23 Peter Simons <simons at cryp.to>:
> Hi Tony,
>
>  > Are you building perl-5.8 or perl-5.10?
>
> the errors I saw come from Perl version 5.10. I'm building the
> stdenv-updates branch on Linux/x86.
>
> Take care,
> Peter
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at cs.uu.nl
> https://mail.cs.uu.nl/mailman/listinfo/nix-dev
>

At a guess :


{stdenv, fetchurl, glibc}:

stdenv.mkDerivation {
  name = "perl-5.10.0";

  src = fetchurl {
    url = mirror://cpan/src/perl-5.10.0.tar.gz;
    sha256 = "0bivbz15x02m02gqs6hs77cgjr2msfrhnvp5xqk359jg6w6llill";
  };

  patches = [
    # This patch does the following:
    # 1) Do use the PATH environment variable to find the `pwd' command.
    #    By default, Perl will only look for it in /lib and /usr/lib.
    #    !!! what are the security implications of this?
    # 2) Force the use of <errno.h>, not /usr/include/errno.h, on Linux
    #    systems.  (This actually appears to be due to a bug in Perl.)
    ./no-sys-dirs.patch
  ];

  # Build a thread-safe Perl with a dynamic libperls.o.  We need the
  # "installstyle" option to ensure that modules are put under
  # $out/lib/perl5 - this is the general default, but because $out
  # contains the string "perl", Configure would select $out/lib.
  configureFlags = ''
    -de -Dcc=gcc -Uinstallusrbinperl -Dinstallstyle=lib/perl5 -Duseshrplib
    ${if stdenv ? glibc then "-Dusethreads" else ""}
  '';

  configureScript = "./Configure";

  dontAddPrefix = true;

  buildInputs = [ glibc ];

  preConfigure =
    ''
      configureFlags="$configureFlags -Dprefix=$out
-Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"

      if test "$NIX_ENFORCE_PURITY" = "1"; then
        GLIBC=$(cat $NIX_GCC/nix-support/orig-libc)
        configureFlags="$configureFlags -Dlocincpth=$GLIBC/include
-Dloclibpth=$GLIBC/lib"
      fi
    '';

  preBuild =
    ''
      # Make Cwd work on NixOS (where we don't have a /bin/pwd).
      substituteInPlace lib/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
    '';

  setupHook = ./setup-hook.sh;
}



and top-level/all-packages.nix :




  perlReal = import ../development/interpreters/perl-5.10 {
    fetchurl = fetchurlBoot;
    inherit stdenv glibc;
  };

I could be wrong lmao, it introduces glibc to the expression and I
guess it might work but I can't be sure about how the dependencies
would work out. I'm still pretty new to nix.
Maybe someone could review this and approve or suggest please?
I'm very uncertain about those configure flags in the expression, I
don't understand what they are specifying exactly or why.

Either way, whether it's correct or not to do it the above way, If
libpthread.so.0 still can't be found using the above expression
modification, I guess perl-5.10's configure is not inspecting the
$PATH for libpthread.so.0 and therefore requires a patch to change the
location of which the configure script looks for libpthread.so.0,
which I suspect is more than likely. But another guess.
If it does need patching, then trying to get it in upstream during a
development cycle is actually a very good idea.
Plenty of sources look in lsb locations instead of the $PATH, it's
usually configure.in, it's just a minor mistake and should be
something any good dev accepts upstream as a patch. Within reason.

Thanks,

Tony



More information about the nix-dev mailing list