Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to compile with OCaml 5 #125

Closed
Elfahor opened this issue Apr 8, 2023 · 5 comments
Closed

Fails to compile with OCaml 5 #125

Elfahor opened this issue Apr 8, 2023 · 5 comments

Comments

@Elfahor
Copy link

Elfahor commented Apr 8, 2023

ocaml-rust-starter doesn't work with OCaml 5.0.0 (nor do my personnal projects of course). The issue comes from ocaml-boxroot, of which version 0.2.0 is used as of now. Here is dune build's output:

File "src/dune", line 1, characters 0-515:
 1 | (rule
 2 |  (targets libocaml_rust_starter.a dllocaml_rust_starter.so)
 3 |  (deps (glob_files *.rs))
 4 |  (action
 5 |   (progn
 6 |    (run cargo build --target-dir %{project_root}/../../target --release)
 7 |    (run sh -c
 8 |      "mv %{project_root}/../../target/release/libocaml_rust_starter.so ./dllocaml_rust_starter.so 2> /dev/null || \
 9 |       mv %{project_root}/../../target/release/libocaml_rust_starter.dylib ./dllocaml_rust_starter.so")
10 |    (run mv %{project_root}/../../target/release/libocaml_rust_starter.a libocaml_rust_starter.a))))
    Updating crates.io index
   Compiling proc-macro2 v1.0.56
   Compiling cc v1.0.79
   Compiling quote v1.0.26
   Compiling unicode-ident v1.0.8
   Compiling syn v1.0.109
   Compiling ocaml-sys v0.22.3
   Compiling cty v0.2.2
   Compiling ocaml-interop v0.8.8
   Compiling static_assertions v1.1.0
   Compiling ocaml-boxroot-sys v0.2.0
   Compiling ocaml-sys v0.23.0
The following warnings were emitted during compilation:

