Compiling BATSH

Since about two weeks I am trying to compile BATSH. Unfortunately, I don’t have any experience with OCaml nor do I plan to dive into it. All I want is getting BATSH to run, but opam keeps fighting me on that and I don’t know what to do. Here is the output from my most recent try of compiling the software:

-> removed   ocaml-base-compiler.4.03.0
-> installed conf-m4.1
-> installed conf-which.1
-> installed ocaml-base-compiler.4.02.2
-> installed ocaml-config.1
-> installed ocaml.4.02.2
[ERROR] The compilation of dune failed at "/home/opam/.opam/4.03.0/bin/ocaml bootstrap.ml".
-> installed base-ocamlbuild.base
-> installed ocamlbuild.0
-> installed camlp4.4.02+7
-> installed ocamlfind.1.8.1
[ERROR] The compilation of ocp-build failed at "/usr/bin/make".
-> installed base-bytes.base
-> installed herelib.112.35.00
-> installed opam-depext.1.1.3
-> installed depext.transition
-> installed ounit.2.0.8
-> installed pipebang.113.00.00
-> installed type_conv.113.00.02
[ERROR] The compilation of pa_ounit failed at "/usr/bin/make".
-> installed bin_prot.113.00.00
-> installed comparelib.113.00.00
-> installed enumerate.111.08.00
-> installed fieldslib.113.00.00
-> installed sexplib.113.00.00
-> installed pa_structural_sexp.113.00.00
-> installed pa_test.112.24.00
-> installed typerep.113.00.00
-> installed variantslib.109.15.03

#=== ERROR while compiling pa_ounit.113.00.00 =================================#
# context              2.0.5 | linux/x86_64 | ocaml-base-compiler.4.02.2 | https://opam.ocaml.org#679c0435
# path                 ~/.opam/4.03.0/.opam-switch/build/pa_ounit.113.00.00
# command              /usr/bin/make
# exit-code            2
# env-file             ~/.opam/log/pa_ounit-7-51cb9c.env
# output-file          ~/.opam/log/pa_ounit-7-51cb9c.out
### output ###
# [...]
# Warning 40: Pstr_eval was selected from type Parsetree.structure_item_desc.
# It is not visible in the current scope, and will not
# be selected if the type becomes unknown.
# File "src/pa_ounit.ml", line 85, characters 8-15:
# Warning 3: deprecated: String.set
# Use Bytes.set instead.
# File "src/pa_ounit.ml", line 1:
# Error: /home/opam/.opam/4.03.0/lib/ocaml/compiler-libs/pprintast.cmx
# is not a compilation unit description.
# Command exited with code 2.
# E: Failure("Command ''/home/opam/.opam/4.03.0/bin/ocamlbuild' runtime-lib/pa_ounit_lib.cma runtime-lib/pa_ounit_lib.cmxa runtime-lib/pa_ounit_lib.a runtime-lib/pa_ounit_lib.cmxs src/pa_ounit_syntax.cma src/pa_ounit_syntax.cmxa src/pa_ounit_syntax.a src/pa_ounit_syntax.cmxs -use-ocamlfind -tag debug' terminated with error code 10")
# make: *** [Makefile:21: build] Error 1


