unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* ghc-pkg: No such file or directory
@ 2013-06-24 15:26 Nikita Karetnikov
  2013-06-24 15:36 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Nikita Karetnikov @ 2013-06-24 15:26 UTC (permalink / raw)
  To: bug-guix


[-- Attachment #1.1: Type: text/plain, Size: 2107 bytes --]

I'm trying to package a binary version of GHC (attached), which fails
with the following error:

/nix/store/snrdydzbrw9aqnz569k73dmk67wn1akv-my-coreutils-8.20/bin/install -c -m 755 -d "/nix/store/gy7g3k7bwpaf7pvm70d0rn8xh8b7rq6h-ghc-bin-7.0.1/lib/ghc-7.0.1/package.conf.d"
"/nix/store/gy7g3k7bwpaf7pvm70d0rn8xh8b7rq6h-ghc-bin-7.0.1/lib/ghc-7.0.1/ghc-pkg" --force --global-conf "/nix/store/gy7g3k7bwpaf7pvm70d0rn8xh8b7rq6h-ghc-bin-7.0.1/lib/ghc-7.0.1/package.conf.d" update libffi/package.conf.install
/nix/store/zkg7nnj03yp6pg9gx8wq3lpalr4ffw71-bash-4.2/bin/sh: /nix/store/gy7g3k7bwpaf7pvm70d0rn8xh8b7rq6h-ghc-bin-7.0.1/lib/ghc-7.0.1/ghc-pkg: No such file or directory
make[1]: *** [install_packages] Error 127
make: *** [install] Error 2
phase `install' failed after 2 seconds
note: keeping build directory `/tmp/nix-build-ghc-bin-7.0.1.drv-16'
builder for `/nix/store/8ifycdgaisy3n6xsxkm05cklcmra40yw-ghc-bin-7.0.1.drv' failed with exit code 1
@ build-failed /nix/store/8ifycdgaisy3n6xsxkm05cklcmra40yw-ghc-bin-7.0.1.drv - 1 builder for `/nix/store/8ifycdgaisy3n6xsxkm05cklcmra40yw-ghc-bin-7.0.1.drv' failed with exit code 1
guix build: error: build failed: build of `/nix/store/8ifycdgaisy3n6xsxkm05cklcmra40yw-ghc-bin-7.0.1.drv' failed

I'm not sure what causes the problem.  I don't see anything strange in
makefiles.  Should I patch executables?  Here is a relevant snippet from
'6.12.1-binary.nix':

    (if stdenv.isLinux then ''
      find . -type f -perm +100 \
          -exec patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
          --set-rpath "${ncurses}/lib:${gmp}/lib" {} \;
      sed -i "s|/usr/bin/perl|perl\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
      sed -i "s|/usr/bin/gcc|gcc\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
      for prog in ld ar gcc strip ranlib; do
        find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
      done
     '' else "");

What do you think?

P.S. I'm using a previous version of 'coreutils' (i.e., 'my-coreutils'),
which should be removed from the recipe.


[-- Attachment #1.2: ghc.scm --]
[-- Type: text/plain, Size: 2908 bytes --]

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages ghc)
  #:use-module ((guix licenses) #:select (bsd-style))
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages my-coreutils) ; XXX: use 'base.scm'
  #:use-module (gnu packages perl))

(define-public ghc-7.0.1-bin
  (package
    (name "ghc-bin")
    ;; This package can be used for the following versions: 7.0.2--7.6.3.
    (version "7.0.1")
    (source
     (origin
      (method url-fetch)
      ;; XXX: Support other platforms.
      (uri (string-append "http://www.haskell.org/ghc/dist/"
                          version "/ghc-" version
                          "-i386-unknown-linux.tar.bz2"))
      (sha256
       (base32
        "1cc9ih3h804gj53vf1xabg4155m6bz5r468mjsv54kckmabgsmav"))))
    (build-system gnu-build-system)
    (arguments
     `(#:modules ((guix build gnu-build-system)
                  (guix build utils)
                  (srfi srfi-1))
       #:phases (alist-cons-before
                 'configure 'pre-configure
                 (lambda _
                   (begin (substitute* '("configure"
                                         "mk/config.mk.in"
                                         "inplace/bin/mkdirhier"
                                         "utils/ghc-pkg/ghc.mk")
                            (("/bin/sh") (which "sh"))
                            (("/usr/local/bin/bash") (which "sh")))
                          (copy-file (which "pwd") "utils/ghc-pwd/ghc-pwd")))
                 (alist-delete 'build %standard-phases))
       #:tests? #f))
    (inputs
     `(("coreutils" ,my-coreutils)
       ("perl" ,perl)))
    (home-page "http://www.haskell.org/ghc/")
    (synopsis "Haskell compiler and interactive environment")
    (description
     "This is a binary distribution of GHC, a compiler and interactive
environment for the Haskell functional programming language.")
    (license (bsd-style "file://LICENSE"
                        "See LICENSE in the distribution."))))

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ghc-pkg: No such file or directory
  2013-06-24 15:26 ghc-pkg: No such file or directory Nikita Karetnikov
@ 2013-06-24 15:36 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2013-06-24 15:36 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: bug-guix

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> I'm trying to package a binary version of GHC (attached), which fails
> with the following error:
>
> /nix/store/snrdydzbrw9aqnz569k73dmk67wn1akv-my-coreutils-8.20/bin/install -c -m 755 -d "/nix/store/gy7g3k7bwpaf7pvm70d0rn8xh8b7rq6h-ghc-bin-7.0.1/lib/ghc-7.0.1/package.conf.d"
> "/nix/store/gy7g3k7bwpaf7pvm70d0rn8xh8b7rq6h-ghc-bin-7.0.1/lib/ghc-7.0.1/ghc-pkg" --force --global-conf "/nix/store/gy7g3k7bwpaf7pvm70d0rn8xh8b7rq6h-ghc-bin-7.0.1/lib/ghc-7.0.1/package.conf.d" update libffi/package.conf.install
> /nix/store/zkg7nnj03yp6pg9gx8wq3lpalr4ffw71-bash-4.2/bin/sh: /nix/store/gy7g3k7bwpaf7pvm70d0rn8xh8b7rq6h-ghc-bin-7.0.1/lib/ghc-7.0.1/ghc-pkg: No such file or directory

Most likely that’s because of the ELF interpreter, which needs to be
patched.

Try ‘strings .../ghc-pkg | grep ld-linux’, and notice how the file name
is wrong.

PatchELF allows you to fix that.

> I'm not sure what causes the problem.  I don't see anything strange in
> makefiles.  Should I patch executables?  Here is a relevant snippet from
> '6.12.1-binary.nix':
>
>     (if stdenv.isLinux then ''
>       find . -type f -perm +100 \
>           -exec patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
>           --set-rpath "${ncurses}/lib:${gmp}/lib" {} \;

This part is what I’m referring to.

>       sed -i "s|/usr/bin/perl|perl\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
>       sed -i "s|/usr/bin/gcc|gcc\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
>       for prog in ld ar gcc strip ranlib; do
>         find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
>       done
>      '' else "");

You may need to port these tricks as well.  :-)

HTH,
Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-24 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-24 15:26 ghc-pkg: No such file or directory Nikita Karetnikov
2013-06-24 15:36 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).