Fix build error

Signed-off-by: cherry530 <xuping33@huawei.com>
This commit is contained in:
cherry530 2022-01-24 12:34:12 +08:00
parent 73bd0ce91f
commit 7d800487af
3 changed files with 73 additions and 1 deletions

View File

@ -0,0 +1,28 @@
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
diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml
index 70156d1..3cacf36 100644
--- a/common/mlstdutils/std_utils.ml
+++ b/common/mlstdutils/std_utils.ml
@@ -305,7 +305,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

39
Fix-verbose-error.patch Normal file
View File

@ -0,0 +1,39 @@
From 1941593585574849dd72c458535cd80b4d858266 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 10 Dec 2021 10:20:34 +0000
Subject: [PATCH] Disable OCaml warning 6 completely
Warning 6 "labels-omitted" is not useful. It's fine to omit labels on
positional arguments.
Example:
File "perl_edit.ml", line 30, characters 2-13:
30 | c_edit_file (verbose ()) g (Guestfs.c_pointer g) file expr
^^^^^^^^^^^
Warning 6 [labels-omitted]: label verbose was omitted in the application of this function.
The function is specified as:
external c_edit_file : verbose:bool -> Guestfs.t -> int64 -> string -> string -> unit
The complaint is that the verbose: label has been omitted from the
first argument when the function is called, but IMO this is a
stylistic thing, not a bug.
(cherry picked from
guestfs-tools commit 577f7aee4b1c720f4c4826115b49a0c3870b149e)
diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4
index 3c504ce..5604574 100644
--- a/m4/guestfs-ocaml.m4
+++ b/m4/guestfs-ocaml.m4
@@ -222,7 +222,7 @@ AS_IF([test "x$have_Hivex_OPEN_UNSAFE" = "xno"],[
AC_SUBST([HIVEX_OPEN_UNSAFE_FLAG])
dnl Flags we want to pass to every OCaml compiler call.
-OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX+52-3"
+OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX+52-3 -w -6"
AC_SUBST([OCAML_WARN_ERROR])
OCAML_FLAGS="-g -annot $safe_string_option"
AC_SUBST([OCAML_FLAGS])

View File

@ -4,7 +4,7 @@
Name: libguestfs
Version: 1.40.2
Release: 15
Release: 16
Epoch: 1
Summary: A set of tools for accessing and modifying virtual machine (VM) disk images
License: LGPLv2+
@ -16,6 +16,8 @@ Patch0000: 0001-libguestfs-PYTHON_LIBS-is-not-set-in-Python-3.8.patch
Patch0001: 0002-fts-remove-NOSTAT_LEAF_OPTIMIZATION.patch
Patch0002: 0003-port-to-php-8.0.0.patch
Patch0003: fix-not-striped.patch
Patch0004: Fix-defaut-function-compare-error.patch
Patch0005: Fix-verbose-error.patch
BuildRequires: gcc-c++, rpcgen, libtirpc-devel, supermin-devel >= 5.1.18, hivex-devel >= 1.2.7-7, ocaml-hivex-devel, perl(Pod::Simple), perl(Pod::Man)
BuildRequires: /usr/bin/pod2text, po4a, augeas-devel >= 1.7.0, readline-devel, genisoimage, libxml2-devel, createrepo, glibc-static, libselinux-utils
@ -368,6 +370,9 @@ install -m 0644 utils/boot-benchmark/boot-benchmark.1 $RPM_BUILD_ROOT%{_mandir}/
%exclude %{_mandir}/man1/virt-tar.1*
%changelog
* Mon Jan 24 2022 xu_ping <xuping33@huawei.com> - 1:1.40.2-16
- Use actual function Pervasives.compare to instead of default compare and omit the labels on positional arguments.
* Thu Sep 09 2021 sunguoshuai <sunguoshuai@huawei.com> - 1:1.40.2-15
- Fix not striped in some binaries