#=== ERROR while compiling ocp-build.1.99.8-beta ==============================#
# context              2.0.5 | linux/x86_64 | ocaml-base-compiler.4.02.2 | https://opam.ocaml.org#679c0435
# path                 ~/.opam/4.03.0/.opam-switch/build/ocp-build.1.99.8-beta
# command              /usr/bin/make
# exit-code            2
# env-file             ~/.opam/log/ocp-build-7-f802f4.env
# output-file          ~/.opam/log/ocp-build-7-f802f4.out
### output ###
# [...]
# gcc -Wl,-E -o ocamlrun \
#         prims.o libbyterun402.a -lm  -ldl -lcurses -lpthread
# echo "/usr/local/lib/ocaml/stublibs" > ld.conf
# echo "/usr/local/lib/ocaml" >> ld.conf
# make[2]: Leaving directory '/home/opam/.opam/4.03.0/.opam-switch/build/ocp-build.1.99.8-beta/boot/ocamlrun-4.02/byterun'
# ocamlc -o ocp-build.run -custom -make-runtime win32_c.c primitives.ml unix.cma -cclib -lunix -I ocamlrun-4.02/byterun -cclib -lbyterun402
# cat ocp-build.run ocp-build.boot > ocp-build
# chmod +x ocp-build
# ./ocp-build -help >/dev/null 2>&1
# make[1]: *** [Makefile:8: ocp-build] Error 2
# make[1]: Leaving directory '/home/opam/.opam/4.03.0/.opam-switch/build/ocp-build.1.99.8-beta/boot'
# make: *** [Makefile:34: boot/ocp-build] Error 2


#=== ERROR while compiling dune.1.11.4 ========================================#
# context              2.0.5 | linux/x86_64 | ocaml-base-compiler.4.02.2 | https://opam.ocaml.org#679c0435
# path                 ~/.opam/4.03.0/.opam-switch/build/dune.1.11.4
# command              ~/.opam/4.03.0/bin/ocaml bootstrap.ml
# exit-code            2
# env-file             ~/.opam/log/dune-7-62c920.env
# output-file          ~/.opam/log/dune-7-62c920.out
### output ###
# cp src/ocaml-syntax-shims/pp.real.ml src/ocaml-syntax-shims/pp.ml
# cp src/ocaml-syntax-shims/shims.402.ml src/ocaml-syntax-shims/shims.ml
# /home/opam/.opam/4.03.0/bin/ocamllex.opt -q src/ocaml-syntax-shims/let_trail.mll
# /home/opam/.opam/4.03.0/bin/ocamldep.opt -modules src/ocaml-syntax-shims/let_trail.mli src/ocaml-syntax-shims/let_trail.ml src/ocaml-syntax-shims/pp.ml src/ocaml-syntax-shims/shims.ml > boot-depends.txt
# /home/opam/.opam/4.03.0/bin/ocamlopt.opt -g -w -40 -o boot-pp.exe -I +compiler-libs ocamlcommon.cmxa boot_pp.ml
# File "boot_pp.ml", line 1:
# Error: /home/opam/.opam/4.03.0/lib/ocaml/compiler-libs/location.cmx
# is not a compilation unit description.



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build dune      1.11.4
| - build ocp-build 1.99.8-beta
| - build pa_ounit  113.00.00
+-
+- The following changes have been performed (the rest was aborted)
| - downgrade ocaml               4.03.0 to 4.02.2
| - downgrade ocaml-base-compiler 4.03.0 to 4.02.2
| - recompile depext              transition
| - recompile ocaml-config        1
| - recompile opam-depext         1.1.3
| - install   base-bytes          base
| - install   base-ocamlbuild     base
| - install   bin_prot            113.00.00
| - install   camlp4              4.02+7
| - install   comparelib          113.00.00
| - install   conf-m4             1
| - install   conf-which          1
| - install   enumerate           111.08.00
| - install   fieldslib           113.00.00
| - install   herelib             112.35.00
| - install   ocamlbuild          0
| - install   ocamlfind           1.8.1
| - install   ounit               2.0.8
| - install   pa_structural_sexp  113.00.00
| - install   pa_test             112.24.00
| - install   pipebang            113.00.00
| - install   sexplib             113.00.00
| - install   type_conv           113.00.02
| - install   typerep             113.00.00
| - install   variantslib         109.15.03
+-
# Run eval $(opam env) to update the current shell environment

The former state can be restored with:
    opam switch import "/home/opam/.opam/4.03.0/.opam-switch/backup/state-20191116000244.export"
The command '/bin/sh -c /bin/sh -c "opam install --unlock-base -y batsh.0.0.6"' returned a non-zero code: 31

Depending on the compiler version, it gives me different erros. The compiler which does it best, but still fails is ocaml-base-compiler.4.02.2 where it only complains about ocp-build not being able to be compiled(?), as seen in the above error: [ERROR] The compilation of ocp-build failed at "/usr/bin/make". This is ultimately where I am stuck. If I can compile ocp-build successfully on version 4.02.2, it should run.

Here a list of compiler versions I tried to use:

opam switch create 4.04.0 ocaml-base-compiler.4.04.0
opam switch create 4.05.0 ocaml-base-compiler.4.05.0
opam switch create 4.06.0 ocaml-base-compiler.4.06.0
opam switch create 4.07.0 ocaml-base-compiler.4.07.0
opam switch create 4.01.0 ocaml-base-compiler.4.01.0
opam switch create 4.02.0 ocaml-base-compiler.4.02.0
opam switch create 4.02.1 ocaml-base-compiler.4.02.1
opam switch create 4.02.2 ocaml-base-compiler.4.02.2
opam switch create 4.02.3 ocaml-base-compiler.4.02.3
opam switch create 4.03.0 ocaml-base-compiler.4.03.0

None of them work, but 4.02.2 is the best among all non-working compiler versions.

NOTE: Yes, I ran eval $(opam env) all the time.

The errors you are showing look fairly strange; it looks like, from a switch for OCaml 4.03.0, you or opam decided to remove the compiler version 4.03.0 and install instead a 4.02 compiler; then some packages try to use tools at version 4.03.0 at they get into version-incompatibility errors.

You could try to start again from a clean environment, for example by wiping your ~/.opam (assuming there are no other OCaml programs that you care about in it), and starting again.

On my machine, opam install batsh.0.0.6 worked correctly when starting from a 4.01.0 switch. (I first tried my 4.02.3 switch but it is incompatible with the ocp-builder version required by batsh.) I think that what goes wrong is that you use only opam install batsh, instead of opam install batsh.0.0.6; opam notices that the latest version is un-buildable and tries to go with an earlier version. But for experimental software like this (versions 0.0.x), the earlier versions usually have incorrect packaging information that was fixed in later iterations, and it’s no surprise that they don’t build correctly.

First of all, thank you for your help.

I thought the way I did it would wipe this directory anyway, but I will try to explicitly wipe it to be extra sure.

That gives me a lot of hope.

In almost all trials I used in fact opam install batsh.0.0.6.

I noticed that later, too.

Thank you, I hope I can get it to run with the 4.01.0 switch in an entirely clean environment.

In a clean environment, choosing 4.01.0 and installing bash.0.0.6:

The following actions will be performed:
  - install ocamlbuild    0           [required by cmdliner, core]
  - install conf-m4       1           [required by ocamlfind]
  - install camlp4        4.01        [required by batsh]
  - install cmdliner      0.9.8       [required by batsh]
  - install ocamlfind     1.8.1       [required by core]
  - install type_conv     111.13.00   [required by comparelib, bin_prot, custom_printf]
  - install pipebang      110.01.00   [required by core]
  - install ocp-build     1.99.8-beta [required by batsh]
  - install herelib       109.35.02   [required by core]
  - install base-bytes    backport    [required by ounit]
  - install variantslib   109.15.03   [required by core]
  - install sexplib       111.25.00   [required by core]
  - install fieldslib     109.20.03   [required by core]
  - install enumerate     111.08.00   [required by core]
  - install comparelib    109.60.00   [required by core]
  - install bin_prot      111.03.00   [required by core]
  - install ounit         2.0.8       [required by batsh]
  - install pa_test       111.08.00   [required by core]
  - install typerep       111.17.00   [required by core_kernel]
  - install pa_ounit      111.28.00   [required by core]
  - install dlist         0.1.0       [required by batsh]
  - install pa_bench      111.28.00   [required by core]
  - install custom_printf 111.25.00   [required by core]
  - install core_kernel   111.28.00   [required by batsh]
  - install core          111.28.01   [required by batsh]
  - install batsh         0.0.6
