build from github source
by lampahome
I followed the http://libguestfs.org/guestfs-building.1.html to build
source.
git clone https://github.com/libguestfs/libguestfs
cd libguestfs
./autogen.sh
make
I installed the lib I didn't have it and everything is ok untill I enter
*make*
I got error message:
> CCLD libguestfs.la
> ar: `u' modifier ignored since `D' is the default (see `U')
> make[3]: Leaving directory '/home/pahome/git/libguestfs/lib'
> make[2]: Leaving directory '/home/pahome/git/libguestfs/lib'
> Making all in docs
> make[2]: Entering directory '/home/pahome/git/libguestfs/docs'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/home/pahome/git/libguestfs/docs'
> Making all in examples
> make[2]: Entering directory '/home/pahome/git/libguestfs/examples'
> CCLD create-disk
> ../lib/.libs/libguestfs.so: undefined reference to `yajl_tree_free'
> ../lib/.libs/libguestfs.so: undefined reference to `yajl_tree_parse'
> collect2: error: ld returned 1 exit status
> Makefile:1926: recipe for target 'create-disk' failed
> make[2]: *** [create-disk] Error 1
> make[2]: Leaving directory '/home/pahome/git/libguestfs/examples'
> Makefile:1975: recipe for target 'all-recursive' failed
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory '/home/pahome/git/libguestfs'
> Makefile:1884: recipe for target 'all'
why is *undefined reference to 'yajl_tree_parse'*, I already install it
from https://github.com/lloyd/yajl
7 years, 4 months
[PATCH] common/mlstdutils: Fix parallel builds of bytes.ml.
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
With OCaml < 4.02 when using the alternate Bytes module, this module
would be compiled twice during parallel builds, resulting in
occasional corruption. The reason for this is that the ocamldep file
mentions ‘bytes.cmo’ whereas the ‘$(OCAML_BYTES_COMPAT_ML)’ macro
expands to ‘../../common/mlstdutils/bytes.ml’. Make doesn't recognize
these as the same file.
Use an alternate way to specify this file to fix this.
---
common/mlstdutils/Makefile.am | 9 +++++++--
m4/guestfs_ocaml.m4 | 2 ++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/common/mlstdutils/Makefile.am b/common/mlstdutils/Makefile.am
index 968a03d..e569154 100644
--- a/common/mlstdutils/Makefile.am
+++ b/common/mlstdutils/Makefile.am
@@ -27,9 +27,14 @@ SOURCES_MLI = \
stringMap.mli \
stringSet.mli
-SOURCES_ML = \
+if HAVE_BYTES_COMPAT_ML
+SOURCES_ML = bytes.ml
+else
+SOURCES_ML =
+endif
+
+SOURCES_ML += \
guestfs_config.ml \
- $(OCAML_BYTES_COMPAT_ML) \
libdir.ml \
stringMap.ml \
stringSet.ml \
diff --git a/m4/guestfs_ocaml.m4 b/m4/guestfs_ocaml.m4
index a7334cd..d0f3349 100644
--- a/m4/guestfs_ocaml.m4
+++ b/m4/guestfs_ocaml.m4
@@ -123,6 +123,8 @@ EOF
])
AC_SUBST([OCAML_BYTES_COMPAT_CMO])
AC_SUBST([OCAML_BYTES_COMPAT_ML])
+AM_CONDITIONAL([HAVE_BYTES_COMPAT_ML],
+ [test "x$OCAML_BYTES_COMPAT_ML" != "x"])
dnl Flags we want to pass to every OCaml compiler call.
OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX-3"
--
1.8.3.1
7 years, 4 months
[PATCH] common/mlstdutils: Implement StringSet.
by Richard W.M. Jones
---
builder/sources.ml | 2 --
common/mlstdutils/Makefile.am | 4 ++-
common/mlstdutils/stringSet.ml | 19 ++++++++++++
common/mlstdutils/stringSet.mli | 46 ++++++++++++++++++++++++++++
dib/elements.ml | 2 --
sysprep/sysprep_operation_ca_certificates.ml | 1 -
sysprep/sysprep_operation_kerberos_data.ml | 1 -
sysprep/sysprep_operation_rpm_db.ml | 1 -
sysprep/sysprep_operation_user_account.ml | 2 --
v2v/create_libvirt_xml.ml | 2 --
10 files changed, 68 insertions(+), 12 deletions(-)
diff --git a/builder/sources.ml b/builder/sources.ml
index 4c9ea0fff..48687bb26 100644
--- a/builder/sources.ml
+++ b/builder/sources.ml
@@ -34,8 +34,6 @@ and source_format =
| FormatNative
| FormatSimpleStreams
-module StringSet = Set.Make (String)
-
let parse_conf file =
debug "trying to read %s" file;
let sections = Ini_reader.read_ini ~error_suffix:"[ignored]" file in
diff --git a/common/mlstdutils/Makefile.am b/common/mlstdutils/Makefile.am
index a6357bf6c..108adcc52 100644
--- a/common/mlstdutils/Makefile.am
+++ b/common/mlstdutils/Makefile.am
@@ -24,13 +24,15 @@ EXTRA_DIST = \
SOURCES_MLI = \
std_utils.mli \
- stringMap.mli
+ stringMap.mli \
+ stringSet.mli
SOURCES_ML = \
guestfs_config.ml \
$(OCAML_BYTES_COMPAT_ML) \
libdir.ml \
stringMap.ml \
+ stringSet.ml \
std_utils.ml
# We pretend that we're building a C library. automake handles the
diff --git a/common/mlstdutils/stringSet.ml b/common/mlstdutils/stringSet.ml
new file mode 100644
index 000000000..b63965705
--- /dev/null
+++ b/common/mlstdutils/stringSet.ml
@@ -0,0 +1,19 @@
+(* virt-v2v
+ * Copyright (C) 2009-2017 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+include Set.Make (String)
diff --git a/common/mlstdutils/stringSet.mli b/common/mlstdutils/stringSet.mli
new file mode 100644
index 000000000..e2889d86e
--- /dev/null
+++ b/common/mlstdutils/stringSet.mli
@@ -0,0 +1,46 @@
+(* virt-v2v
+ * Copyright (C) 2009-2017 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+type elt = String.t
+type t = Set.Make(String).t
+
+val empty : t
+val is_empty : t -> bool
+val mem : elt -> t -> bool
+val add : elt -> t -> t
+val singleton: elt -> t
+val remove: elt -> t -> t
+val union: t -> t -> t
+val inter: t -> t -> t
+val diff: t -> t -> t
+val compare: t -> t -> int
+val equal: t -> t -> bool
+val subset: t -> t -> bool
+val iter: (elt -> unit) -> t -> unit
+val map: (elt -> elt) -> t -> t
+val fold: (elt -> 'a -> 'a) -> t -> 'a -> 'a
+val for_all: (elt -> bool) -> t -> bool
+val exists: (elt -> bool) -> t -> bool
+val filter: (elt -> bool) -> t -> t
+val partition: (elt -> bool) -> t -> t * t
+val cardinal: t -> int
+val elements: t -> elt list
+val min_elt: t -> elt
+val max_elt: t -> elt
+val choose: t -> elt
+val split: elt -> t -> t * bool * t
diff --git a/dib/elements.ml b/dib/elements.ml
index d237eeb7f..6d668ea64 100644
--- a/dib/elements.ml
+++ b/dib/elements.ml
@@ -26,8 +26,6 @@ open Utils
open Printf
-module StringSet = Set.Make (String)
-
type element = {
directory : string;
hooks : hooks_map;
diff --git a/sysprep/sysprep_operation_ca_certificates.ml b/sysprep/sysprep_operation_ca_certificates.ml
index 1d85fda6c..e481cebf8 100644
--- a/sysprep/sysprep_operation_ca_certificates.ml
+++ b/sysprep/sysprep_operation_ca_certificates.ml
@@ -19,7 +19,6 @@
open Sysprep_operation
open Common_gettext.Gettext
-module StringSet = Set.Make (String)
module G = Guestfs
let ca_certificates_perform (g : Guestfs.guestfs) root side_effects =
diff --git a/sysprep/sysprep_operation_kerberos_data.ml b/sysprep/sysprep_operation_kerberos_data.ml
index 9dc794fd4..bee39f7ff 100644
--- a/sysprep/sysprep_operation_kerberos_data.ml
+++ b/sysprep/sysprep_operation_kerberos_data.ml
@@ -19,7 +19,6 @@
open Sysprep_operation
open Common_gettext.Gettext
-module StringSet = Set.Make (String)
module G = Guestfs
let kerberos_data_perform (g : Guestfs.guestfs) root side_effects =
diff --git a/sysprep/sysprep_operation_rpm_db.ml b/sysprep/sysprep_operation_rpm_db.ml
index 81190e0b8..be4740686 100644
--- a/sysprep/sysprep_operation_rpm_db.ml
+++ b/sysprep/sysprep_operation_rpm_db.ml
@@ -19,7 +19,6 @@
open Sysprep_operation
open Common_gettext.Gettext
-module StringSet = Set.Make (String)
module G = Guestfs
let rpm_db_perform (g : Guestfs.guestfs) root side_effects =
diff --git a/sysprep/sysprep_operation_user_account.ml b/sysprep/sysprep_operation_user_account.ml
index 2a633f5d8..3102a6267 100644
--- a/sysprep/sysprep_operation_user_account.ml
+++ b/sysprep/sysprep_operation_user_account.ml
@@ -28,8 +28,6 @@ open Sysprep_operation
module G = Guestfs
-module StringSet = Set.Make (String)
-
let remove_users = ref StringSet.empty
let keep_users = ref StringSet.empty
let add_users set users =
diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml
index f5dca2d57..1551e259c 100644
--- a/v2v/create_libvirt_xml.ml
+++ b/v2v/create_libvirt_xml.ml
@@ -27,8 +27,6 @@ open Types
open Utils
open DOM
-module StringSet = Set.Make (String)
-
let string_set_of_list =
List.fold_left (fun set x -> StringSet.add x set) StringSet.empty
--
2.13.2
7 years, 4 months
[PATCH v2] common/mlstdutils: Build a bytecode version of this library.
by Richard W.M. Jones
Even if ocamlopt is available, always build a bytecode version of
‘common/mlstdutils’.
Furthermore, because this library is pure OCaml, we should not be
using ‘ocamlmklib’. We should use ‘ocaml{c,opt} -a’ instead. This
doesn't make any difference for native code, but for bytecode it was
building a broken library.
The original reason for making this change is because the generator is
always built as bytecode, and it depended on
‘../common/mlstdutils/guestfs_config.cmo’ and
‘../common/mlstdutils/std_utils.cmo’. On native code platforms these
were not built before the generator and so the generator races to
build the .cmi and .cmo files. Since the generator doesn't have
correct dependencies covering the ‘common/mlstdutils’ directory you
can get a broken link on fast machines:
File "../common/mlstdutils/std_utils.ml", line 1:
Error: Corrupted compiled interface
../common/mlstdutils/guestfs_config.cmi
make[2]: *** [Makefile:1993: ../common/mlstdutils/std_utils.cmo] Error 2
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/builddir/build/BUILD/libguestfs-1.37.17/generator'
---
common/mlstdutils/Makefile.am | 11 ++++++++---
generator/Makefile.am | 9 ++++++---
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/common/mlstdutils/Makefile.am b/common/mlstdutils/Makefile.am
index 9e0b34d42..67441f769 100644
--- a/common/mlstdutils/Makefile.am
+++ b/common/mlstdutils/Makefile.am
@@ -48,7 +48,9 @@ else
MLSTDUTILS_CMA = mlstdutils.cmxa
endif
-noinst_DATA = $(MLSTDUTILS_CMA)
+# Just for this library, we need to build both bytecode and native
+# code because the generator always requires the bytecode version.
+noinst_DATA = mlstdutils.cma mlstdutils.cmxa
libmlstdutils_a_SOURCES = dummy.c
libmlstdutils_a_CPPFLAGS = \
@@ -79,8 +81,11 @@ endif
libmlstdutils_a_DEPENDENCIES = $(OBJECTS)
-$(MLSTDUTILS_CMA): $(OBJECTS)
- $(OCAMLFIND) mklib $(OCAMLPACKAGES) $(OBJECTS) -o mlstdutils
+mlstdutils.cma: $(BOBJECTS)
+ $(OCAMLFIND) ocamlc $(OCAMLPACKAGES) -a $^ -o $@
+
+mlstdutils.cmxa: $(XOBJECTS)
+ $(OCAMLFIND) ocamlopt $(OCAMLPACKAGES) -a $^ -o $@
# This OCaml module has to be generated by make (configure will put
# unexpanded prefix macro in).
diff --git a/generator/Makefile.am b/generator/Makefile.am
index 3f54ad51d..d4a21fe97 100644
--- a/generator/Makefile.am
+++ b/generator/Makefile.am
@@ -115,8 +115,6 @@ sources = \
# In build dependency order.
objects = \
$(OCAML_BYTES_COMPAT_CMO) \
- ../common/mlstdutils/guestfs_config.cmo \
- ../common/mlstdutils/std_utils.cmo \
types.cmo \
utils.cmo \
proc_nr.cmo \
@@ -180,7 +178,12 @@ noinst_PROGRAM = generator
if HAVE_OCAML
generator: $(objects)
- $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -linkpkg $^ -o $@
+# We need the recursive make here because the generator is
+# rebuilt in ‘make clean’.
+ $(MAKE) -C $(top_builddir)/common/mlstdutils mlstdutils.cma
+ $(OCAMLFIND) ocamlc $(OCAMLFLAGS) \
+ $(OCAMLPACKAGES) -linkpkg mlstdutils.cma \
+ $^ -o $@
# Dependencies.
depend: .depend
--
2.13.2
7 years, 4 months
[PATCH] common/mlutils: Remove bogus suffix parameter from Mkdtemp.temp_dir.
by Richard W.M. Jones
The C function mkdtemp(3) requires that the string ends with 6 'X'
characters, so appending a non-empty suffix causes the function to
raise EINVAL.
Luckily we only ever called this function with the last parameter "".
---
builder/builder.ml | 2 +-
builder/sigchecker.ml | 2 +-
common/mlutils/unix_utils.ml | 4 ++--
common/mlutils/unix_utils.mli | 4 ++--
dib/dib.ml | 2 +-
sysprep/sysprep_operation_script.ml | 2 +-
v2v/input_ova.ml | 2 +-
v2v/output_glance.ml | 2 +-
v2v/output_null.ml | 2 +-
v2v/output_rhv.ml | 2 +-
10 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/builder/builder.ml b/builder/builder.ml
index 0e02bab3b..3c1f04c77 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -181,7 +181,7 @@ let main () =
* temporary files that Downloader, Sigchecker, etc, are going
* create.
*)
- let tmpdir = Mkdtemp.temp_dir "virt-builder." "" in
+ let tmpdir = Mkdtemp.temp_dir "virt-builder." in
rmdir_on_exit tmpdir;
(* Download the sources. *)
diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml
index f72c21ab0..55e743940 100644
--- a/builder/sigchecker.ml
+++ b/builder/sigchecker.ml
@@ -92,7 +92,7 @@ let import_keyfile ~gpg ~gpghome ~tmpdir ?(trust = true) keyfile =
let rec create ~gpg ~gpgkey ~check_signature ~tmpdir =
(* Create a temporary directory for gnupg. *)
- let gpgtmpdir = Mkdtemp.temp_dir ~base_dir:tmpdir "vb.gpghome." "" in
+ let gpgtmpdir = Mkdtemp.temp_dir ~base_dir:tmpdir "vb.gpghome." in
(* Make sure we have no check_signature=true with no actual key. *)
let check_signature, gpgkey =
match check_signature, gpgkey with
diff --git a/common/mlutils/unix_utils.ml b/common/mlutils/unix_utils.ml
index 8ac36836c..b135bcaee 100644
--- a/common/mlutils/unix_utils.ml
+++ b/common/mlutils/unix_utils.ml
@@ -52,8 +52,8 @@ end
module Mkdtemp = struct
external mkdtemp : string -> string = "guestfs_int_mllib_mkdtemp"
- let temp_dir ?(base_dir = Filename.temp_dir_name) prefix suffix =
- mkdtemp (Filename.concat base_dir (prefix ^ "XXXXXX" ^ suffix))
+ let temp_dir ?(base_dir = Filename.temp_dir_name) prefix =
+ mkdtemp (Filename.concat base_dir (prefix ^ "XXXXXX"))
end
module Realpath = struct
diff --git a/common/mlutils/unix_utils.mli b/common/mlutils/unix_utils.mli
index 4795cb37f..f4f8ca578 100644
--- a/common/mlutils/unix_utils.mli
+++ b/common/mlutils/unix_utils.mli
@@ -80,8 +80,8 @@ module Mkdtemp : sig
val mkdtemp : string -> string
(** [mkdtemp pattern] Tiny wrapper to the C [mkdtemp]. *)
- val temp_dir : ?base_dir:string -> string -> string -> string
- (** [temp_dir prefix suffix] creates a new unique temporary directory.
+ val temp_dir : ?base_dir:string -> string -> string
+ (** [temp_dir prefix] creates a new unique temporary directory.
The optional [~base_dir:string] changes the base directory where
to create the new temporary directory; if not specified, the default
diff --git a/dib/dib.ml b/dib/dib.ml
index d083eed9f..e59ff94a8 100644
--- a/dib/dib.ml
+++ b/dib/dib.ml
@@ -548,7 +548,7 @@ let main () =
let image_basename = Filename.basename cmdline.image_name in
let image_basename_d = image_basename ^ ".d" in
- let tmpdir = Mkdtemp.temp_dir "dib." "" in
+ let tmpdir = Mkdtemp.temp_dir "dib." in
rmdir_on_exit tmpdir;
let auxtmpdir = tmpdir // "in_target.aux" in
do_mkdir auxtmpdir;
diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml
index cf911043a..62a4a2d02 100644
--- a/sysprep/sysprep_operation_script.ml
+++ b/sysprep/sysprep_operation_script.ml
@@ -46,7 +46,7 @@ let rec script_perform (g : Guestfs.guestfs) root side_effects =
match !scriptdir with
| Some dir -> dir, false
| None ->
- let tmpdir = Mkdtemp.temp_dir "virt-sysprep." "" in
+ let tmpdir = Mkdtemp.temp_dir "virt-sysprep." in
tmpdir, true in
(* Mount the directory locally. *)
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index e8be68ed7..9ec991ba7 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -128,7 +128,7 @@ let find_files dir ext =
class input_ova ova =
let tmpdir =
let base_dir = (open_guestfs ())#get_cachedir () in
- let t = Mkdtemp.temp_dir ~base_dir "ova." "" in
+ let t = Mkdtemp.temp_dir ~base_dir "ova." in
rmdir_on_exit t;
t in
object
diff --git a/v2v/output_glance.ml b/v2v/output_glance.ml
index e26bc0732..a9d267e28 100644
--- a/v2v/output_glance.ml
+++ b/v2v/output_glance.ml
@@ -34,7 +34,7 @@ class output_glance () =
*)
let tmpdir =
let base_dir = (open_guestfs ())#get_cachedir () in
- let t = Mkdtemp.temp_dir ~base_dir "glance." "" in
+ let t = Mkdtemp.temp_dir ~base_dir "glance." in
rmdir_on_exit t;
t in
object
diff --git a/v2v/output_null.ml b/v2v/output_null.ml
index 9b31c2d00..e2302fc47 100644
--- a/v2v/output_null.ml
+++ b/v2v/output_null.ml
@@ -33,7 +33,7 @@ class output_null =
*)
let tmpdir =
let base_dir = (open_guestfs ())#get_cachedir () in
- let t = Mkdtemp.temp_dir ~base_dir "null." "" in
+ let t = Mkdtemp.temp_dir ~base_dir "null." in
rmdir_on_exit t;
t in
object
diff --git a/v2v/output_rhv.ml b/v2v/output_rhv.ml
index 0c02df612..f1a193bde 100644
--- a/v2v/output_rhv.ml
+++ b/v2v/output_rhv.ml
@@ -40,7 +40,7 @@ let rec mount_and_check_storage_domain domain_class os =
(* Create a mountpoint. Default mode is too restrictive for us
* when we need to write into the directory as 36:36.
*)
- let mp = Mkdtemp.temp_dir "v2v." "" in
+ let mp = Mkdtemp.temp_dir "v2v." in
chmod mp 0o755;
(* Try mounting it. *)
--
2.13.2
7 years, 4 months