Something is odd with recent dune version w.r.t to cross compilation. It looks like ppx executables are compiled using the target toolchain (windows here) instead of the host toolchain.
Reproduction steps:
$ docker run -t -i --entrypoint /bin/bash savonet/liquidsoap-win32-base-x64
# su opam -c /bin/bash
$ opam install dune.1.11.4 sedlex-windows
$ cd /tmp
$ git clone https://github.com/ocaml-community/sedlex.git
$ cd sedlex/examples
$ eval $(opam env)
--> This works:
$ OCAMLFIND_TOOLCHAIN=windows ocamlfind ocamlopt -package sedlex.ppx -linkpkg ./tokenizer.ml -o tokenizer.exe
--> This does not:
$ opam install dune.2.6.2
$ OCAMLFIND_TOOLCHAIN=windows ocamlfind ocamlopt -package sedlex.ppx -linkpkg ./tokenizer.ml -o tokenizer.exe
/home/opam/.opam/4.08.0/windows-sysroot/lib/sedlex/ppx/./ppx.exe: 1: /home/opam/.opam/4.08.0/windows-sysroot/lib/sedlex/ppx/./ppx.exe: MZ����@���: not found
/home/opam/.opam/4.08.0/windows-sysroot/lib/sedlex/ppx/./ppx.exe: 1: /home/opam/.opam/4.08.0/windows-sysroot/lib/sedlex/ppx/./ppx.exe: Syntax error: word unexpected (expecting ")")
File "./tokenizer.ml", line 1:
Error: Error while running external preprocessor
Command line: /home/opam/.opam/4.08.0/windows-sysroot/lib/sedlex/ppx/./ppx.exe --as-ppx '/tmp/camlppxe0abe3' '/tmp/camlppxd0e883'
Something is odd with recent
duneversion w.r.t to cross compilation. It looks likeppxexecutables are compiled using the target toolchain (windowshere) instead of the host toolchain.Reproduction steps: