Skip to contentSkip to conversation

ocaml build error

DISCUSSION Ian Jackson 4 participants 10 messages May 6, 2010 – May 7, 2010

lore
Share & tools
lore
#0 lore raw

On Debian lenny I run "make -j4 xen tools" and I get the message below.

I'm going to disable my ocaml build for now, but this needs to be fixed if for no other reason than that I'm working on a huge patch which makes a non-compatible interface change to libxc, and which will break the ocaml build completely if I can't include the adjustements to it in my patch submission.

Ian.

make[3]: Entering directory `/u/iwj/work/2/xen-unstable.git/tools/ocaml'
=== building libs/uuid
=== building libs/mmap
=== building libs/log
=== building libs/xc
MLDEP
MLDEP
MLDEP
MLI mmap.cmi
MLDEP

 CC       mmap_stubs.o
 MLOPT    mmap.cmx
 MLC      mmap.cmo
 MKLIB    libmmap_stubs.a
 MLA      mmap.cma
 MLI      log.cmi
 MLI      xc.cmi
 MLI      uuid.cmi

File "xc.mli", line 79, characters 66-75:
Unbound type constructor Uuid.t
make[4]: *** [xc.cmi] Error 2
make[3]: *** [libs/xc] Error 2
make[3]: *** Waiting for unfinished jobs....

 MLA      mmap.cmxa
 MLC      uuid.cmo
 MLI      syslog.cmi
 CC       syslog_stubs.o
 MLOPT    uuid.cmx
 MLA      uuid.cma
syslog_stubs.c:28: warning: '__syslog_options_table' defined but not used
 MLI      logs.cmi
 MLC      syslog.cmo
 MLC      log.cmo
 MLC      logs.cmo

MKLIB libsyslog_stubs.a
MLA uuid.cmxa
MLOPT syslog.cmx
MLA log.cma
MLOPT log.cmx
MLOPT logs.cmx
MLA log.cmxa
make[3]: Leaving directory `/u/iwj/work/2/xen-unstable.git/tools/ocaml' make[2]: *** [subdir-install-ocaml] Error 2
make[2]: Leaving directory `/u/iwj/work/2/xen-unstable.git/tools' make[1]: *** [subdirs-install] Error 2
make[1]: Leaving directory `/u/iwj/work/2/xen-unstable.git/tools'
make: *** [install-tools] Error 2

#1 lore raw
Quoted 8 lines · I wrote:

On Debian lenny I run "make -j4 xen tools" and I get the message below.

I'm going to disable my ocaml build for now, but this needs to be fixed if for no other reason than that I'm working on a huge patch which makes a non-compatible interface change to libxc, and which will break the ocaml build completely if I can't include the adjustements to it in my patch submission.

In fact on a closer inspection this turns out to be a parallel make error. The author of the Makefile hadn't realised that if you mention multiple things as a dependency, make may process them in any order.

The patch below fixes this. However, the ocam build is still broken:

In file included from xc_lib.c:30:
xc.h:19:21: error: xen/xen.h: No such file or directory xc.h:20:24: error: xen/memory.h: No such file or directory xc.h:21:24: error: xen/sysctl.h: No such file or directory xc.h:22:24: error: xen/domctl.h: No such file or directory xc.h:23:23: error: xen/sched.h: No such file or directory xc.h:26:31: error: xen/linux/privcmd.h: No such file or directory xc.h:30:25: error: xen/version.h: No such file or directory xc.h:31:32: error: xen/foreign/x86_32.h: No such file or directory xc.h:32:32: error: xen/foreign/x86_64.h: No such file or directory xc.h:33:28: error: xen/hvm/params.h: No such file or directory In file included from xc.h:34,

                 from xc_lib.c:30:

xc_e820.h:4:26: error: xen/hvm/e820.h: No such file or directory

etc.