===== 26 to install =====

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[cmdliner.0.9.8] downloaded from http://erratique.ch/software/cmdliner/releases/cmdliner-0.9.8.tbz
[bin_prot.111.03.00] downloaded from https://ocaml.janestreet.com/ocaml-core/111.03.00/individual/bin_prot-111.03.00.tar.gz
[batsh.0.0.6] downloaded from https://github.com/BYVoid/Batsh/archive/v0.0.6.tar.gz
[comparelib.109.60.00] downloaded from https://ocaml.janestreet.com/ocaml-core/109.60.00/individual/comparelib-109.60.00.tar.gz
[core_kernel.111.28.00] downloaded from https://ocaml.janestreet.com/ocaml-core/111.28.00/individual/core_kernel-111.28.00.tar.gz
[core.111.28.01] downloaded from https://ocaml.janestreet.com/ocaml-core/111.28.00/individual/core-111.28.01.tar.gz
[custom_printf.111.25.00] downloaded from https://ocaml.janestreet.com/ocaml-core/111.25.00/individual/custom_printf-111.25.00.tar.gz
[enumerate.111.08.00] downloaded from https://ocaml.janestreet.com/ocaml-core/111.08.00/individual/enumerate-111.08.00.tar.gz
[dlist.0.1.0] downloaded from https://github.com/BYVoid/Dlist/archive/v0.1.0.tar.gz
[fieldslib.109.20.03] downloaded from https://ocaml.janestreet.com/ocaml-core/109.20.00/individual/fieldslib-109.20.03.tar.gz
[ocamlfind.1.8.1] downloaded from http://download.camlcity.org/download/findlib-1.8.1.tar.gz
[herelib.109.35.02] downloaded from https://ocaml.janestreet.com/ocaml-core/109.35.00/individual/herelib-109.35.02.tar.gz
[ocp-build.1.99.8-beta] downloaded from http://www.typerex.org/pub/ocp-build/ocp-build.1.99.8-beta.tar.gz
[ounit.2.0.8] downloaded from https://download.ocamlcore.org/ounit/ounit/2.0.8/ounit-2.0.8.tar.gz
[pa_bench.111.28.00] downloaded from https://ocaml.janestreet.com/ocaml-core/111.28.00/individual/pa_bench-111.28.00.tar.gz
[pa_ounit.111.28.00] downloaded from https://ocaml.janestreet.com/ocaml-core/111.28.00/individual/pa_ounit-111.28.00.tar.gz
[pa_test.111.08.00] downloaded from https://ocaml.janestreet.com/ocaml-core/111.08.00/individual/pa_test-111.08.00.tar.gz
[pipebang.110.01.00] downloaded from https://ocaml.janestreet.com/ocaml-core/110.01.00/individual/pipebang-110.01.00.tar.gz
[sexplib.111.25.00] downloaded from https://ocaml.janestreet.com/ocaml-core/111.25.00/individual/sexplib-111.25.00.tar.gz
[type_conv.111.13.00] downloaded from https://ocaml.janestreet.com/ocaml-core/111.13.00/individual/type_conv-111.13.00.tar.gz
[typerep.111.17.00] downloaded from https://ocaml.janestreet.com/ocaml-core/111.17.00/individual/typerep-111.17.00.tar.gz
[variantslib.109.15.03] downloaded from https://ocaml.janestreet.com/ocaml-core/109.15.00/individual/variantslib-109.15.03.tar.gz

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed camlp4.4.01
-> installed ocamlbuild.0
-> installed conf-m4.1
-> installed cmdliner.0.9.8
-> installed ocamlfind.1.8.1
-> installed base-bytes.backport
[ERROR] The compilation of ocp-build failed at "/usr/bin/make".
-> installed pipebang.110.01.00
-> installed herelib.109.35.02
-> installed type_conv.111.13.00
-> installed ounit.2.0.8
-> installed comparelib.109.60.00
-> installed enumerate.111.08.00
-> installed fieldslib.109.20.03
-> installed variantslib.109.15.03
-> installed bin_prot.111.03.00
-> installed pa_ounit.111.28.00
-> installed pa_bench.111.28.00
-> installed sexplib.111.25.00
-> installed pa_test.111.08.00
-> installed custom_printf.111.25.00
-> installed typerep.111.17.00
-> installed core_kernel.111.28.00
-> installed core.111.28.01

