unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Nikita Karetnikov <nikita@karetnikov.org>
Cc: bug-guix@gnu.org
Subject: Re: ghc-pkg: No such file or directory
Date: Mon, 24 Jun 2013 17:36:49 +0200	[thread overview]
Message-ID: <87fvw7r04u.fsf@gnu.org> (raw)
In-Reply-To: <87vc53h6nf.fsf@karetnikov.org> (Nikita Karetnikov's message of "Mon, 24 Jun 2013 19:26:12 +0400")

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’.

      reply	other threads:[~2013-06-24 15:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 15:26 ghc-pkg: No such file or directory Nikita Karetnikov
2013-06-24 15:36 ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fvw7r04u.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=bug-guix@gnu.org \
    --cc=nikita@karetnikov.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).