tools/ocaml/Makefile +9 -7
index 73c2988..ecd54b7 100644
@@ -13,21 +13,23 @@ SUBDIRS = $(SUBDIRS_LIBS) $(SUBDIRS_PROGRAMS)
 .PHONY: all
 all: build
 
-.PHONY: build $(SUBDIRS)
-build: $(SUBDIRS)
+.PHONY: build SUBDIRS
+build: SUBDIRS
 
-$(SUBDIRS):
-	@echo " === building $@"
-	@$(MAKE) --no-print-directory -C $@
+SUBDIRS SUBDIRS_PROGRAMS SUBDIRS_LIBS:
+	@set -e; for d in $($@); do			\
+		echo " === building $$d";		\
+		$(MAKE) --no-print-directory -C $$d;	\
+	done
 
 .PHONY: install install-libs install-program
 install: install-libs install-program
 
-install-program: $(SUBDIRS_PROGRAMS)
+install-program: SUBDIRS_PROGRAMS
 	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
 	$(INSTALL_PROG) xenstored/oxenstored $(DESTDIR)$(SBINDIR)
 
-install-libs: $(SUBDIRS_LIBS)
+install-libs: SUBDIRS_LIBS
 
 .PHONY: clean
 clean:
#2 lore raw
In reply to Ian Jackson
Quoted 8 lines · Ian Jackson

On Debian lenny I run "make -j4 xen tools" and I get the message below.

I'm going to disable my ocaml build for now, but this needs to be fixed if for no other reason than that I'm working on a huge patch which makes a non-compatible interface change to libxc, and which will break the ocaml build completely if I can't include the adjustements to it in my patch submission.

Wow, you have ocaml toolchain installed? :-)

K.

Quoted 54 lines

Ian.

make[3]: Entering directory `/u/iwj/work/2/xen-unstable.git/tools/ocaml'
=== building libs/uuid
=== building libs/mmap
=== building libs/log
=== building libs/xc
MLDEP
MLDEP
MLDEP
MLI mmap.cmi
MLDEP

 CC       mmap_stubs.o
 MLOPT    mmap.cmx
 MLC      mmap.cmo
 MKLIB    libmmap_stubs.a
 MLA      mmap.cma
 MLI      log.cmi
 MLI      xc.cmi
 MLI      uuid.cmi

File "xc.mli", line 79, characters 66-75:
Unbound type constructor Uuid.t
make[4]: *** [xc.cmi] Error 2
make[3]: *** [libs/xc] Error 2
make[3]: *** Waiting for unfinished jobs....

 MLA      mmap.cmxa
 MLC      uuid.cmo
 MLI      syslog.cmi
 CC       syslog_stubs.o
 MLOPT    uuid.cmx
 MLA      uuid.cma
syslog_stubs.c:28: warning: '__syslog_options_table' defined but not used
 MLI      logs.cmi
 MLC      syslog.cmo
 MLC      log.cmo
 MLC      logs.cmo

MKLIB libsyslog_stubs.a
MLA uuid.cmxa
MLOPT syslog.cmx
MLA log.cma
MLOPT log.cmx
MLOPT logs.cmx
MLA log.cmxa
make[3]: Leaving directory `/u/iwj/work/2/xen-unstable.git/tools/ocaml' make[2]: *** [subdir-install-ocaml] Error 2
make[2]: Leaving directory `/u/iwj/work/2/xen-unstable.git/tools' make[1]: *** [subdirs-install] Error 2
make[1]: Leaving directory `/u/iwj/work/2/xen-unstable.git/tools'
make: *** [install-tools] Error 2

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

Keir Fraser writes ("Re: [Xen-devel] ocaml build error"):

Quoted 8 lines · Ian Jackson
Quoted 5 lines

I'm going to disable my ocaml build for now, but this needs to be fixed if for no other reason than that I'm working on a huge patch which makes a non-compatible interface change to libxc, and which will break the ocaml build completely if I can't include the adjustements to it in my patch submission.

Wow, you have ocaml toolchain installed? :-)

