summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Wang <joequant@gmail.com>2020-09-01 11:53:13 +0800
committerGitHub <noreply@github.com>2020-09-01 05:53:13 +0200
commitebeb8fb8df1655ebeccb7976093c6833a8b4add4 (patch)
treeec3530be14ee1ff445aac55e1e2f7b7ee8fca636
parent1c67a304c8c073a497065f647da0e22ce833049b (diff)
downloadspack-ebeb8fb8df1655ebeccb7976093c6833a8b4add4.tar.gz
spack-ebeb8fb8df1655ebeccb7976093c6833a8b4add4.tar.bz2
spack-ebeb8fb8df1655ebeccb7976093c6833a8b4add4.tar.xz
spack-ebeb8fb8df1655ebeccb7976093c6833a8b4add4.zip
ocaml: allow v4.08 and v4.09 to build with gcc10 (#18254)
fixes #18228. This patch doesn't cover all old versions but it allows packages like whizard to build.
-rwxr-xr-xvar/spack/repos/builtin/packages/ocaml/fix-duplicate-defs.patch41
-rw-r--r--var/spack/repos/builtin/packages/ocaml/package.py1
2 files changed, 42 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/ocaml/fix-duplicate-defs.patch b/var/spack/repos/builtin/packages/ocaml/fix-duplicate-defs.patch
new file mode 100755
index 0000000000..bbbc283d6a
--- /dev/null
+++ b/var/spack/repos/builtin/packages/ocaml/fix-duplicate-defs.patch
@@ -0,0 +1,41 @@
+From: Xavier Leroy <xavier.leroy@college-de-france.fr>
+Date: Thu, 12 Dec 2019 16:41:17 +0100
+Subject: Avoid duplicate definitions of "common" global variables
+
+The variables are caml_debug_info and caml_atom_table.
+The multiple definitions look like a cut-and-paste error.
+They cause problems with C compilers that don't follow the "common" model.
+
+Bug: https://github.com/ocaml/ocaml/issues/9144
+Bug-Debian: https://bugs.debian.org/957623
+---
+ runtime/backtrace.c | 3 ---
+ runtime/startup_nat.c | 1 -
+ 2 files changed, 4 deletions(-)
+
+diff --git a/runtime/backtrace.c b/runtime/backtrace.c
+index a3c2c08..ddf7af1 100644
+--- a/runtime/backtrace.c
++++ b/runtime/backtrace.c
+@@ -27,9 +27,6 @@
+ #include "caml/backtrace_prim.h"
+ #include "caml/fail.h"
+
+-/* The table of debug information fragments */
+-struct ext_table caml_debug_info;
+-
+ CAMLexport int32_t caml_backtrace_active = 0;
+ CAMLexport int32_t caml_backtrace_pos = 0;
+ CAMLexport backtrace_slot * caml_backtrace_buffer = NULL;
+diff --git a/runtime/startup_nat.c b/runtime/startup_nat.c
+index 43b85e3..5b20036 100644
+--- a/runtime/startup_nat.c
++++ b/runtime/startup_nat.c
+@@ -44,7 +44,6 @@
+ #endif
+
+ extern int caml_parser_trace;
+-CAMLexport header_t caml_atom_table[256];
+ char * caml_code_area_start, * caml_code_area_end;
+ struct ext_table caml_code_fragments_table;
+
diff --git a/var/spack/repos/builtin/packages/ocaml/package.py b/var/spack/repos/builtin/packages/ocaml/package.py
index 66b2dc41e5..fba0a18051 100644
--- a/var/spack/repos/builtin/packages/ocaml/package.py
+++ b/var/spack/repos/builtin/packages/ocaml/package.py
@@ -25,6 +25,7 @@ class Ocaml(Package):
version('4.06.0', sha256='c17578e243c4b889fe53a104d8927eb8749c7be2e6b622db8b3c7b386723bf50')
version('4.03.0', sha256='7fdf280cc6c0a2de4fc9891d0bf4633ea417046ece619f011fd44540fcfc8da2')
+ patch('fix-duplicate-defs.patch', when="@4.08.0:4.09.0 %gcc@10.0:")
depends_on('ncurses')
sanity_check_file = ['bin/ocaml']