stan-dev / stanc3

The Stan transpiler (from Stan to C++ and beyond).
BSD 3-Clause "New" or "Revised" License
138 stars 44 forks source link

[BUG] Build error: This expression has type [ `Use_Sys_unix ]. This is not a function; it cannot be applied. #1272

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago

I am trying to build stanc3 on MacOS PPC. After fixing a number of OCaml packages, finally all dependencies are built. stanc3 itself failed, however:

:info:build File "test/integration/run_bin_on_args.ml", line 12, characters 5-20:
:info:build 12 |   if Sys.file_exists (to_windows path) then to_windows cmd else cmd
:info:build           ^^^^^^^^^^^^^^^
:info:build Alert deprecated: Core_kernel.Sys.file_exists
:info:build [since 2021-04] Use [Sys_unix]
:info:build File "test/integration/run_bin_on_args.ml", line 12, characters 5-20:
:info:build 12 |   if Sys.file_exists (to_windows path) then to_windows cmd else cmd
:info:build           ^^^^^^^^^^^^^^^
:info:build Error: This expression has type [ `Use_Sys_unix ]
:info:build        This is not a function; it cannot be applied.

There are also multiple deprecation warnings:

:info:build File "test/stancjs/run_js_on_args.ml", line 1, characters 5-16:
:info:build 1 | open Core_kernel
:info:build          ^^^^^^^^^^^
:info:build Alert deprecated: module Core_kernel
:info:build [since 2021-05] Use [Core] -- [Core_kernel] was renamed as [Core]
:info:build File "test/stancjs/run_js_on_args.ml", line 13, characters 25-33:
:info:build 13 |   let files = Array.(sub Sys.argv ~pos:1 ~len:(length Sys.argv - 1)) in
:info:build                               ^^^^^^^^
:info:build Alert deprecated: Core_kernel.Sys.argv
:info:build [since 2019-08] Use [Sys.get_argv] instead, which has the correct behavior when [caml_sys_modify_argv] is called.

Etc.

Can the error above be fixed?

P. S. System info: macOS 10A190 (ppc32) gcc 12.2.0 OCaml 4.14.0

WardBrian commented 1 year ago

We have pinned versions for most of our dependencies. Currently we only support building with OCaml 4.12 and the dependencies as listed here.

Building with other versions will most likely require source changes, since the Jane Street dependencies (Core_kernel and similar) tend to make breaking changes

WardBrian commented 1 year ago

That said, the error you got seems to be specifically on the test files, so you may be able to ignore it if you delete the tests folder? But running the tests on the new platform would surely be nice

barracuda156 commented 1 year ago

@WardBrian Perhaps tests will not work anyway (or not all will), since there is a dependency on ocaml-bisect_ppx, which is broken atm: https://github.com/aantron/bisect_ppx/pull/400

P. S. Not really sure how to deal with this disturbing OCaml incompatibility with every slight change. A reasonable assumption is that currently developed software should be cross-compatible and above all compatible with the latest released versions of compiler and libraries it uses (plus few previous versions for backward compatibility). It is totally broken with OCaml.

WardBrian commented 1 year ago

ppx_bisect is only used for test coverage and does not need to be installed to build or run tests.

A reasonable assumption is that currently developed software should be cross-compatible and above all compatible with the latest released versions of compiler and libraries it uses (plus few previous versions for backward compatibility). It is totally broken with OCaml.

I have found this to be broken in essentially every ecosystem to some extent. The main thing that makes it difficult in OCaml is any of the packages which include “ppx” in the name are preprocessor macro packages, which may require changes any time the OCaml AST changes

barracuda156 commented 1 year ago

@WardBrian Sort of fixed initial error by including correct libs, but then got this one:

File "test/integration/run_bin_on_args.ml", line 7, characters 4-31:
7 |     String.substr_replace_first ~pattern ~with_:"/default.windows/" str ^ ".exe"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound value String.substr_replace_first

String.substr_replace_first apparently is in Base.String. However upon including it, another error happens:

File "test/integration/run_bin_on_args.ml", line 6, characters 0-3:
6 | let maybe_convert_cmd_to_windows cmd =
    ^^^
Error: Syntax error

This test does not want to get fixed LOL

barracuda156 commented 1 year ago

