Incubaid / arakoon

A consistent distributed key-value store
http://arakoon.org
Apache License 2.0
83 stars 16 forks source link

warnings-as-errors strikes again on 4.02dev #407

Open avsm opened 10 years ago

avsm commented 10 years ago

Arakoon fails to build because of warnings-as-errors on 4.02dev (where Strings are being moved towards immutability). Could this be disabled in release versions to make testing with a trunk compiler easier?

===== ERROR while installing arakoon.1.6.7 =====
# opam-version         1.1.1
# os                   linux
# command              make
# path                 /home/opam/.opam/4.02.0dev+trunk/build/arakoon.1.6.7
# compiler             4.02.0dev+trunk
# exit-code            2
# env-file             /home/opam/.opam/4.02.0dev+trunk/build/arakoon.1.6.7/arakoon-6272-2dea01.env
# stdout-file          /home/opam/.opam/4.02.0dev+trunk/build/arakoon.1.6.7/arakoon-6272-2dea01.out
# stderr-file          /home/opam/.opam/4.02.0dev+trunk/build/arakoon.1.6.7/arakoon-6272-2dea01.err
### stdout ###
# ...[truncated]
# ocamlfind ocamlc -c -g -annot -thread -warn-error A -pp camlp4of -package dynlink -package camltc -package str -package bz2 -package oUnit -package lwt.unix -package lwt.preemptive -package lwt -I src/plugins -I src -I doc -I src/msg -I src/tools -I src/system -I src/inifiles -I src/main -I src/paxos -I src/tlog -I src/nursery -I src/node -I src/client -I examples/ocaml -o src/plugins/registry.cmi src/plugins/registry.mli
# ocamlfind ocamlc -c -g -annot -thread -warn-error A -pp camlp4of -package dynlink -package camltc -package str -package bz2 -package oUnit -package lwt.unix -package lwt.preemptive -package lwt -pp 'camlp4of -loc loc logger_macro.cmo' -I src/tools -I src -I doc -I src/plugins -I src/msg -I src/system -I src/inifiles -I src/main -I src/paxos -I src/tlog -I src/nursery -I src/node -I src/client -I examples/ocaml -o src/tools/file_system.cmo src/tools/file_system.ml
# ocamlfind ocamlc -c -g -annot -thread -warn-error A -pp camlp4of -package dynlink -package camltc -package str -package bz2 -package oUnit -package lwt.unix -package lwt.preemptive -package lwt -pp 'camlp4of -loc loc logger_macro.cmo' -I src/paxos -I src -I doc -I src/plugins -I src/msg -I src/tools -I src/system -I src/inifiles -I src/main -I src/tlog -I src/nursery -I src/node -I src/client -I examples/ocaml -o src/paxos/mp_msg.cmo src/paxos/mp_msg.ml
# ocamlfind ocamlc -c -g -annot -thread -warn-error A -pp camlp4of -package dynlink -package camltc -package str -package bz2 -package oUnit -package lwt.unix -package lwt.preemptive -package lwt -pp 'camlp4of -loc loc logger_macro.cmo' -I src/node -I src -I doc -I src/plugins -I src/msg -I src/tools -I src/system -I src/inifiles -I src/main -I src/paxos -I src/tlog -I src/nursery -I src/client -I examples/ocaml -o src/node/store.cmo src/node/store.ml
# + ocamlfind ocamlc -c -g -annot -thread -warn-error A -pp camlp4of -package dynlink -package camltc -package str -package bz2 -package oUnit -package lwt.unix -package lwt.preemptive -package lwt -pp 'camlp4of -loc loc logger_macro.cmo' -I src/tools -I src -I doc -I src/plugins -I src/msg -I src/system -I src/inifiles -I src/main -I src/paxos -I src/tlog -I src/nursery -I src/node -I src/client -I examples/ocaml -o src/tools/file_system.cmo src/tools/file_system.ml
# File "src/tools/file_system.ml", line 84, characters 15-28:
# Warning 3: deprecated feature: String.create
# File "src/tools/file_system.ml", line 1:
# Error: Some fatal warnings were triggered (1 occurrences)
# Command exited with code 2.
NicolasT commented 10 years ago

There's a trivial patch to make the build succeed using 4.02.0dev+trunk:

diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index 50f5951..f543b28 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -144,7 +144,7 @@ let _ = dispatch & function
     flag ["ocaml";"byte";"link"] (S[A"-custom";]);

     flag ["ocaml";"compile";"warn_error"]
-       (S[A"-warn-error";A"A"]);
+       (S[A"-warn-error";A"A-3"]);

     flag ["pp"; "camlp4of"] & S[A"-loc"; A"loc"] ;

We're not convinced it's necessary to support unreleased compiler versions in released versions of Arakoon, especially since the result didn't pass our testsuites.

We think it's worthwhile to have as many errors as possible enabled, and treat most of them as errors (I'm actually working on a branch which enables more warnings), including these deprecation warnings. This will force us to handle these by the time OCaml 4.02 is released. At that time, we'll make sure our development branch (currently 1.8) and latest release (currently 1.7.2, unlike the version you're trying to compile) support this toolchain as soon as possible.

Patches to fix the deprecation warning in-code (i.e. not by disabling it) are welcome, obviously :wink:

NicolasT commented 10 years ago

FWIW, I gave 4.02dev+trunk a spin and created a branch for which compilation succeeds (for now), called ocaml-4.02dev+trunk, see https://github.com/Incubaid/arakoon/compare/ocaml-4.02dev%2Btrunk based on our 1.7 branch. Note this is completely unsupported (both using this branch, as well as using OCaml 4.02). Next to allowing the deprecation warning (for now), some code changes were required as well in order to tackle a new compiler warning, as well as removing a Printf hack which no longer works due to the new GADT-based formatter.

Do note building requires the quickcheck library, which doesn't build with current OCaml 4.02dev+trunk and requires some manual patching (see below). I'm not happy with the patch itself so won't submit upstream.

diff --git a/src/quickCheck_util.ml b/src/quickCheck_util.ml
index 9979deb..adc5edb 100644
--- a/src/quickCheck_util.ml
+++ b/src/quickCheck_util.ml
@@ -47,9 +47,9 @@ end

 let charlist_to_string l =
   let len = List.length l in
-  let s = String.create len in
+  let s = Bytes.create len in
   let i = ref 0 in
-  List.iter (fun c -> s.[!i] <- c; incr i) l; s
+  List.iter (fun c -> Bytes.set s !i c; incr i) l; s

 let join_string_list lst sep =
   let open Printf in
@@ -65,7 +65,9 @@ let sum_int = List.fold_left (+) 0;;

 #if ocaml_version < (4, 01)
 let ( |> ) x f = f x
+
 #endif
+
 let ( <| ) f x = f x

 let ( % ) f g = fun x -> f (g x)