From 066ccc2c69390f630237eadac1f69c03df22b87a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 20 Dec 2017 22:21:16 +0100 Subject: [PATCH] gnu: gcc: Fix cross-compilation. Previously "guix build gcc@5 --target=TRIPLET" would fail like this: checking for exported symbols... /tmp/guix-build-gcc-5.5.0.drv-0/gcc-5.5.0/libcc1/configure: line 14531: -T: command not found yes checking for -rdynamic... /tmp/guix-build-gcc-5.5.0.drv-0/gcc-5.5.0/libcc1/configure: line 14541: -T: command not found no checking for library containing dlopen... -ldl checking for -fPIC -shared... yes configure: error: Building GCC with plugin support requires a host that supports -fPIC, -shared, -ldl and -rdynamic. * gnu/packages/gcc.scm (gcc-4.7)[maybe-target-tools]: Add "OBJDUMP". (gcc-5)[source](snippet, modules): New fields. --- gnu/packages/gcc.scm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 84d2f9a8d2..7f4cf8ab69 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -80,8 +80,8 @@ where the OS part is overloaded to denote a specific ABI---into GCC (map (lambda (var tool) (string-append (string-append var "_FOR_TARGET") "=" target "-" tool)) - '("CC" "CXX" "LD" "AR" "NM" "RANLIB" "STRIP") - '("gcc" "g++" "ld" "ar" "nm" "ranlib" "strip")) + '("CC" "CXX" "LD" "AR" "NM" "OBJDUMP" "RANLIB" "STRIP") + '("gcc" "g++" "ld" "ar" "nm" "objdump" "ranlib" "strip")) '())))) (libdir (let ((base '(or (assoc-ref outputs "lib") @@ -396,7 +396,19 @@ Go. It also includes runtime support libraries for these languages.") "gcc-5.0-libvtv-runpath.patch" "gcc-5-source-date-epoch-1.patch" "gcc-5-source-date-epoch-2.patch" - "gcc-fix-texi2pod.patch")))) + "gcc-fix-texi2pod.patch")) + (modules '((guix build utils))) + (snippet + ;; Fix 'libcc1/configure' error when cross-compiling GCC. + ;; Without that, 'libcc1/configure' wrongfully determines that + ;; '-rdynamic' support is missing because $gcc_cv_objdump is + ;; empty: + ;; + ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67590 + ;; http://cgit.openembedded.org/openembedded-core/commit/?id=f6e47aa9b12f9ab61530c40e0343f451699d9077 + '(substitute* "libcc1/configure" + (("\\$gcc_cv_objdump -T") + "$OBJDUMP_FOR_TARGET -T"))))) (inputs `(("isl" ,isl) ,@(package-inputs gcc-4.7)))))