ygrek / mldonkey

cross-platform multi-network p2p daemon
http://mldonkey.sourceforge.net/
Other
235 stars 43 forks source link

Build error with Ocaml-4.12: undefined reference to 'caml_hash_univ_param' #60

Closed perfect7gentleman closed 2 years ago

perfect7gentleman commented 3 years ago
src/utils/lib/CryptoPP.cc:9488:6: warning: type of ‘cc_lprintf_nl’ does not match original declaration [-Wlto-type-mismatch]
 9488 | void cc_lprintf_nl(const char * msg, bool verb);
      |      ^
src/utils/lib/CryptoPP_stubs.c:87:6: note: type mismatch in parameter 2
   87 | void cc_lprintf_nl(const char * msg, int verb)
      |      ^
src/utils/lib/CryptoPP_stubs.c:87:6: note: type ‘int’ should match type ‘bool’
src/utils/lib/CryptoPP_stubs.c:87:6: note: ‘cc_lprintf_nl’ was previously declared here
src/utils/lib/CryptoPP_stubs.c:87:6: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: build/core.a(donkeyClient.o): in function `camlDonkeyClient__hash_1966':
:(.text+0x5162): undefined reference to `caml_hash_univ_param'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: build/core.a(donkeyClient.o): in function `camlDonkeyClient__1':
:(.data+0x8728): undefined reference to `caml_hash_univ_param'
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking (exit code 1)
make: *** [Makefile:2772: mlnet] Error 2
 ~ $ ocaml --version
The OCaml toplevel, version 4.12.0
~ $ gcc --version
gcc (Gentoo 10.2.0-r5 p6) 10.2.0

build.log - https://gist.github.com/perfect7gentleman/e131a23d4011f11fd63843669ee4aa11

ygrek commented 2 years ago

I understand it is ocaml 4.12 configured to not force safe-string?

perfect7gentleman commented 2 years ago

of course patch to support ocaml-4.12

--- a/src/networks/donkey/donkeyClient.ml   2021-09-25 10:11:48.211287053 +0700
+++ b/src/networks/donkey/donkeyClient.ml   2021-09-25 10:12:32.348854429 +0700
@@ -810,10 +810,6 @@
           query_id ip port id
         end

-
-external hash_param : int -> int -> 'a -> int = "caml_hash_univ_param" "noalloc"
-let hash x = hash_param 10 100 x
-
 let shared_of_file file =
   match file.file_shared with
     | None  -> None