That said, the error you got seems to be specifically on the test files, so you may be able to ignore it if you delete the tests folder? But running the tests on the new platform would surely be nice

Is there a target or flag to pass to Dune in order for tests not to be built? --without-test does not seem to work.

WardBrian commented 1 year ago

If you run dune build src/stanc/stanc.exe does that work? It should only build the bare minimum there.

Is using OCaml 4.12 not an option for you?

barracuda156 commented 1 year ago

If you run dune build src/stanc/stanc.exe does that work? It should only build the bare minimum there.

It looks like that should happen, but by default Dune builds everything. The target Macports uses as default is install. This and other Dune-specific options available to modify are here: https://github.com/macports/macports-ports/blob/2f7e934ed19f5de797a4460eade648a7d96a7d82/_resources/port1.0/group/ocaml-1.1.tcl#L391

For now, deleting tests folder actually worked, stanc3 has built. I cannot “sell” such a solution to Macports though :)

Is using OCaml 4.12 not an option for you?

I think it is not a problem with OCaml but rather libraries. I do not have a clear idea on this. Some considerations (mostly for the context):

  1. Given that OCaml is at version 5, I would expect Stan developers to move to 4.14 somewhat soon (or that won’t happen?).
  2. Right now Macports still used OCaml 4.12, but update to 4.14 has long been planned, and I thought to make a PR now. Even if I do not do that (or it is not approved), the maintainer of OCaml is likely to do it himself in a while.
  3. With that in mind, setting everything for 4.12 now and having then to modify and possibly fix some 60 ports does not seem to be a good plan.
  4. Also, given that I am a contributor and not a member, updating needed ports may take forever, since PRs are not often approved too fast.
  5. Having multiple ports locked at some old versions may run in conflict with need of other ports.

Having said that, personally of course I can try building everything with OCaml 4.12 on another installation (I do not want to mess up the one I have, it took substantial pain to make everything build), and if tests do not work with OCaml 4.14, I will do that, since I am interested to run tests and see if everything works as supposed.

barracuda156 commented 1 year ago

By the way, I found a notion how to use external stanc3 with CmdStan: https://mc-stan.org/stanc3/stanc/getting_started.html But STANC3= is a path to a folder, while the binary is elsewhere (symlinking is doable, but not the best solution).

This is what got installed after I deleted tests:

