summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-05-27 22:23:21 +0200
committerLudovic Courtès <ludo@gnu.org>2013-05-27 23:43:00 +0200
commit47e74d6e9d7d3a5f72a2b67f1916a719c61c86f8 (patch)
treeb641b2ed6f21b339ea3cabe25fa7aad74c2421b6
parent4bfc4ea34961894cbe46eed6f2003bfd79646b3c (diff)
downloadguix-47e74d6e9d7d3a5f72a2b67f1916a719c61c86f8.tar.gz
gnu: cross-binutils: Build with `--with-sysroot'.
This fixes resolution of DT_NEEDED entries in cross-built libraries.
For instance, if ltdl.so needs libdl.so and has it in its RUNPATH, then
libdl.so is searched for in the right place.

* gnu/packages/cross-base.scm (cross-binutils): Pass
  `--with-sysroot=/no-such-path'.
-rw-r--r--gnu/packages/cross-base.scm17
1 files changed, 15 insertions, 2 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 22878a20b0..5c46d00b20 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -44,8 +44,21 @@
         `(cons ,(string-append "--target=" target)
                ,flags))))))
 
-(define cross-binutils
-  (cut cross binutils <>))
+(define (cross-binutils target)
+  "Return a cross-Binutils for TARGET."
+  (let ((binutils (package (inherit binutils)
+                    (arguments
+                     (substitute-keyword-arguments (package-arguments
+                                                    binutils)
+                       ((#:configure-flags flags)
+                        ;; Build with `--with-sysroot' so that ld honors
+                        ;; DT_RUNPATH entries when searching for a needed
+                        ;; library.  This works because as a side effect
+                        ;; `genscripts.sh' sets `USE_LIBPATH=yes', which tells
+                        ;; elf32.em to use DT_RUNPATH in its search list.
+                        `(cons "--with-sysroot=/no-such-path"
+                               ,flags)))))))
+    (cross binutils target)))
 
 (define* (cross-gcc target
                     #:optional (xbinutils (cross-binutils target)) libc)