summary refs log tree commit diff
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>2019-09-24 20:23:31 +0200
committerJan Nieuwenhuizen <janneke@gnu.org>2019-09-27 06:42:47 +0200
commit308eb5c11a885768f81fb6136fd4d30b4639fe04 (patch)
tree3ee1c8f6923a2b83a45d9511c7750a54d089d2f2
parentfc16ef9d906f356cd63e3fc8b14e505568978b32 (diff)
downloadguix-308eb5c11a885768f81fb6136fd4d30b4639fe04.tar.gz
gnu: gcc: Fix mingw cross compiler.
* gnu/packages/patches/gcc-7-cross-mingw.patch: New file.
* gnu/packages/cross-base.scm (cross-gcc-patches): Add XGCC parameter; update
caller.  Use it for target mingw and gcc >= 7.
* gnu/local.mk (dist_patch_DATA): Add it.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/cross-base.scm13
-rw-r--r--gnu/packages/patches/gcc-7-cross-mingw.patch24
3 files changed, 33 insertions, 5 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 2fcd2648ed..e37c24a7ca 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -853,6 +853,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-6-cross-environment-variables.patch	\
   %D%/packages/patches/gcc-6-source-date-epoch-1.patch		\
   %D%/packages/patches/gcc-6-source-date-epoch-2.patch		\
+  %D%/packages/patches/gcc-7-cross-mingw.patch			\
   %D%/packages/patches/gcc-8-cross-environment-variables.patch	\
   %D%/packages/patches/gcc-8-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-9-asan-fix-limits-include.patch	\
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 78dae7431a..7108000f06 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2016, 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
@@ -190,13 +190,16 @@ base compiler and using LIBC (which may be either a libc package or #f.)"
                               '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH")))
                   #t))))))))))
 
-(define (cross-gcc-patches target)
-  "Return GCC patches needed for TARGET."
+(define (cross-gcc-patches xgcc target)
+  "Return GCC patches needed for XGCC and TARGET."
   (cond ((string-prefix? "xtensa-" target)
          ;; Patch by Qualcomm needed to build the ath9k-htc firmware.
          (search-patches "ath9k-htc-firmware-gcc.patch"))
         ((target-mingw? target)
-         (search-patches "gcc-4.9.3-mingw-gthr-default.patch"))
+         (append (search-patches "gcc-4.9.3-mingw-gthr-default.patch")
+                 (if (version>=? (package-version xgcc) "7.0")
+                     (search-patches "gcc-7-cross-mingw.patch")
+                    '())))
         (else '())))
 
 (define (cross-gcc-snippet target)
@@ -229,7 +232,7 @@ target that libc."
                        ((version>=? (package-version xgcc) "8.0") (search-patch "gcc-8-cross-environment-variables.patch"))
                        ((version>=? (package-version xgcc) "6.0") (search-patch "gcc-6-cross-environment-variables.patch"))
                        (else  (search-patch "gcc-cross-environment-variables.patch")))
-                      (cross-gcc-patches target))))
+                      (cross-gcc-patches xgcc target))))
               (modules '((guix build utils)))
               (snippet
                (cross-gcc-snippet target))))
diff --git a/gnu/packages/patches/gcc-7-cross-mingw.patch b/gnu/packages/patches/gcc-7-cross-mingw.patch
new file mode 100644
index 0000000000..eec6f88953
--- /dev/null
+++ b/gnu/packages/patches/gcc-7-cross-mingw.patch
@@ -0,0 +1,24 @@
+This fixes
+
+../../../../gcc-7.4.0/libstdc++-v3/libsupc++/new_opa.cc: In function ‘void* __gnu_cxx::aligned_alloc(std::size_t, std::size_t)’:
+../../../../gcc-7.4.0/libstdc++-v3/libsupc++/new_opa.cc:78:10: error: ‘memalign’ was not declared in this scope
+   return memalign (al, sz);
+          ^~~~~~~~
+../../../../gcc-7.4.0/libstdc++-v3/libsupc++/new_opa.cc:78:10: note: suggested alternative: ‘max_align_t’
+   return memalign (al, sz);
+          ^~~~~~~~
+          max_align_t
+
+diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc
+index 94e79cadb0e..084900e0daf 100644
+--- a/libstdc++-v3/libsupc++/new_opa.cc
++++ b/libstdc++-v3/libsupc++/new_opa.cc
+@@ -39,6 +39,8 @@ extern "C" void *memalign(std::size_t boundary, std::size_t size);
+ # endif
+ #endif
+ 
++#define memalign _aligned_malloc
++
+ using std::new_handler;
+ using std::bad_alloc;
+