Apparently so :-). Tempting to remove it, but I'll wait to see if the ocaml tool build can be fixed, first ...

Ian.

#4 lore raw
Quoted 8 lines · Ian Jackson

Keir Fraser writes ("Re: [Xen-devel] ocaml build error"):

Quoted 7 lines · Ian Jackson
Quoted 5 lines

I'm going to disable my ocaml build for now, but this needs to be fixed if for no other reason than that I'm working on a huge patch which makes a non-compatible interface change to libxc, and which will break the ocaml build completely if I can't include the adjustements to it in my patch submission.

Quoted 4 lines
Quoted 1 line

Wow, you have ocaml toolchain installed? :-)

Apparently so :-). Tempting to remove it, but I'll wait to see if the ocaml tool build can be fixed, first ...

If the build doesn't get fixed then the corrcet thing to do will be to disable build of the ocaml components by default.

-- Keir

#5 lore raw
Quoted 2 lines · Keir Fraser

If the build doesn't get fixed then the corrcet thing to do will be to disable build of the ocaml components by default.

It's stale build instructions that happens to still work for me since i've got some env set for all my old repos. the following patch fix it.

Signature · 1 line
Vincent
tools/ocaml/common.make +1 -3
index 3b14dfb..5f3579a 100644
@@ -8,9 +8,7 @@ OCAMLYACC ?= ocamlyacc
 
 CFLAGS ?= -Wall -fPIC -O2
 
-XEN_ROOT ?= $(TOPLEVEL)/../xen-unstable.hg
-XEN_DIST_ROOT ?= $(XEN_ROOT)/dist/install
-CFLAGS += -I$(XEN_DIST_ROOT)/usr/include
+CFLAGS += -I$(TOPLEVEL)/../include -I$(TOPLEVEL)/../libxc
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw
Quoted 8 lines · Vincent Hanquez
Quoted 2 lines · Keir Fraser

If the build doesn't get fixed then the corrcet thing to do will be to disable build of the ocaml components by default.

It's stale build instructions that happens to still work for me since i've got some env set for all my old repos. the following patch fix it.

It looks like Fedora 12 packages ocaml oddly, and its headers are under /usr/lib64/ocaml/, so I had to add:

tools/ocaml/common.make +1 -1
diff -r faf9bd66bf45 tools/ocaml/common.make
@@ -8,7 +8,7 @@
 
 CFLAGS ?= -Wall -fPIC -O2
 
-CFLAGS += -I$(TOPLEVEL)/../include -I$(TOPLEVEL)/../libxc
+CFLAGS += -I$(TOPLEVEL)/../include -I$(TOPLEVEL)/../libxc -I/usr/lib64/ocaml -I/usr/lib/ocaml
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F

But even then it fails later on with:

=== building xenstored
MLI symbol.cmi
make[4]: *** No rule to make target trie.cmi', needed by all'. Stop. make[3]: *** [xenstored] Error 2
make[3]: Leaving directory `/home/jeremy/hg/xen/unstable/tools/ocaml' make[2]: *** [subdir-install-ocaml] Error 2
make[2]: Leaving directory `/home/jeremy/hg/xen/unstable/tools' make[1]: *** [subdirs-install] Error 2
make[1]: Leaving directory `/home/jeremy/hg/xen/unstable/tools'
make: *** [install-tools] Error 2

Forgot to add file?

J

#7 lore raw
Quoted 2 lines · Jeremy Fitzhardinge

It looks like Fedora 12 packages ocaml oddly, and its headers are under /usr/lib64/ocaml/, so I had to add:

The patch is correct; it's again my specific build environment (debian+tweaks) that happens to play tricks.

Quoted 28 lines

diff -r faf9bd66bf45 tools/ocaml/common.make

tools/ocaml/common.make +1 -1
@@ -8,7 +8,7 @@
 
  CFLAGS ?= -Wall -fPIC -O2
 
-CFLAGS += -I$(TOPLEVEL)/../include -I$(TOPLEVEL)/../libxc
+CFLAGS += -I$(TOPLEVEL)/../include -I$(TOPLEVEL)/../libxc -I/usr/lib64/ocaml -I/usr/lib/ocaml
 
  OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
  OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F

But even then it fails later on with:

=== building xenstored
MLI symbol.cmi
make[4]: *** No rule to make target trie.cmi', needed by all'. Stop. make[3]: *** [xenstored] Error 2
make[3]: Leaving directory `/home/jeremy/hg/xen/unstable/tools/ocaml' make[2]: *** [subdir-install-ocaml] Error 2
make[2]: Leaving directory `/home/jeremy/hg/xen/unstable/tools' make[1]: *** [subdirs-install] Error 2
make[1]: Leaving directory `/home/jeremy/hg/xen/unstable/tools'
make: *** [install-tools] Error 2