warning: vendor/boxroot/boxroot.c: In function ‘pool_remove’:
warning: vendor/boxroot/boxroot.c:360:31: warning: unused variable ‘cl’ [-Wunused-variable]
warning:   360 |   FOREACH_GLOBAL_RING(global, cl, {
warning:       |                               ^~
warning: vendor/boxroot/boxroot.c:164:13: note: in definition of macro ‘FOREACH_GLOBAL_RING’
warning:   164 |       class cl = global_ring_classes[b__i - b__st];                     \
warning:       |             ^~
warning: vendor/boxroot/boxroot.c: In function ‘free_all_chunks’:
warning: vendor/boxroot/boxroot.c:375:31: warning: unused variable ‘cl’ [-Wunused-variable]
warning:   375 |   FOREACH_GLOBAL_RING(global, cl, { *global = NULL; });
warning:       |                               ^~
warning: vendor/boxroot/boxroot.c:164:13: note: in definition of macro ‘FOREACH_GLOBAL_RING’
warning:   164 |       class cl = global_ring_classes[b__i - b__st];                     \
warning:       |             ^~
warning: vendor/boxroot/boxroot.c: In function ‘promotion_occupancy’:
warning: vendor/boxroot/boxroot.c:521:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
warning:   521 |   if (threshold <= LOW_COUNT_THRESHOLD) return LOW;
warning:       |                 ^~
warning: vendor/boxroot/boxroot.c:522:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
warning:   522 |   if (threshold <= HIGH_COUNT_THRESHOLD) return HIGH;
warning:       |                 ^~
warning: vendor/boxroot/boxroot.c: In function ‘pool_reclassify’:
warning: vendor/boxroot/boxroot.c:544:3: warning: enumeration value ‘NO_CHANGE’ not handled in switch [-Wswitch]
warning:   544 |   switch (occ) {
warning:       |   ^~~~~~
warning: vendor/boxroot/boxroot.c: In function ‘scan_pool’:
warning: vendor/boxroot/boxroot.c:821:14: warning: passing argument 1 of ‘action’ makes pointer from integer without a cast [-Wint-conversion]
warning:   821 |       action(v, (value *)current);
warning:       |              ^
warning:       |              |
warning:       |              value {aka long int}
warning: vendor/boxroot/boxroot.c:821:14: note: expected ‘void *’ but argument is of type ‘value’ {aka ‘long int’}
warning: vendor/boxroot/boxroot.c:821:17: warning: passing argument 2 of ‘action’ makes integer from pointer without a cast [-Wint-conversion]
warning:   821 |       action(v, (value *)current);
warning:       |                 ^~~~~~~~~~~~~~~~
warning:       |                 |
warning:       |                 value * {aka long int *}
warning: vendor/boxroot/boxroot.c:821:17: note: expected ‘value’ {aka ‘long int’} but argument is of type ‘value *’ {aka ‘long int *’}
warning: vendor/boxroot/boxroot.c:821:7: error: too few arguments to function ‘action’
warning:   821 |       action(v, (value *)current);
warning:       |       ^~~~~~
warning: vendor/boxroot/boxroot.c: In function ‘boxroot_setup’:
warning: vendor/boxroot/boxroot.c:1043:31: warning: unused variable ‘cl’ [-Wunused-variable]
warning:  1043 |   FOREACH_GLOBAL_RING(global, cl, { *global = NULL; });
warning:       |                               ^~
warning: vendor/boxroot/boxroot.c:164:13: note: in definition of macro ‘FOREACH_GLOBAL_RING’
warning:   164 |       class cl = global_ring_classes[b__i - b__st];                     \
warning:       |             ^~
warning: vendor/boxroot/boxroot.c:1045:24: warning: assignment to ‘void (*)(void (*)(void *, value,  volatile value *))’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *))’} from incompatible pointer type ‘scan_roots_hook’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *), scanning_action_flags,  void *, caml_domain_state *)’} [-Wincompatible-pointer-types]
warning:  1045 |   prev_scan_roots_hook = caml_scan_roots_hook;
warning:       |                        ^
warning: vendor/boxroot/boxroot.c:1049:24: warning: assignment to ‘scan_roots_hook’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *), scanning_action_flags,  void *, caml_domain_state *)’} from incompatible pointer type ‘void (*)(void (*)(void *, value,  volatile value *))’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *))’} [-Wincompatible-pointer-types]
warning:  1049 |   caml_scan_roots_hook = scanning_callback;
warning:       |                        ^
warning: vendor/boxroot/boxroot.c: In function ‘boxroot_teardown’:
warning: vendor/boxroot/boxroot.c:1061:24: warning: assignment to ‘scan_roots_hook’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *), scanning_action_flags,  void *, caml_domain_state *)’} from incompatible pointer type ‘void (*)(void (*)(void *, value,  volatile value *))’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *))’} [-Wincompatible-pointer-types]
warning:  1061 |   caml_scan_roots_hook = prev_scan_roots_hook;
warning:       |                        ^

error: failed to run custom build command for `ocaml-boxroot-sys v0.2.0`