#=== ERROR while compiling ocp-build.1.99.8-beta ==============================#
# context              2.0.5 | linux/x86_64 | ocaml-base-compiler.4.01.0 | git+file:///home/opam/opam-repository
# path                 ~/.opam/4.01.0/.opam-switch/build/ocp-build.1.99.8-beta
# command              /usr/bin/make
# exit-code            2
# env-file             ~/.opam/log/ocp-build-6-83ba5a.env
# output-file          ~/.opam/log/ocp-build-6-83ba5a.out
### output ###
# /usr/bin/make -C boot
# make[1]: Entering directory '/home/opam/.opam/4.01.0/.opam-switch/build/ocp-build.1.99.8-beta/boot'
# awk '{ print "external "$1": unit -> unit = \"" $1 "\"" }' primitives > primitives.ml
# ./make-ocpbuild-run.sh
# ocamlc -o ocp-build.run -custom -make-runtime win32_c.c primitives.ml unix.cma -cclib -lunix
# cat ocp-build.run ocp-build.boot > ocp-build
# chmod +x ocp-build
# ./ocp-build -help >/dev/null 2>&1
# make[1]: *** [Makefile:8: ocp-build] Error 2
# make[1]: Leaving directory '/home/opam/.opam/4.01.0/.opam-switch/build/ocp-build.1.99.8-beta/boot'
# make: *** [Makefile:34: boot/ocp-build] Error 2



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build ocp-build 1.99.8-beta
+-
+- The following changes have been performed (the rest was aborted)
| - install base-bytes    backport
| - install bin_prot      111.03.00
| - install camlp4        4.01
| - install cmdliner      0.9.8
| - install comparelib    109.60.00
| - install conf-m4       1
| - install core          111.28.01
| - install core_kernel   111.28.00
| - install custom_printf 111.25.00
| - install enumerate     111.08.00
| - install fieldslib     109.20.03
| - install herelib       109.35.02
| - install ocamlbuild    0
| - install ocamlfind     1.8.1
| - install ounit         2.0.8
| - install pa_bench      111.28.00
| - install pa_ounit      111.28.00
| - install pa_test       111.08.00
| - install pipebang      110.01.00
| - install sexplib       111.25.00
| - install type_conv     111.13.00
| - install typerep       111.17.00
| - install variantslib   109.15.03
+-
# Run eval $(opam env) to update the current shell environment

The former state can be restored with:
    opam switch import "/home/opam/.opam/4.01.0/.opam-switch/backup/state-20191118141152.export"
The command '/bin/sh -c opam install batsh.0.0.6' returned a non-zero code: 31

Compiling from source, after a couple of further fixes:

Compiler: ocaml 4.01.0
Error with package "batsh-lib", file "bash_ast.ml":
   Syntax "sexplib-syntax" was not in 'requires' of package.
Error with package "batsh-lib", file "batsh_ast.ml":
   Syntax "sexplib-syntax" was not in 'requires' of package.
Error with package "batsh-lib", file "symbol_table.ml":
   Syntax "sexplib-syntax" was not in 'requires' of package.
Error with package "batsh-lib", file "symbol_table.mli":
   Syntax "sexplib-syntax" was not in 'requires' of package.
Error with package "batsh-lib", file "winbat_ast.ml":
   Syntax "sexplib-syntax" was not in 'requires' of package.
0.01s _obuild/batsh-lib/bash.mlmods                                    [ done ]
0.02s _obuild/batsh-lib/bash.mlimods                                   [ done ]
0.02s _obuild/batsh-lib/bash_compile.mlmods                            [ done ]
0.02s _obuild/batsh-lib/bash_format.mlmods                             [ done ]
0.02s _obuild/batsh-lib/bash_functions.mlmods                          [ done ]
0.02s _obuild/batsh-lib/bash_transform.mlmods                          [ done ]
0.22s _obuild/batsh-lib/_temp/bash_ast.mlpp                            [failed]
[15.1] Command failed: 'camlp4o' './src/bash_ast.ml'
-- stderr for ./_obuild/batsh-lib/_temp/bash_ast.mlpp --
File "./src/bash_ast.ml", line 50, characters 17-21:
Parse error: [semi] expected after [str_item] (in [implem])
0.19s _obuild/batsh-lib/_temp/batsh_ast.mlpp                           [failed]
[41.1] Command failed: 'camlp4o' './src/batsh_ast.ml'
-- stderr for ./_obuild/batsh-lib/_temp/batsh_ast.mlpp --
File "./src/batsh_ast.ml", line 44, characters 17-21:
Parse error: [semi] expected after [str_item] (in [implem])
2 errors in 0.60s. 8 jobs (parallelism 0.9x), 8 files generated.
Error log:
Error:
[15.1] 'camlp4o' './src/bash_ast.ml'

File "./src/bash_ast.ml", line 50, characters 17-21:
Parse error: [semi] expected after [str_item] (in [implem])

Error:
[41.1] 'camlp4o' './src/batsh_ast.ml'

File "./src/batsh_ast.ml", line 44, characters 17-21:
Parse error: [semi] expected after [str_item] (in [implem])

make: *** [Makefile:3: build] Error 2

It seem abandoned, and I opened an issue to migrate off camlp4 some time ago.

I know, I studied the project just to get it run. Yet, it still does not run. That said, as long as it works, it does not matter much if it is abandoned or not, since BASH and/or BATCH won’t change significantly anytime soon. They are so old, I’d wonder if they would change anything, really. And even if that would happen, no distribution would suddenly run the absolutely newest version of BASH, for example. Therefore, it’s good as it is.

Did you manage to run BATSH successfully? If yes, how did you do that?

On my machine the batsh binary seems to work correctly – it displays a help/usage message.

What fails in your 4.01 log is that ocp-builder does not build correctly – it’s not a problem with the batsh codebase itself. I suppose that this old version of ocp-builder (batsh claims to be incompatible with more recent versions) has a bug that makes it fail on your system.

Personally I would think that trying lots of tweaks may not be the most efficient approach to get the software in a workable state for you. It could be nicer to make a change that is reasonable for the long term, so that if that change works it can be relied upon by other interested users. For example, if ocp-builder is the problem, it sounds reasonable to try to use a different build system instead – I would try with plain old make, which is going to work well even under the old version of OCaml that batsh currently requires. The batsh codebase does not look that complicated, so it shouldn’t be a lot of work – for someone that knows enough OCaml to understand what the current build system does.

Have you considered contacting the original authors of the software to ask them to make that change? (Or: to port the software on a more recent version of OCaml that has a working ocp-builder for your system.) This sounds like a good solution for many people: they would update the upstream repository with a better version, it would take them less effort than it takes you (not being familiar with OCaml), and they get to hear of people interested in their software, which is always nice.

Unfortunately, as @XVilka already implied, there does not seem to be any interest left in maintaining the project from the author’s perspective.