--->  Installing stanc3 @2.30.1_0
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_math_stanc3/stanc3/work/destroot" && /usr/bin/tar -cvf - . | /usr/bin/bzip2 -c9 > /opt/local/var/macports/software/stanc3/stanc3-2.30.1_0.darwin_10.ppc.tbz2 
./
./+COMMENT
./+CONTENTS
./+DESC
./._+PORTFILE
./+PORTFILE
./+STATE
./opt/
./opt/local/
./opt/local/bin/
./opt/local/bin/stanc
./opt/local/lib/
./opt/local/lib/ocaml/
./opt/local/lib/ocaml/site-lib/
./opt/local/lib/ocaml/site-lib/stanc/
./opt/local/lib/ocaml/site-lib/stanc/analysis/
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization.cma
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Dataflow_types.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Dataflow_types.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Dataflow_utils.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Dataflow_utils.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Dataflow_utils.cmti
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Debug_data_generation.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Debug_data_generation.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Debug_data_generation.cmti
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Dependence_analysis.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Dependence_analysis.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Dependence_analysis.cmti
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Factor_graph.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Factor_graph.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Memory_patterns.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Memory_patterns.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Mir_utils.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Mir_utils.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Mir_utils.cmti
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Monotone_framework.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Monotone_framework.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Monotone_framework_sigs.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Monotone_framework_sigs.cmti
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Optimize.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Optimize.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Optimize.cmti
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Partial_evaluator.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Partial_evaluator.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Pedantic_analysis.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Pedantic_analysis.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Pedantic_analysis.cmti
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Pedantic_dist_warnings.cmi
./opt/local/lib/ocaml/site-lib/stanc/analysis/analysis_and_optimization__Pedantic_dist_warnings.cmt
./opt/local/lib/ocaml/site-lib/stanc/analysis/Dataflow_types.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Dataflow_utils.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Dataflow_utils.mli
./opt/local/lib/ocaml/site-lib/stanc/analysis/Debug_data_generation.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Debug_data_generation.mli
./opt/local/lib/ocaml/site-lib/stanc/analysis/Dependence_analysis.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Dependence_analysis.mli
./opt/local/lib/ocaml/site-lib/stanc/analysis/Factor_graph.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Memory_patterns.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Mir_utils.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Mir_utils.mli
./opt/local/lib/ocaml/site-lib/stanc/analysis/Monotone_framework.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Monotone_framework_sigs.mli
./opt/local/lib/ocaml/site-lib/stanc/analysis/Optimize.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Optimize.mli
./opt/local/lib/ocaml/site-lib/stanc/analysis/Partial_evaluator.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Pedantic_analysis.ml
./opt/local/lib/ocaml/site-lib/stanc/analysis/Pedantic_analysis.mli
./opt/local/lib/ocaml/site-lib/stanc/analysis/Pedantic_dist_warnings.ml
./opt/local/lib/ocaml/site-lib/stanc/common/
./opt/local/lib/ocaml/site-lib/stanc/common/common.cma
./opt/local/lib/ocaml/site-lib/stanc/common/common.cmi
./opt/local/lib/ocaml/site-lib/stanc/common/common.cmt
./opt/local/lib/ocaml/site-lib/stanc/common/common.ml
./opt/local/lib/ocaml/site-lib/stanc/common/common__FatalError.cmi
./opt/local/lib/ocaml/site-lib/stanc/common/common__FatalError.cmt
./opt/local/lib/ocaml/site-lib/stanc/common/common__Fixed.cmi
./opt/local/lib/ocaml/site-lib/stanc/common/common__Fixed.cmt
./opt/local/lib/ocaml/site-lib/stanc/common/common__Foldable.cmi
./opt/local/lib/ocaml/site-lib/stanc/common/common__Foldable.cmt
./opt/local/lib/ocaml/site-lib/stanc/common/common__Gensym.cmi
./opt/local/lib/ocaml/site-lib/stanc/common/common__Gensym.cmt
./opt/local/lib/ocaml/site-lib/stanc/common/common__Gensym.cmti
./opt/local/lib/ocaml/site-lib/stanc/common/common__Pattern.cmi
./opt/local/lib/ocaml/site-lib/stanc/common/common__Pattern.cmt
./opt/local/lib/ocaml/site-lib/stanc/common/common__Pretty.cmi
./opt/local/lib/ocaml/site-lib/stanc/common/common__Pretty.cmt
./opt/local/lib/ocaml/site-lib/stanc/common/common__Specialized.cmi
./opt/local/lib/ocaml/site-lib/stanc/common/common__Specialized.cmt
./opt/local/lib/ocaml/site-lib/stanc/common/FatalError.ml
./opt/local/lib/ocaml/site-lib/stanc/common/Fixed.ml
./opt/local/lib/ocaml/site-lib/stanc/common/Foldable.ml
./opt/local/lib/ocaml/site-lib/stanc/common/Gensym.ml
./opt/local/lib/ocaml/site-lib/stanc/common/Gensym.mli
./opt/local/lib/ocaml/site-lib/stanc/common/Pattern.ml
./opt/local/lib/ocaml/site-lib/stanc/common/Pretty.ml
./opt/local/lib/ocaml/site-lib/stanc/common/Specialized.ml
./opt/local/lib/ocaml/site-lib/stanc/dune-package
./opt/local/lib/ocaml/site-lib/stanc/frontend/
./opt/local/lib/ocaml/site-lib/stanc/frontend/Ast.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Ast_to_Mir.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Ast_to_Mir.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/Canonicalize.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Canonicalize.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/Debugging.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Deprecation_analysis.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Deprecation_analysis.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/Environment.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Environment.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/Errors.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Errors.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend.cma
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Ast.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Ast.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Ast_to_Mir.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Ast_to_Mir.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Ast_to_Mir.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Canonicalize.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Canonicalize.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Canonicalize.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Debugging.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Debugging.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Deprecation_analysis.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Deprecation_analysis.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Deprecation_analysis.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Environment.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Environment.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Environment.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Errors.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Errors.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Errors.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Info.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Info.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Info.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Input_warnings.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Input_warnings.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Input_warnings.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Lexer.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Lexer.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Parse.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Parse.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Parse.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Parser.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Parser.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Parser.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Parsing_errors.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Parsing_errors.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Preprocessor.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Preprocessor.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Preprocessor.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Pretty_printing.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Pretty_printing.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Pretty_printing.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Promotion.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Promotion.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Semantic_error.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Semantic_error.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Semantic_error.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__SignatureMismatch.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__SignatureMismatch.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__SignatureMismatch.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Typechecker.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Typechecker.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Typechecker.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Warnings.cmi
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Warnings.cmt
./opt/local/lib/ocaml/site-lib/stanc/frontend/frontend__Warnings.cmti
./opt/local/lib/ocaml/site-lib/stanc/frontend/Info.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Info.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/Input_warnings.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Input_warnings.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/lexer.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Parse.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Parse.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/parser.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/parser.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/parsing_errors.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Preprocessor.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Preprocessor.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/Pretty_printing.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Pretty_printing.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/Promotion.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Semantic_error.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Semantic_error.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/SignatureMismatch.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/SignatureMismatch.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/Typechecker.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Typechecker.mli
./opt/local/lib/ocaml/site-lib/stanc/frontend/Warnings.ml
./opt/local/lib/ocaml/site-lib/stanc/frontend/Warnings.mli
./opt/local/lib/ocaml/site-lib/stanc/META
./opt/local/lib/ocaml/site-lib/stanc/middle/
./opt/local/lib/ocaml/site-lib/stanc/middle/Expr.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Expr.mli
./opt/local/lib/ocaml/site-lib/stanc/middle/Flag_vars.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Fun_kind.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Index.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Internal_fun.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Location.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Location_span.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Mem_pattern.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/middle.cma
./opt/local/lib/ocaml/site-lib/stanc/middle/middle.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Expr.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Expr.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Expr.cmti
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Flag_vars.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Flag_vars.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Fun_kind.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Fun_kind.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Index.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Index.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Internal_fun.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Internal_fun.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Location.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Location.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Location_span.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Location_span.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Mem_pattern.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Mem_pattern.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Operator.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Operator.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Program.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Program.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__SizedType.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__SizedType.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Stan_math_signatures.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Stan_math_signatures.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Stan_math_signatures.cmti
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Stmt.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Stmt.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Stmt.cmti
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Transformation.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Transformation.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Type.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Type.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__UnsizedType.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__UnsizedType.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Utils.cmi
./opt/local/lib/ocaml/site-lib/stanc/middle/middle__Utils.cmt
./opt/local/lib/ocaml/site-lib/stanc/middle/Operator.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Program.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/SizedType.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Stan_math_signatures.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Stan_math_signatures.mli
./opt/local/lib/ocaml/site-lib/stanc/middle/Stmt.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Stmt.mli
./opt/local/lib/ocaml/site-lib/stanc/middle/Transformation.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Type.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/UnsizedType.ml
./opt/local/lib/ocaml/site-lib/stanc/middle/Utils.ml
./opt/local/lib/ocaml/site-lib/stanc/opam
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Cpp_Json.cmi
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Cpp_Json.cmt
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Cpp_Json.cmti
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Cpp_str.cmi
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Cpp_str.cmt
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Cpp_str.cmti
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Expression_gen.cmi
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Expression_gen.cmt
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Function_gen.cmi
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Function_gen.cmt
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Function_gen.cmti
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Locations.cmi
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Locations.cmt
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Locations.cmti
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Mangle.cmi
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Mangle.cmt
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Mangle.cmti
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Statement_gen.cmi
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/.private/stan_math_backend__Statement_gen.cmt
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Cpp_Json.ml
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Cpp_Json.mli
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Cpp_str.ml
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Cpp_str.mli
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Expression_gen.ml
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Function_gen.ml
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Function_gen.mli
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Locations.ml
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Locations.mli
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Mangle.ml
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Mangle.mli
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/stan_math_backend.cma
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/stan_math_backend.cmi
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/stan_math_backend.cmt
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/stan_math_backend.ml
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/stan_math_backend__Stan_math_code_gen.cmi
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/stan_math_backend__Stan_math_code_gen.cmt
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/stan_math_backend__Stan_math_code_gen.cmti
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/stan_math_backend__Transform_Mir.cmi
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/stan_math_backend__Transform_Mir.cmt
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/stan_math_backend__Transform_Mir.cmti
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Stan_math_code_gen.ml
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Stan_math_code_gen.mli
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Statement_gen.ml
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Transform_Mir.ml
./opt/local/lib/ocaml/site-lib/stanc/stan_math_backend/Transform_Mir.mli
./opt/local/share/
./opt/local/share/doc/
./opt/local/share/doc/stanc/
./opt/local/share/doc/stanc/LICENSE.txt
./opt/local/share/doc/stanc/odoc-pages/
./opt/local/share/doc/stanc/odoc-pages/core_ideas.mld
./opt/local/share/doc/stanc/odoc-pages/dependencies.mld
./opt/local/share/doc/stanc/odoc-pages/exposing_new_functions.mld
./opt/local/share/doc/stanc/odoc-pages/getting_started.mld
./opt/local/share/doc/stanc/odoc-pages/index.mld
./opt/local/share/doc/stanc/odoc-pages/parser_messages.mld
./opt/local/share/doc/stanc/README.md
--->  Activating stanc3 @2.30.1_0