Caused by:
  process didn't exit successfully: `/tmp/ocaml-rust-starter/_build/default/src/../../../target/release/build/ocaml-boxroot-sys-50107bf125205a47/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=vendor/boxroot/boxroot.c
  cargo:rerun-if-changed=vendor/boxroot/boxroot.h
  cargo:rerun-if-env-changed=OCAMLOPT
  cargo:rerun-if-env-changed=OCAML_WHERE_PATH
  TARGET = Some("x86_64-unknown-linux-gnu")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/home/elfahor/.opam/default/lib/ocaml" "-I" "vendor/boxroot/" "-Wall" "-Wextra" "-o" "/tmp/ocaml-rust-starter/_build/default/src/../../../target/release/build/ocaml-boxroot-sys-b5c7c2b9cf356845/out/vendor/boxroot/boxroot.o" "-c" "vendor/boxroot/boxroot.c"
  cargo:warning=vendor/boxroot/boxroot.c: In function ‘pool_remove’:
  cargo:warning=vendor/boxroot/boxroot.c:360:31: warning: unused variable ‘cl’ [-Wunused-variable]
  cargo:warning=  360 |   FOREACH_GLOBAL_RING(global, cl, {
  cargo:warning=      |                               ^~
  cargo:warning=vendor/boxroot/boxroot.c:164:13: note: in definition of macro ‘FOREACH_GLOBAL_RING’
  cargo:warning=  164 |       class cl = global_ring_classes[b__i - b__st];                     \
  cargo:warning=      |             ^~
  cargo:warning=vendor/boxroot/boxroot.c: In function ‘free_all_chunks’:
  cargo:warning=vendor/boxroot/boxroot.c:375:31: warning: unused variable ‘cl’ [-Wunused-variable]
  cargo:warning=  375 |   FOREACH_GLOBAL_RING(global, cl, { *global = NULL; });
  cargo:warning=      |                               ^~
  cargo:warning=vendor/boxroot/boxroot.c:164:13: note: in definition of macro ‘FOREACH_GLOBAL_RING’
  cargo:warning=  164 |       class cl = global_ring_classes[b__i - b__st];                     \
  cargo:warning=      |             ^~
  cargo:warning=vendor/boxroot/boxroot.c: In function ‘promotion_occupancy’:
  cargo:warning=vendor/boxroot/boxroot.c:521:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
  cargo:warning=  521 |   if (threshold <= LOW_COUNT_THRESHOLD) return LOW;
  cargo:warning=      |                 ^~
  cargo:warning=vendor/boxroot/boxroot.c:522:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
  cargo:warning=  522 |   if (threshold <= HIGH_COUNT_THRESHOLD) return HIGH;
  cargo:warning=      |                 ^~
  cargo:warning=vendor/boxroot/boxroot.c: In function ‘pool_reclassify’:
  cargo:warning=vendor/boxroot/boxroot.c:544:3: warning: enumeration value ‘NO_CHANGE’ not handled in switch [-Wswitch]
  cargo:warning=  544 |   switch (occ) {
  cargo:warning=      |   ^~~~~~
  cargo:warning=vendor/boxroot/boxroot.c: In function ‘scan_pool’:
  cargo:warning=vendor/boxroot/boxroot.c:821:14: warning: passing argument 1 of ‘action’ makes pointer from integer without a cast [-Wint-conversion]
  cargo:warning=  821 |       action(v, (value *)current);
  cargo:warning=      |              ^
  cargo:warning=      |              |
  cargo:warning=      |              value {aka long int}
  cargo:warning=vendor/boxroot/boxroot.c:821:14: note: expected ‘void *’ but argument is of type ‘value’ {aka ‘long int’}
  cargo:warning=vendor/boxroot/boxroot.c:821:17: warning: passing argument 2 of ‘action’ makes integer from pointer without a cast [-Wint-conversion]
  cargo:warning=  821 |       action(v, (value *)current);
  cargo:warning=      |                 ^~~~~~~~~~~~~~~~
  cargo:warning=      |                 |
  cargo:warning=      |                 value * {aka long int *}
  cargo:warning=vendor/boxroot/boxroot.c:821:17: note: expected ‘value’ {aka ‘long int’} but argument is of type ‘value *’ {aka ‘long int *’}
  cargo:warning=vendor/boxroot/boxroot.c:821:7: error: too few arguments to function ‘action’
  cargo:warning=  821 |       action(v, (value *)current);
  cargo:warning=      |       ^~~~~~
  cargo:warning=vendor/boxroot/boxroot.c: In function ‘boxroot_setup’:
  cargo:warning=vendor/boxroot/boxroot.c:1043:31: warning: unused variable ‘cl’ [-Wunused-variable]
  cargo:warning= 1043 |   FOREACH_GLOBAL_RING(global, cl, { *global = NULL; });
  cargo:warning=      |                               ^~
  cargo:warning=vendor/boxroot/boxroot.c:164:13: note: in definition of macro ‘FOREACH_GLOBAL_RING’
  cargo:warning=  164 |       class cl = global_ring_classes[b__i - b__st];                     \
  cargo:warning=      |             ^~
  cargo:warning=vendor/boxroot/boxroot.c:1045:24: warning: assignment to ‘void (*)(void (*)(void *, value,  volatile value *))’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *))’} from incompatible pointer type ‘scan_roots_hook’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *), scanning_action_flags,  void *, caml_domain_state *)’} [-Wincompatible-pointer-types]
  cargo:warning= 1045 |   prev_scan_roots_hook = caml_scan_roots_hook;
  cargo:warning=      |                        ^
  cargo:warning=vendor/boxroot/boxroot.c:1049:24: warning: assignment to ‘scan_roots_hook’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *), scanning_action_flags,  void *, caml_domain_state *)’} from incompatible pointer type ‘void (*)(void (*)(void *, value,  volatile value *))’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *))’} [-Wincompatible-pointer-types]
  cargo:warning= 1049 |   caml_scan_roots_hook = scanning_callback;
  cargo:warning=      |                        ^
  cargo:warning=vendor/boxroot/boxroot.c: In function ‘boxroot_teardown’:
  cargo:warning=vendor/boxroot/boxroot.c:1061:24: warning: assignment to ‘scan_roots_hook’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *), scanning_action_flags,  void *, caml_domain_state *)’} from incompatible pointer type ‘void (*)(void (*)(void *, value,  volatile value *))’ {aka ‘void (*)(void (*)(void *, long int,  volatile long int *))’} [-Wincompatible-pointer-types]
  cargo:warning= 1061 |   caml_scan_roots_hook = prev_scan_roots_hook;
  cargo:warning=      |                        ^
  exit status: 1

  --- stderr


  error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/home/elfahor/.opam/default/lib/ocaml" "-I" "vendor/boxroot/" "-Wall" "-Wextra" "-o" "/tmp/ocaml-rust-starter/_build/default/src/../../../target/release/build/ocaml-boxroot-sys-b5c7c2b9cf356845/out/vendor/boxroot/boxroot.o" "-c" "vendor/boxroot/boxroot.c" with args "cc" did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...

