stan-dev/stanc3

[BUG] stanc3 v. 2.33.1: build error with OCaml 4.14.1 and JaneStreet 0.16.x: `Error: This expression has type [ `Use_Sys_unix ] This is not a function; it cannot be applied`; `Error: Unbound value Set.Poly.union`

Closed this issue · 4 comments

--->  Building stanc3
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_stanc3/stanc3/work/stanc3-2.33.1" && /opt/local/bin/dune build -j 6 --root=/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_stanc3/stanc3/work/stanc3-2.33.1 --profile=release --ignore-promoted-rules --no-config --only-packages=stanc --default-target=@install @install 
File "test/integration/run_bin_on_args.ml", line 1, characters 5-16:
1 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "test/integration/run_bin_on_args.ml", line 12, characters 5-20:
12 |   if Sys.file_exists (to_windows path) then to_windows cmd else cmd
          ^^^^^^^^^^^^^^^
Alert deprecated: Core_kernel.Sys.file_exists
[since 2021-04] Use [Sys_unix]
File "test/integration/run_bin_on_args.ml", line 12, characters 5-20:
12 |   if Sys.file_exists (to_windows path) then to_windows cmd else cmd
          ^^^^^^^^^^^^^^^
Error: This expression has type [ `Use_Sys_unix ]
       This is not a function; it cannot be applied.
File "test/stancjs/run_js_on_args.ml", line 1, characters 5-16:
1 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "test/stancjs/run_js_on_args.ml", line 13, characters 25-33:
13 |   let files = Array.(sub Sys.argv ~pos:1 ~len:(length Sys.argv - 1)) in
                              ^^^^^^^^
Alert deprecated: Core_kernel.Sys.argv
[since 2019-08] Use [Sys.get_argv] instead, which has the correct behavior when [caml_sys_modify_argv] is called.
File "test/stancjs/run_js_on_args.ml", line 13, characters 54-62:
13 |   let files = Array.(sub Sys.argv ~pos:1 ~len:(length Sys.argv - 1)) in
                                                           ^^^^^^^^
Alert deprecated: Core_kernel.Sys.argv
[since 2019-08] Use [Sys.get_argv] instead, which has the correct behavior when [caml_sys_modify_argv] is called.
Read 600 sample input sentences and 257 error messages.
File "src/common/FatalError.ml", line 3, characters 5-16:
3 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/common/Foldable.ml", line 18, characters 5-16:
18 | open Core_kernel
          ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/common/Specialized.ml", line 11, characters 5-16:
11 | open Core_kernel
          ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/common/Fixed.ml", line 5, characters 5-16:
5 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Index.ml", line 3, characters 5-16:
3 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Index.ml", line 52, characters 6-20:
52 |       Set.Poly.union top_fold (op top_fold expr_bottom)
           ^^^^^^^^^^^^^^
Error: Unbound value Set.Poly.union
File "src/middle/Mem_pattern.ml", line 1, characters 5-16:
1 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Mem_pattern.ml", line 2, characters 5-21:
2 | open Core_kernel.Poly
         ^^^^^^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Location.ml", line 3, characters 5-16:
3 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Operator.ml", line 3, characters 5-16:
3 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Transformation.ml", line 1, characters 5-16:
1 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Location_span.ml", line 3, characters 5-16:
3 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Internal_fun.ml", line 3, characters 5-16:
3 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Fun_kind.ml", line 5, characters 5-16:
5 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Fun_kind.ml", line 19, characters 25-53:
19 |   let is_suffix suffix = Core_kernel.String.is_suffix ~suffix fname in
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/UnsizedType.ml", line 3, characters 5-16:
3 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/UnsizedType.ml", line 4, characters 5-21:
4 | open Core_kernel.Poly
         ^^^^^^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
File "src/middle/Stan_math_signatures.mli", line 6, characters 5-16:
6 | open Core_kernel
         ^^^^^^^^^^^
Alert deprecated: module Core_kernel
[since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
Command failed:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_stanc3/stanc3/work/stanc3-2.33.1" && /opt/local/bin/dune build -j 6 --root=/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_stanc3/stanc3/work/stanc3-2.33.1 --profile=release --ignore-promoted-rules --no-config --only-packages=stanc --default-target=@install @install 
Exit code: 1

Is it still broken with OCaml 4.14.x, or other way round, expects some bleeding edge developer versions?
I think the whole chain of packages should be up-to-date on my end.

36-4% port -v installed ocaml
  ocaml @4.14.1_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2023-10-05T23:32:34+0800'
36-4% port -v installed ocaml-dune
  ocaml-dune @3.11.1_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2023-10-20T05:12:10+0800'
36-4% port -v installed ocaml-core_kernel
  ocaml-core_kernel @0.16.0_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2023-10-25T16:57:09+0800'
36-4% port -v installed ocaml-yojson
  ocaml-yojson @2.1.1_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2023-10-25T20:30:27+0800'
36-4% port -v installed ocaml-ppx_deriving
  ocaml-ppx_deriving @5.2.1_2 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2023-10-25T20:30:00+0800'
36-4% port -v installed ocaml-menhir
The following ports are currently installed:
  ocaml-menhir @20230608_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2023-10-25T17:47:42+0800'
36-4% port -v installed ocaml-fmt
  ocaml-fmt @0.9.0_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2023-10-25T20:43:18+0800'

If you're trying to build a previously released version (looks like 2.33.1) you need ocaml 4.12.x and the Jane Street libraries 0.14.x

Updating to OCaml 4.14/JS 0.16 was done very recently in #1366

Thank you! I will try building form the master then.

(We could perhaps close it as resolved in fact.)

@WardBrian Just for the record, stanc3 from the master built with no issues:

36-185% port -v installed stanc3
The following ports are currently installed:
  stanc3 @2.30.1_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-11-21T06:41:58+0800'
  stanc3 @2.31.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2023-04-16T04:18:10+0800'
  stanc3 @2023.10.23_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2023-10-27T10:18:11+0800'

Thank you!