So libs are in OCaml home folder, while the binary is in /opt/local/bin. That is, two variables are needed to refer to its installation.

WardBrian commented 1 year ago

It may be possible for us to move to 4.14 (it looks like opam-cross-windows supports it, which is our main blocked for that, but not the newer Jane libraries. I was the last person to update those).

I wouldn’t assume it will be soon, there isn’t much that I know of which would push us towards updating. For context, I only undertook the update to 4.12 (from 4.07) so that we would be able to use the OCaml Language Server. We generally maintain our own build processes (for x86 on the Big 3 platforms and a bunch of other arches on Linux) so we’re not tied to a mandatory update cycle. The standard practice in OCaml is to use opam environments (“switches”) so that multiple versions can coexist.

If it is truly only the test harness which is broken maybe we can update more easily, or perhaps write it in such a way that it compiles in multiple versions. Otherwise I suspect the next version we update to will be something like OCaml 5.1, once that new ecosystem has stabilized and our important dependencies are updated.

WardBrian commented 1 year ago

It shouldn’t be necessary to maintain the built versions of the libraries. I think it works out of the box but if not there are options to link statically

barracuda156 commented 1 year ago

It may be possible for us to move to 4.14 (it looks like opam-cross-windows supports it, which is our main blocked for that, but not the newer Jane libraries. I was the last person to update those).