Whereas when I compile a Cargo project using ocaml-boxroot = "0.3.0", I don't get any such issue.

Hopefully, the solution would be to simply update the dependencies, but I was unable to do it (I tried simply cloning the repo and bumping the version in Cargo.toml but I continues trying to build the 0.2.0 version.).

OCaml version: 5.0.0
Rust version: 1.68.2 (9eb3afe9e 2023-03-27)

Thanks in advance.

@zshipko
Copy link
Owner

zshipko commented Apr 8, 2023

Thanks for the detailed report! Right now there is a branch that works with OCaml 5.0 here: https://github.com/zshipko/ocaml-rs/tree/ocaml5 however no attention has been given to working with multiple threads yet.

I believe there are some changes needed to ocaml-interop to improve the compatibility with OCaml 5.0 then I can make a new release.

@Lupus
Copy link
Contributor

Lupus commented Feb 5, 2024

@zshipko what's the latest on OCaml 5 support for ocaml-rs? I can't seem to find relevant information in README...

@Lupus
Copy link
Contributor

Lupus commented Feb 5, 2024

Hm, looks like this is the tracking issue in ocaml-interop: tizoc/ocaml-interop#58 which further mentions this MR: https://gitlab.com/ocaml-rust/ocaml-boxroot/-/merge_requests/75, which is still under review (seems like final stages, fingers crossed).

@dannywillems
Copy link

Hey. It seems there have been updates on ocaml-boxroot, now mentioning OCaml 5 in the README: https://gitlab.com/ocaml-rust/ocaml-boxroot.
Is there anything we could help with?

@zshipko
Copy link
Owner

zshipko commented Sep 10, 2024

Closing this since 1.0 is now released with the latest ocaml-boxroot version

@zshipko zshipko closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants