all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nikita Karetnikov <nikita@karetnikov.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: 'substitute*' fails with "string contains #\nul character" (was: 'patchelf' doesn't change shared libraries)
Date: Tue, 16 Jul 2013 21:55:50 +0400	[thread overview]
Message-ID: <87a9lml789.fsf_-_@karetnikov.org> (raw)
In-Reply-To: <87zjtneb3u.fsf@gnu.org> ("Ludovic Courtès"'s message of "Tue, 16 Jul 2013 00:01:41 +0200")


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

'substitute*' fails to patch a binary and returns the following error

[...]

starting phase `pre-configure'
Backtrace:
In ice-9/boot-9.scm:
2320: 19 [save-module-excursion #<procedure 8e81de0 at ice-9/boot-9.scm:3961:3 ()>]
3966: 18 [#<procedure 8e81de0 at ice-9/boot-9.scm:3961:3 ()>]
1645: 17 [%start-stack load-stack ...]
1650: 16 [#<procedure 8e84df8 ()>]
In unknown file:
   ?: 15 [primitive-load "/nix/store/rcjkvdqp28dnp7igksnf3lzgwzxqvadb-ghc-bin-7.0.1-guile-builder"]
In ice-9/eval.scm:
 387: 14 [eval # ()]
In srfi/srfi-1.scm:
 830: 13 [every1 #<procedure 9090f10 at /nix/store/04z6assixr4ms2fmvm2m42aw1a8k07x5-module-import/guix/build/gnu-build-system.scm:364:9 (expr)> ...]
In /nix/store/04z6assixr4ms2fmvm2m42aw1a8k07x5-module-import/guix/build/gnu-build-system.scm:
 368: 12 [#<procedure 9090f10 at /nix/store/04z6assixr4ms2fmvm2m42aw1a8k07x5-module-import/guix/build/gnu-build-system.scm:364:9 (expr)> #]
In ice-9/eval.scm:
 432: 11 [eval # #]
In srfi/srfi-1.scm:
 616: 10 [for-each #<procedure 9097a98 at ice-9/eval.scm:416:20 (a)> #]
In ice-9/boot-9.scm:
 171: 9 [with-throw-handler #t ...]
 793: 8 [call-with-input-file "inplace/bin/ghc-cabal" ...]
In /nix/store/04z6assixr4ms2fmvm2m42aw1a8k07x5-module-import/guix/build/utils.scm:
 336: 7 [#<procedure 908b4e0 at /nix/store/04z6assixr4ms2fmvm2m42aw1a8k07x5-module-import/guix/build/utils.scm:335:10 (in)> #<input: inplace/bin/ghc-cabal 11>]
 361: 6 [#<procedure 9320fc0 at /nix/store/04z6assixr4ms2fmvm2m42aw1a8k07x5-module-import/guix/build/utils.scm:357:6 (in out)> #<input: inplace/bin/ghc-cabal 11> ...]
In srfi/srfi-1.scm:
 465: 5 [fold #<procedure 9026f40 at /nix/store/04z6assixr4ms2fmvm2m42aw1a8k07x5-module-import/guix/build/utils.scm:361:32 (r+p line)> ...]
In /nix/store/04z6assixr4ms2fmvm2m42aw1a8k07x5-module-import/guix/build/utils.scm:
 364: 4 [#<procedure 9026f40 at /nix/store/04z6assixr4ms2fmvm2m42aw1a8k07x5-module-import/guix/build/utils.scm:361:32 (r+p line)> # ...]
In ice-9/regex.scm:
 189: 3 [list-matches # ...]
 176: 2 [fold-matches # ...]
In unknown file:
   ?: 1 [regexp-exec # ...]
In ice-9/boot-9.scm:
 106: 0 [#<procedure 908b500 at ice-9/boot-9.scm:97:6 (thrown-k . args)> misc-error ...]

ice-9/boot-9.scm:106:20: In procedure #<procedure 908b500 at ice-9/boot-9.scm:97:6 (thrown-k . args)>:
ice-9/boot-9.scm:106:20: string contains #\nul character:

[...]


[-- Attachment #1.2: ghc-7.0.1-bin.diff --]
[-- Type: text/x-diff, Size: 7516 bytes --]

diff --git a/gnu/packages/ghc.scm b/gnu/packages/ghc.scm
new file mode 100644
index 0000000..1a3d308
--- /dev/null
+++ b/gnu/packages/ghc.scm
@@ -0,0 +1,114 @@
+;;; 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 base)
+  #:use-module (gnu packages bootstrap)
+  #:use-module (gnu packages libffi)
+  #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages patchelf)
+  #:use-module (gnu packages perl))
+
+(define-public ghc-7.0.1-bin
+  (package
+    (name "ghc-bin")
+    ;; 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 _
+                   (let ((gmp (string-append (assoc-ref %build-inputs "gmp")
+                                             "/lib"))
+                         (linker (string-append
+                                  (assoc-ref %build-inputs "libc")
+                                  ,(glibc-dynamic-linker)))
+                         (libffi (string-append
+                                  (assoc-ref %build-inputs "libffi")
+                                  "/lib"))
+                         (ncurses (string-append
+                                   (assoc-ref %build-inputs "ncurses")
+                                   "/lib"))
+                         (patchelf (which "patchelf"))
+                         (pwd (which "pwd"))
+                         (sh (which "sh")))
+                     (begin (substitute* '("configure"
+                                           "mk/config.mk.in"
+                                           "utils/ghc-pkg/ghc.mk"
+
+                                           ;; Fails with a "string contains
+                                           ;; #\nul character" error.
+                                           "inplace/bin/ghc-cabal"
+
+                                           "inplace/bin/mkdirhier"
+                                           "utils/ghc-pkg/ghc.mk")
+                              (("/bin/sh") sh)
+                              (("/usr/local/bin/bash") sh)
+                              (("utils/ghc-pwd/ghc-pwd") pwd))
+
+                            (every (lambda (file)
+                                     (zero?
+                                      (system* patchelf
+                                               "--set-interpreter" linker
+                                               "--set-rpath"
+                                               (string-append gmp ":" ncurses)
+                                               file)))
+                                   (filter executable-file?
+                                           (find-files "utils" "")))
+
+                            (zero? (system* patchelf
+                                            "--set-interpreter" linker
+                                            "--set-rpath"
+                                            (string-append gmp ":" libffi)
+                                            "inplace/bin/ghc-cabal")))))
+
+                 (alist-delete 'build %standard-phases))
+       #:tests? #f))
+    (inputs
+     `(("gmp" ,gmp-4.3)
+       ("libc" ,glibc)
+       ("libffi" ,libffi-3.0)
+       ("ncurses" ,ncurses)
+       ("patchelf" ,patchelf)
+       ("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."))))
diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index e4a2761..dbc41c3 100644
--- a/gnu/packages/libffi.scm
+++ b/gnu/packages/libffi.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -71,3 +72,16 @@ conversions for values passed between the two languages.")
     ;; See <http://github.com/atgreen/libffi/blob/master/LICENSE>.
     (license expat))))
 
