Fixes for OCaml 4.12.

This commit is contained in:
Richard W.M. Jones 2021-03-02 10:47:48 +00:00
parent 0c9b3562af
commit 7e7de18823
3 changed files with 77 additions and 2 deletions

View File

@ -0,0 +1,35 @@
From 5f499208cf53ebd3f05525918c213a36c3ca13b5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 2 Mar 2021 10:42:49 +0000
Subject: [PATCH] builder: Don't redefine Val_none (OCaml 4.12).
CC virt_builder-setlocale-c.o
setlocale-c.c:38: error: "Val_none" redefined [-Werror]
38 | #define Val_none (Val_int (0))
|
In file included from /usr/lib64/ocaml/caml/alloc.h:24,
from setlocale-c.c:23:
/usr/lib64/ocaml/caml/mlvalues.h:395: note: this is the location of the previous definition
395 | #define Val_none Val_int(0)
|
---
builder/setlocale-c.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/builder/setlocale-c.c b/builder/setlocale-c.c
index 6d877e7ac..1834c11df 100644
--- a/builder/setlocale-c.c
+++ b/builder/setlocale-c.c
@@ -35,7 +35,9 @@ static const int lc_string_table[7] = {
LC_MESSAGES
};
+#ifndef Val_none
#define Val_none (Val_int (0))
+#endif
extern value virt_builder_setlocale (value val_category, value val_name);
--
2.29.0.rc2

View File

@ -0,0 +1,35 @@
From cc4ecbe236914f9b391ecf3815008547472632f8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 2 Mar 2021 10:39:15 +0000
Subject: [PATCH] mlstdutils/std_utils.ml: Fix for OCaml 4.12.
We were using a default function from somewhere called "compare"
instead of the actual function (Pervasives.compare / Stdlib.compare).
Since the wrong default function was used it had a different type from
what we expected:
File "std_utils.ml", line 312, characters 36-37:
312 | | (y, y') :: _ when cmp x y = 0 -> y'
^
Error: This expression has type int but an expression was expected of type
'weak1 list -> int
---
common/mlstdutils/std_utils.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml
index 4237ea519..88477179a 100644
--- a/common/mlstdutils/std_utils.ml
+++ b/common/mlstdutils/std_utils.ml
@@ -307,7 +307,7 @@ module List = struct
| x::xs, y::ys, z::zs -> (x, y, z) :: combine3 xs ys zs
| _ -> invalid_arg "combine3"
- let rec assoc_lbl ?(cmp = compare) ~default x = function
+ let rec assoc_lbl ?(cmp = Pervasives.compare) ~default x = function
| [] -> default
| (y, y') :: _ when cmp x y = 0 -> y'
| _ :: ys -> assoc_lbl ~cmp ~default x ys
--
2.29.0.rc2

View File

@ -56,7 +56,7 @@ Summary: Access and modify virtual machine disk images
Name: libguestfs
Epoch: 1
Version: 1.44.0
Release: 7%{?dist}
Release: 8%{?dist}
License: LGPLv2+
# Build only for architectures that have a kernel
@ -89,6 +89,10 @@ Source8: copy-patches.sh
# Upstream patch to use -cpu max.
Patch1: 0001-appliance-Use-cpu-max.patch
# Upstream patches for OCaml 4.12.
Patch2: 0001-builder-Don-t-redefine-Val_none-OCaml-4.12.patch
Patch3: 0001-mlstdutils-std_utils.ml-Fix-for-OCaml-4.12.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool, gettext-devel
%endif
@ -1309,8 +1313,9 @@ rm ocaml/html/.gitignore
%changelog
* Tue Mar 2 10:06:30 GMT 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.44.0-7
* Tue Mar 2 10:06:30 GMT 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.44.0-8
- OCaml 4.12.0 build
- Fixes for OCaml 4.12.
* Wed Feb 17 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.44.0-6
- Remove jfsutils (dead upstream since 2011).