Quoted 1 line

Forgot to add file?

gah yes; 3 files were missing. they got lost when i remove the stdext dependencies and move only the necessary files in to reduce the patchset size.

adding another patch for Keir.

Signature · 1 line
Vincent

commit b5015f5111b9c1b9beabf176b810a19cc62240ce

Author: Vincent Hanquez <[email protected]>
Date:   Fri May 7 07:36:39 2010 +0100

add missing files that got lost in the v2 shuffle

tools/ocaml/xenstored/stdext.ml new file +130 -0
new file mode 100644
index 0000000..b8a8fd0
@@ -0,0 +1,130 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008-2010 Citrix Ltd.
+ * Author Vincent Hanquez <[email protected]>
+ * Author Dave Scott <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * 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 Lesser General Public License for more details.
+ *)
+
+type ('a, 'b) either = Right of 'a | Left of 'b
+
+(** apply the clean_f function after fct function has been called.
+ * Even if fct raises an exception, clean_f is applied
+ *)
+let exnhook = ref None 
+
+let finally fct clean_f =
+	let result = try
+		fct ();
+	with
+		exn ->
+		  (match !exnhook with None -> () | Some f -> f exn);
+		  clean_f (); raise exn in
+	clean_f ();
+	result
+
+(** if v is not none, apply f on it and return some value else return none. *)
+let may f v =
+	match v with Some x -> Some (f x) | None -> None
+
+(** default value to d if v is none. *) 
+let default d v =
+	match v with Some x -> x | None -> d
+
+(** apply f on v if not none *)
+let maybe f v =
+	match v with None -> () | Some x -> f x
+
+module String = struct include String
+
+let of_char c = String.make 1 c
+
+let rec split ?limit:(limit=(-1)) c s =
+	let i = try String.index s c with Not_found -> -1 in
+	let nlimit = if limit = -1 || limit = 0 then limit else limit - 1 in
+	if i = -1 || nlimit = 0 then
+		[ s ]
+	else
+		let a = String.sub s 0 i
+		and b = String.sub s (i + 1) (String.length s - i - 1) in
+		a :: (split ~limit: nlimit c b)
+
+let fold_left f accu string =
+	let accu = ref accu in
+	for i = 0 to length string - 1 do
+		accu := f !accu string.[i]
+	done;
+	!accu
+
+(** True if string 'x' starts with prefix 'prefix' *)
+let startswith prefix x =
+	let x_l = String.length x and prefix_l = String.length prefix in
+	prefix_l <= x_l && String.sub x 0 prefix_l  = prefix
+end
+
+module Unixext = struct
+
+(** remove a file, but doesn't raise an exception if the file is already removed *)
+let unlink_safe file =
+	try Unix.unlink file with (* Unix.Unix_error (Unix.ENOENT, _ , _)*) _ -> ()
+
+(** create a directory but doesn't raise an exception if the directory already exist *)
+let mkdir_safe dir perm =
+	try Unix.mkdir dir perm with Unix.Unix_error (Unix.EEXIST, _, _) -> ()
+
+(** create a directory, and create parent if doesn't exist *)
+let mkdir_rec dir perm =
+	let rec p_mkdir dir =
+		let p_name = Filename.dirname dir in
+		if p_name <> "/" && p_name <> "." 
+		then p_mkdir p_name;
+		mkdir_safe dir perm in
+	p_mkdir dir
+
+(** daemonize a process *)
+(* !! Must call this before spawning any threads !! *)
+let daemonize () =
+	match Unix.fork () with
+	| 0 ->
+		if Unix.setsid () == -1 then
+			failwith "Unix.setsid failed";
+
+		begin match Unix.fork () with
+		| 0 ->
+			let nullfd = Unix.openfile "/dev/null" [ Unix.O_WRONLY ] 0 in
+			begin try
+				Unix.close Unix.stdin;
+				Unix.dup2 nullfd Unix.stdout;
+				Unix.dup2 nullfd Unix.stderr;
+			with exn -> Unix.close nullfd; raise exn
+			end;
+			Unix.close nullfd
+		| _ -> exit 0
+		end
+	| _ -> exit 0
+
+(** write a pidfile file *)
+let pidfile_write filename =
+	let fd = Unix.openfile filename
+	                       [ Unix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; ]
+			       0o640 in
+	finally
+	(fun () ->
+		let pid = Unix.getpid () in
+		let buf = string_of_int pid ^ "\n" in
+		let len = String.length buf in
+		if Unix.write fd buf 0 len <> len 
+		then failwith "pidfile_write failed";
+	)
+	(fun () -> Unix.close fd)
+
+end
tools/ocaml/xenstored/trie.ml new file +182 -0

182 lines not on this page · raw message

tools/ocaml/xenstored/trie.mli new file +60 -0

60 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw

Vincent Hanquez writes ("Re: [Xen-devel] ocaml build error"):

Quoted 1 line

adding another patch for Keir.

Even with that, I get this.

Ian.

cc1: warnings being treated as errors
xc_lib.c: In function 'xc_domain_set_memmap_limit':
xc_lib.c:659: error: dereferencing type-punned pointer will break strict-aliasing rules xc_lib.c: In function 'xc_domain_memory_increase_reservation':
xc_lib.c:709: error: dereferencing type-punned pointer will break strict-aliasing rules xc_lib.c: In function 'xc_domain_memory_decrease_reservation':
xc_lib.c:735: error: dereferencing type-punned pointer will break strict-aliasing rules xc_lib.c: In function 'xc_domain_memory_populate_physmap':
xc_lib.c:765: error: dereferencing type-punned pointer will break strict-aliasing rules xc_lib.c: In function 'xc_domain_get_pfn_list':
xc_lib.c:1217: error: assignment from incompatible pointer type
make[4]: *** [xc_lib.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [SUBDIRS_LIBS] Error 2
make[3]: Leaving directory `/u/iwj/work/1/xen-unstable.hg/tools/ocaml' make[2]: *** [subdir-install-ocaml] Error 2
make[2]: Leaving directory `/u/iwj/work/1/xen-unstable.hg/tools'
make[1]: *** [subdirs-install] Error 2
make[1]: Leaving directory `/u/iwj/work/1/xen-unstable.hg/tools'
make: *** [install-tools] Error 2

#9 lore raw
Quoted 11 lines · Ian Jackson

Vincent Hanquez writes ("Re: [Xen-devel] ocaml build error"):

Quoted 1 line

adding another patch for Keir.

Even with that, I get this.

Ian.

cc1: warnings being treated as errors
xc_lib.c: In function 'xc_domain_set_memmap_limit':
xc_lib.c:659: error: dereferencing type-punned pointer will break strict-aliasing rules

No reason for tools/ocaml to override the provided base CFLAGS. This should be fixed by xen-unstable:21329, which implicitly adds -fno-strict-aliasing to CFLAGS.

-- Keir