+(define-public libffi-3.0
+  (package (inherit libffi)
+    (name "libffi")
+    (version "3.0.10")
+    (source
+     (origin
+      (method url-fetch)
+      (uri
+       (string-append "ftp://sourceware.org/pub/libffi/"
+                      name "-" version ".tar.gz"))
+      (sha256
+       (base32 "0bs97dgvqrbzc9zv9y2ff5flfvbmfyc68dpnxvm6mdcygq1bj7ph"))))
+    (arguments `(#:phases (alist-delete 'post-install %standard-phases)))))
diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm
index 16383d1..f8553c8 100644
--- a/gnu/packages/multiprecision.scm
+++ b/gnu/packages/multiprecision.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,9 +66,20 @@ emphasis on speed.
 GMP is faster than any other bignum library.  The advantage for GMP increases
 with the operand sizes for many operations, since GMP uses asymptotically
 faster algorithms.")
-   (license lgpl3+)
+   (license (list gpl3+ lgpl3+))
    (home-page "http://gmplib.org/")))
 
+(define-public gmp-4.3
+  (package (inherit gmp)
+   (version "4.3.2")
+   (source
+    (origin
+     (method url-fetch)
+     (uri
+      (string-append "mirror://gnu/gmp/gmp-" version ".tar.bz2"))
+     (sha256
+      (base32 "0x8prpqi9amfcmi7r4zrza609ai9529pjaq0h4aw51i867064qck"))))))
+
 (define-public mpfr
   (package
    (name "mpfr")

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

  reply	other threads:[~2013-07-16 17:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-14 13:33 'patchelf' doesn't change shared libraries Nikita Karetnikov
2013-07-14 13:44 ` Ludovic Courtès
2013-07-14 15:10   ` Nikita Karetnikov
2013-07-15 22:01     ` Ludovic Courtès
2013-07-16 17:55       ` Nikita Karetnikov [this message]
2013-07-16 19:07         ` 'substitute*' fails with "string contains #\nul character" Ludovic Courtès
2013-08-05 21:20         ` Nikita Karetnikov
2013-08-15 10:37           ` Ludovic Courtès
2013-08-18  5:57             ` Nikita Karetnikov
2013-08-18 22:13               ` Ludovic Courtès
2013-08-18 23:53                 ` Nikita Karetnikov
2013-08-19 11:22                   ` Ludovic Courtès
2013-08-20  5:42                     ` Nikita Karetnikov
2013-08-20  7:23                       ` Ludovic Courtès
2013-08-21  5:15                         ` Nikita Karetnikov

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

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

  git send-email \
    --in-reply-to=87a9lml789.fsf_-_@karetnikov.org \
    --to=nikita@karetnikov.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.