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.
This commit is contained in:
Ludovic Courtès 2017-12-20 22:21:16 +01:00
parent 614fffe427
commit 066ccc2c69
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -80,8 +80,8 @@ (define-public gcc-4.7
(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 @@ (define-public gcc-5
"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)))))