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
1 changed files with 15 additions and 3 deletions

View File

@ -80,8 +80,8 @@ where the OS part is overloaded to denote a specific ABI---into GCC
(map (lambda (var tool) (map (lambda (var tool)
(string-append (string-append var "_FOR_TARGET") (string-append (string-append var "_FOR_TARGET")
"=" target "-" tool)) "=" target "-" tool))
'("CC" "CXX" "LD" "AR" "NM" "RANLIB" "STRIP") '("CC" "CXX" "LD" "AR" "NM" "OBJDUMP" "RANLIB" "STRIP")
'("gcc" "g++" "ld" "ar" "nm" "ranlib" "strip")) '("gcc" "g++" "ld" "ar" "nm" "objdump" "ranlib" "strip"))
'())))) '()))))
(libdir (libdir
(let ((base '(or (assoc-ref outputs "lib") (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.0-libvtv-runpath.patch"
"gcc-5-source-date-epoch-1.patch" "gcc-5-source-date-epoch-1.patch"
"gcc-5-source-date-epoch-2.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 (inputs
`(("isl" ,isl) `(("isl" ,isl)
,@(package-inputs gcc-4.7))))) ,@(package-inputs gcc-4.7)))))