I believe that, but I don’t know how much I would need to study OCaml just to get this run. I don’t know if it would be worth the effort. On the other hand, I don’t know any other project that might get the job done equivalently or even better. So maybe I have no choice but to. At least I am familiar with programming overall and know some stuff, it’s just OCaml itself that is holding me back, especially since I am currently already learning 2 languages (Nim and Julia) intensely and I also need/learn/use Java since years. Adding another language to my mix does not exactly make my life easier. :sweat_smile:

Well, I will have at least a look at ocp-builder and see if I can brainstorm some ideas. Let’s see.

Did you send a direct email to the authors to check? Unless you do, I don’t think you can reasonably make a guess about what they are interested or not in doing to help people use their software. In particular, you can’t assume that people maintain in the same way if they don’t know that anyone is using their software vs. if they hear from interested users.

1 Like

You are right. Though I had bad experiences with this. The last time someone contacted the author of an abandonend project, he actually archived the Github repository, without any answer or further notice. Clearly shrugging off this project entirely.

Author doen’t respond to the issues opened long time ago. So I wouldn’t expect anything to be done. Sorry for shattering any hope, but that’s how it usually works.

I know that myself as a maintainer am more likely to respond to a direct email than to a Github issue, especially if the person opening the issue does not seem to be using the project themselves. I invest work when I understand there is user demand, an issue like “hey this technology is deprectated, please stop using it” is not going to motivate me enormously.

Beside, I think that whether the project uses Camlp4 or not is sort of beside the point here. We should be able to keep using software that was written in the past using Camlp4, there is nothing about it that makes it unfit to run on modern processors, and if I remember correctly we have a maintainer willing to keep it working-as-usual in the medium term.

Being able to use it under a more recent OCaml version than 4.01 (released in September 2013; note that 4.01 still works just fine on my machine at least) would be a plus, and I think it was not the best choice of original authors to use ocp-build, a niche build system that, unless I’m mistaken, was never officially released to the public. It is fairly likely that these two aspects (supporting more recent OCaml releases, and at least supporting newer ocp-builder version) can be improved upon with fairly little work, especially if people already familiar with the codebase do it. (Migrating off Camlp4 may also be fairly easy, if the deriving plugins they use exist for the ppx versions, but again I don’t think this is the main obstacle to run the software.)

1 Like

@gasche
Fully agree with you. And again, the software is mainly bound to play well with Bash and Batch. These two languages are pretty much carved into the stone anyway. So I don’t see a real need in keeping Batsh rigorously up to date.

You can try to build it inside a Docker, statically compile with musl, so it should produce one binary you can run almost everywhere.

@XVilka

Just amazing. :rofl:

I didn’t tell the whole truth: all this is happening in Docker. I wanted to make a BATSH Docker version, that always runs, no matter where and how.

Can you put your Dockerfile in gist? Maybe we can help.

I tried using Debian native opam1, opam2 and official base opam image from OCaml. I will upload the Dockerfiles, when I have the time to. Right now I have to go. But sure, I’ll do it. Thanks for your help, anyway.

I started port to Dune, getting rid of Camlp4, etc: https://github.com/XVilka/Batsh/tree/dune

The only problem I don’t know how to solve yet - is the using t_of_sexp deriving for Hashtbl.t:

type variable_table = (string, variable_entry) Hashtbl.t [@@deriving sexp]

It gives me error:
Error: Unbound value Hashtbl.t_of_sexp

https://github.com/XVilka/Batsh/blob/dune/lib/symbol_table.ml#L10

Hey @XVilka I just started trying to port it as well. I just finished migrating the author’s Dlist (which seems to be a dependency) to OCaml 4.08 (https://github.com/darrenldl/Dlist), or at least to a buildable state.

Mind if I message you to discuss more?

I ended up changing the type to use Hashtbl.Poly.t, which provides a t_of_sexp implementation as documented here if I’m reading it correctly. But would like to get some second opinions on whether this the right choice regardless.