I have built everything now with OCaml 4.14 of required dependencies. I think I had to patch 2–3 ports out of ~60, and that too probably specific to old macOS. Everything seems to work fine.

Of optional dependencies, ocaml-expect_test_helpers is failing with some compatibility errors (it is stuck at 0.13.0 in upstream), which prevents ocaml-patdiff from building. Should be fixable though. (I will try later with 4.12, I suspect it may be libraries and not OCaml itself that causes incompatibility.)

barracuda156 commented 1 year ago

It shouldn’t be necessary to maintain the built versions of the libraries. I think it works out of the box but if not there are options to link statically

@WardBrian What about variables to use with CmdStan in make/local for an external Stanc3? If I use STANC3=/opt/local/lib/ocaml/site-lib/stanc/ for the folder, how do I point to the executable /opt/local/bin/stanc?

WardBrian commented 1 year ago

That variable is really only intended for developers who want to use a local checkout of stanc. I don’t believe we currently support anything other than having the built executable in $CMDSTAN/bin/stanc

barracuda156 commented 1 year ago

That variable is really only intended for developers who want to use a local checkout of stanc. I don’t believe we currently support anything other than having the built executable in $CMDSTAN/bin/stanc

I guess I can make symlinks then, shouldn’t be a problem. The only question is then how to make CmdStan not to build everything anew and just use existing tools, once they are symlinked into needed spots in the build tree.

WardBrian commented 1 year ago

I believe the way make works, as long as the symlink is newer than the other files in bin/ it should not be overwritten

WardBrian commented 1 year ago

I don't believe this is an issue we will address in this repo so I'm marking it as closed. I'm happy to continue discussions of it here or on the forums however

barracuda156 commented 1 year ago

@WardBrian Thank you for your support! Indeed, we do not need to keep the issue opened. I will try to implement CmdStan build in coming days, and may have some questions then :)