Adding a package to one of the opam-cross-* repositories (I’m especially interested by https://github.com/whitequark/opam-cross-windows ) was super easy when all invocations to the compiler were going throw ocamlfind:
Thanks to a file ~/.opam/4.04.0/lib/findlib.conf.d/windows.conf defining
path(windows) = "/home/pirbo/.opam/4.04.0/windows-sysroot/lib"
destdir(windows) = "/home/pirbo/.opam/4.04.0/windows-sysroot/lib"
stdlib(windows) = "/home/pirbo/.opam/4.04.0/windows-sysroot/lib/ocaml"
ocamlc(windows) = "/home/pirbo/.opam/4.04.0/windows-sysroot/bin/ocamlc"
you were just adding
env OCAMLFIND_TOOLCHAIN=windows before your
ocamlbuild/… invocation and the library was cross-compiled!
But because Earth never stops turning, everybody now move to jbuilder. I naively tried
env OCAMLFIND_TOOLCHAIN=windows jbuilder build -p biniou but of course
ocamlopt bin/bdump.exe (exit 2)
(cd _build/default && /home/pirbo/.opam/4.04.0/bin/ocamlopt.opt -w -40 -g -o bin/bdump.exe -I /home/pirbo/.opam/4.04.0/windows-sysroot/lib/bytes -I /home/pirbo/.opam/4.04.0/windows-sysroot/lib/easy-format -I src easy_format.cmx biniou.cmxa bin/bdump.cmx)
File "_none_", line 1:
Error: Files /home/pirbo/.opam/4.04.0/windows-sysroot/lib/easy-format/easy_format.cmx
make inconsistent assumptions over implementation Printf
So, what is the trendy way to cross-compile?