ygrek / mldonkey

cross-platform multi-network p2p daemon (previously at http://mldonkey.sourceforge.net/)
Other
240 stars 45 forks source link

please fix build with ocaml 4.08 #35

Closed rosset closed 4 years ago

rosset commented 5 years ago

please fix build with ocaml 4.08

t-bltg commented 5 years ago

Trying to build with OCaml 4.08.1 throws this error:

<...>/bin/ocamlc.opt -unsafe-string -g -w -3 -unsafe-string -unsafe-string -unsafe-string -unsafe-string   -I src/utils/extlib  -I src/utils/cdk  -I src/utils/bitstring  -I src/utils/lib  -I src/utils/ocamlrss  -I src/utils/xml-light  -I src/utils/net  -I tools  -I src/daemon/common  -I src/daemon/driver  -I src/utils/mp3tagui  -I src/config/unix  -I src/networks/direct_connect  -I src/networks/fasttrack  -I src/networks/fileTP  -I src/networks/bittorrent  -I src/networks/donkey -I +camlp4 -c src/utils/bitstring/bitstring.ml
File "src/utils/net/geoip.ml", line 228, characters 2-17:
228 |   Array1.map_file (Unix.descr_of_in_channel file) 
        ^^^^^^^^^^^^^^^
Error: Unbound value Array1.map_file
XVilka commented 4 years ago

Are there any updates? @ygrek

ygrek commented 4 years ago

ftr patch to build with 4.08 (but breaks compatibility with older OCaml):

diff --git a/src/utils/net/geoip.ml b/src/utils/net/geoip.ml
index aeec24d4..105ea2eb 100644
--- a/src/utils/net/geoip.ml
+++ b/src/utils/net/geoip.ml
@@ -225,8 +225,8 @@ type geoip_database = {
 } 

 let new_map file =
-  Array1.map_file (Unix.descr_of_in_channel file) 
-    int8_unsigned c_layout false (-1)
+  array1_of_genarray @@ Unix.map_file (Unix.descr_of_in_channel file)
+    int8_unsigned c_layout false [|-1|]

 let unpack filename =
   let ext = String.lowercase (Filename2.extension filename) in
ygrek commented 4 years ago

fixed in aec80b90cbaf66e2a83eb2c93e88de3915f711bd