From f05bdc9412135f34a1c417edc203c35cd005d0d5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Dec 2014 23:46:59 +0100 Subject: gnu: Don't use --strip-all in cases where this is problematic. This is a followup to 856ae5e. See for an example of build failure. * guix/build/gnu-build-system.scm (strip): Add #:archive-strip-flags parameter. Use it when (ar-file? path). * guix/build-system/gnu.scm (gnu-build): Add #:archive-strip-flags parameter and pass it down. * gnu/packages/commencement.scm (gcc-boot0)[arguments]: Add #:strip-flags. * gnu/packages/base.scm (glibc)[arguments]: Likewise. --- guix/build-system/gnu.scm | 2 ++ guix/build/gnu-build-system.scm | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index f765a144c4..e2b41b1898 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -275,6 +275,7 @@ (define* (gnu-build store name input-drvs (patch-shebangs? #t) (strip-binaries? #t) (strip-flags ''("--strip-all")) + (archive-strip-flags ''("--strip-debug")) (strip-directories ''("lib" "lib64" "libexec" "bin" "sbin")) (phases '%standard-phases) @@ -338,6 +339,7 @@ (define builder #:patch-shebangs? ,patch-shebangs? #:strip-binaries? ,strip-binaries? #:strip-flags ,strip-flags + #:archive-strip-flags ,archive-strip-flags #:strip-directories ,strip-directories))) (define guile-for-build diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 11b43c521f..a985b1c715 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -298,6 +298,12 @@ (define* (strip #:key target outputs (strip-binaries? #t) (string-append target "-objcopy") "objcopy")) (strip-flags '("--strip-all")) + + ;; Using '--strip-all' on .a file would remove the archive + ;; index, leading to "Archive has no index" errors when + ;; linking against them. + (archive-strip-flags '("--strip-debug")) + (strip-directories '("lib" "lib64" "libexec" "bin" "sbin")) #:allow-other-keys) @@ -353,7 +359,10 @@ (define (strip-dir dir) (or (not debug-output) (make-debug-file path)) (zero? (apply system* strip-command - (append strip-flags (list path)))) + (append (if (ar-file? path) + archive-strip-flags + strip-flags) + (list path)))) (or (not debug-output) (add-debug-link path)))) (const #t) ; down -- cgit v1.2.3