Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-compiling sedlex (ppx) for windows #2252

Closed
toots opened this issue Jun 6, 2019 · 20 comments · Fixed by ocaml/opam-repository#14567
Closed

Cross-compiling sedlex (ppx) for windows #2252

toots opened this issue Jun 6, 2019 · 20 comments · Fixed by ocaml/opam-repository#14567

Comments

@toots
Copy link
Contributor

toots commented Jun 6, 2019

Hi,

I'm trying to cross-compile sedlex for windows, following the usual pattern outlined here.

I get a binary ppx.exe that compiled for windows instead of the compiling host. It is my understanding that this should not be the case. Is there anything that I am doing wrong?

Here's the log of the build. Dune files are the ones from the sedlex repo linked above.

+ /home/opam/.opam/4.07.0/bin/dune "build" "-x" "windows" "--verbose" "-p" "sedlex" "-j" "1" (CWD=/home/opam/.opam/4.07.0/.opam-switch/build/sedlex-windows.2.0)
- # Workspace root: /home/opam/.opam/4.07.0/.opam-switch/build/sedlex-windows.2.0
- Running[0]: /home/opam/.opam/4.07.0/bin/ocamlc.opt -config > /tmp/dunec62a3b.output
- Running[1]: /home/opam/.opam/4.07.0/bin/ocamlfind printconf conf > /tmp/dunedf4041.output
- Running[2]: /home/opam/.opam/4.07.0/bin/ocamlfind -toolchain windows printconf path > /tmp/dune27edc1.output
- Running[3]: /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -config > /tmp/dunedb84a4.output
- # # Workspace root: /home/opam/.opam/4.07.0/.opam-switch/build/sedlex-windows.2.0
- # Dune context:
- #  ((name default)
- #   (kind default)
- #   (profile release)
- #   (merlin true)
- #   (for_host ())
- #   (build_dir (In_build_dir default))
- #   (toplevel_path ((External /home/opam/.opam/4.07.0/lib/toplevel)))
- #   (ocaml_bin (External /home/opam/.opam/4.07.0/bin))
- #   (ocaml (External /home/opam/.opam/4.07.0/bin/ocaml))
- #   (ocamlc (External /home/opam/.opam/4.07.0/bin/ocamlc.opt))
- #   (ocamlopt ((External /home/opam/.opam/4.07.0/bin/ocamlopt.opt)))
- #   (ocamldep (External /home/opam/.opam/4.07.0/bin/ocamldep.opt))
- #   (ocamlmklib (External /home/opam/.opam/4.07.0/bin/ocamlmklib.opt))
- #   (env
- #    ((DUNE_CONFIGURATOR /home/opam/.opam/4.07.0/bin/ocamlc.opt)
- #     (INSIDE_DUNE 1)
- #     (OCAMLFIND_IGNORE_DUPS_IN
- #      /home/opam/.opam/4.07.0/.opam-switch/build/sedlex-windows.2.0/_build/install/default/lib)
- #     (OCAMLPATH
- #      /home/opam/.opam/4.07.0/.opam-switch/build/sedlex-windows.2.0/_build/install/default/lib)))
- #   (findlib_path ((External /home/opam/.opam/4.07.0/lib)))
- #   (arch_sixtyfour true)
- #   (natdynlink_supported true)
- #   (supports_shared_libraries true)
- #   (opam_vars ())
- #   (ocaml_config
- #    ((version 4.07.0)
- #     (standard_library_default /home/opam/.opam/4.07.0/lib/ocaml)
- #     (standard_library /home/opam/.opam/4.07.0/lib/ocaml)
- #     (standard_runtime /home/opam/.opam/4.07.0/bin/ocamlrun)
- #     (ccomp_type cc)
- #     (c_compiler gcc)
- #     (ocamlc_cflags
- #      (-std=gnu99 -O2 -fno-strict-aliasing -fwrapv -fno-builtin-memcmp -fPIC))
- #     (ocamlopt_cflags
- #      (-std=gnu99 -O2 -fno-strict-aliasing -fwrapv -fno-builtin-memcmp))
- #     (bytecomp_c_compiler
- #      (gcc
- #       -std=gnu99
- #       -O2
- #       -fno-strict-aliasing
- #       -fwrapv
- #       -fno-builtin-memcmp
- #       -fPIC
- #       -D_FILE_OFFSET_BITS=64
- #       -D_REENTRANT))
- #     (bytecomp_c_libraries (-lm -ldl -lpthread))
- #     (native_c_compiler
- #      (gcc
- #       -std=gnu99
- #       -O2
- #       -fno-strict-aliasing
- #       -fwrapv
- #       -fno-builtin-memcmp
- #       -D_FILE_OFFSET_BITS=64
- #       -D_REENTRANT))
- #     (native_c_libraries (-lm -ldl))
- #     (cc_profile (-pg))
- #     (architecture amd64)
- #     (model default)
- #     (int_size 63)
- #     (word_size 64)
- #     (system linux)
- #     (asm (as))
- #     (asm_cfi_supported true)
- #     (with_frame_pointers false)
- #     (ext_exe )
- #     (ext_obj .o)
- #     (ext_asm .s)
- #     (ext_lib .a)
- #     (ext_dll .so)
- #     (os_type Unix)
- #     (default_executable_name a.out)
- #     (systhread_supported true)
- #     (host x86_64-unknown-linux-gnu)
- #     (target x86_64-unknown-linux-gnu)
- #     (profiling true)
- #     (flambda false)
- #     (spacetime false)
- #     (safe_string false)
- #     (exec_magic_number Caml1999X023)
- #     (cmi_magic_number Caml1999I023)
- #     (cmo_magic_number Caml1999O023)
- #     (cma_magic_number Caml1999A023)
- #     (cmx_magic_number Caml1999Y023)
- #     (cmxa_magic_number Caml1999Z023)
- #     (ast_impl_magic_number Caml1999M023)
- #     (ast_intf_magic_number Caml1999N023)
- #     (cmxs_magic_number Caml1999D023)
- #     (cmt_magic_number Caml1999T023)
- #     (natdynlink_supported true)
- #     (supports_shared_libraries true)
- #     (windows_unicode false)))
- #   (which
- #    ((ocaml ((External /home/opam/.opam/4.07.0/bin/ocaml)))
- #     (ocamlc ((External /home/opam/.opam/4.07.0/bin/ocamlc.opt)))
- #     (ocamlfind ((External /home/opam/.opam/4.07.0/bin/ocamlfind)))
- #     (ocamlobjinfo ((External /home/opam/.opam/4.07.0/bin/ocamlobjinfo.opt))))))
- # # # Workspace root: /home/opam/.opam/4.07.0/.opam-switch/build/sedlex-windows.2.0
- # # Dune context:
- # #  ((name default)
- # #   (kind default)
- # #   (profile release)
- # #   (merlin true)
- # #   (for_host ())
- # #   (build_dir (In_build_dir default))
- # #   (toplevel_path ((External /home/opam/.opam/4.07.0/lib/toplevel)))
- # #   (ocaml_bin (External /home/opam/.opam/4.07.0/bin))
- # #   (ocaml (External /home/opam/.opam/4.07.0/bin/ocaml))
- # #   (ocamlc (External /home/opam/.opam/4.07.0/bin/ocamlc.opt))
- # #   (ocamlopt ((External /home/opam/.opam/4.07.0/bin/ocamlopt.opt)))
- # #   (ocamldep (External /home/opam/.opam/4.07.0/bin/ocamldep.opt))
- # #   (ocamlmklib (External /home/opam/.opam/4.07.0/bin/ocamlmklib.opt))
- # #   (env
- # #    ((DUNE_CONFIGURATOR /home/opam/.opam/4.07.0/bin/ocamlc.opt)
- # #     (INSIDE_DUNE 1)
- # #     (OCAMLFIND_IGNORE_DUPS_IN
- # #      /home/opam/.opam/4.07.0/.opam-switch/build/sedlex-windows.2.0/_build/install/default/lib)
- # #     (OCAMLPATH
- # #      /home/opam/.opam/4.07.0/.opam-switch/build/sedlex-windows.2.0/_build/install/default/lib)))
- # #   (findlib_path ((External /home/opam/.opam/4.07.0/lib)))
- # #   (arch_sixtyfour true)
- # #   (natdynlink_supported true)
- # #   (supports_shared_libraries true)
- # #   (opam_vars ())
- # #   (ocaml_config
- # #    ((version 4.07.0)
- # #     (standard_library_default /home/opam/.opam/4.07.0/lib/ocaml)
- # #     (standard_library /home/opam/.opam/4.07.0/lib/ocaml)
- # #     (standard_runtime /home/opam/.opam/4.07.0/bin/ocamlrun)
- # #     (ccomp_type cc)
- # #     (c_compiler gcc)
- # #     (ocamlc_cflags
- # #      (-std=gnu99 -O2 -fno-strict-aliasing -fwrapv -fno-builtin-memcmp -fPIC))
- # #     (ocamlopt_cflags
- # #      (-std=gnu99 -O2 -fno-strict-aliasing -fwrapv -fno-builtin-memcmp))
- # #     (bytecomp_c_compiler
- # #      (gcc
- # #       -std=gnu99
- # #       -O2
- # #       -fno-strict-aliasing
- # #       -fwrapv
- # #       -fno-builtin-memcmp
- # #       -fPIC
- # #       -D_FILE_OFFSET_BITS=64
- # #       -D_REENTRANT))
- # #     (bytecomp_c_libraries (-lm -ldl -lpthread))
- # #     (native_c_compiler
- # #      (gcc
- # #       -std=gnu99
- # #       -O2
- # #       -fno-strict-aliasing
- # #       -fwrapv
- # #       -fno-builtin-memcmp
- # #       -D_FILE_OFFSET_BITS=64
- # #       -D_REENTRANT))
- # #     (native_c_libraries (-lm -ldl))
- # #     (cc_profile (-pg))
- # #     (architecture amd64)
- # #     (model default)
- # #     (int_size 63)
- # #     (word_size 64)
- # #     (system linux)
- # #     (asm (as))
- # #     (asm_cfi_supported true)
- # #     (with_frame_pointers false)
- # #     (ext_exe )
- # #     (ext_obj .o)
- # #     (ext_asm .s)
- # #     (ext_lib .a)
- # #     (ext_dll .so)
- # #     (os_type Unix)
- # #     (default_executable_name a.out)
- # #     (systhread_supported true)
- # #     (host x86_64-unknown-linux-gnu)
- # #     (target x86_64-unknown-linux-gnu)
- # #     (profiling true)
- # #     (flambda false)
- # #     (spacetime false)
- # #     (safe_string false)
- # #     (exec_magic_number Caml1999X023)
- # #     (cmi_magic_number Caml1999I023)
- # #     (cmo_magic_number Caml1999O023)
- # #     (cma_magic_number Caml1999A023)
- # #     (cmx_magic_number Caml1999Y023)
- # #     (cmxa_magic_number Caml1999Z023)
- # #     (ast_impl_magic_number Caml1999M023)
- # #     (ast_intf_magic_number Caml1999N023)
- # #     (cmxs_magic_number Caml1999D023)
- # #     (cmt_magic_number Caml1999T023)
- # #     (natdynlink_supported true)
- # #     (supports_shared_libraries true)
- # #     (windows_unicode false)))
- # #   (which
- # #    ((ocaml ((External /home/opam/.opam/4.07.0/bin/ocaml)))
- # #     (ocamlc ((External /home/opam/.opam/4.07.0/bin/ocamlc.opt)))
- # #     (ocamlfind ((External /home/opam/.opam/4.07.0/bin/ocamlfind)))
- # #     (ocamlobjinfo ((External /home/opam/.opam/4.07.0/bin/ocamlobjinfo.opt))))))
- # Dune context:
- #  ((name default.windows)
- #   (kind default)
- #   (profile release)
- #   (merlin false)
- #   (for_host (default))
- #   (build_dir (In_build_dir default.windows))
- #   (toplevel_path ((External /home/opam/.opam/4.07.0/lib/toplevel)))
- #   (ocaml_bin (External /home/opam/.opam/4.07.0/windows-sysroot/bin))
- #   (ocaml (External /home/opam/.opam/4.07.0/bin/ocaml))
- #   (ocamlc (External /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc))
- #   (ocamlopt ((External /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt)))
- #   (ocamldep (External /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep))
- #   (ocamlmklib
- #    (External /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlmklib))
- #   (env
- #    ((DUNE_CONFIGURATOR /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc)
- #     (INSIDE_DUNE 1)
- #     (OCAMLFIND_IGNORE_DUPS_IN
- #      /home/opam/.opam/4.07.0/.opam-switch/build/sedlex-windows.2.0/_build/install/default.windows/lib)
- #     (OCAMLPATH
- #      /home/opam/.opam/4.07.0/.opam-switch/build/sedlex-windows.2.0/_build/install/default.windows/lib)
- #     (destdir /home/opam/.opam/4.07.0/windows-sysroot/lib)
- #     (ocamlc /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc)
- #     (ocamlcp /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlcp)
- #     (ocamldep /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep)
- #     (ocamldoc /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldoc)
- #     (ocamlmklib /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlmklib)
- #     (ocamlmktop /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlmktop)
- #     (ocamlopt /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt)
- #     (path /home/opam/.opam/4.07.0/windows-sysroot/lib)
- #     (stdlib /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml)))
- #   (findlib_path ((External /home/opam/.opam/4.07.0/windows-sysroot/lib)))
- #   (arch_sixtyfour true)
- #   (natdynlink_supported true)
- #   (supports_shared_libraries true)
- #   (opam_vars ())
- #   (ocaml_config
- #    ((version 4.07.0)
- #     (standard_library_default
- #      /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml)
- #     (standard_library /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml)
- #     (standard_runtime ocamlrun)
- #     (ccomp_type cc)
- #     (c_compiler /usr/src/mxe/usr/bin/x86_64-w64-mingw32.static-gcc)
- #     (ocamlc_cflags (-O2 -mms-bitfields))
- #     (ocamlopt_cflags (-O2 -mms-bitfields))
- #     (bytecomp_c_compiler
- #      (/usr/src/mxe/usr/bin/x86_64-w64-mingw32.static-gcc -O2 -mms-bitfields))
- #     (bytecomp_c_libraries (-lws2_32 -lversion))
- #     (native_c_compiler
- #      (/usr/src/mxe/usr/bin/x86_64-w64-mingw32.static-gcc -O2 -mms-bitfields))
- #     (native_c_libraries (-lws2_32 -lversion))
- #     (cc_profile (-pg))
- #     (architecture amd64)
- #     (model default)
- #     (int_size 63)
- #     (word_size 64)
- #     (system mingw64)
- #     (asm (/usr/src/mxe/usr/bin/x86_64-w64-mingw32.static-as))
- #     (asm_cfi_supported false)
- #     (with_frame_pointers false)
- #     (ext_exe .exe)
- #     (ext_obj .o)
- #     (ext_asm .s)
- #     (ext_lib .a)
- #     (ext_dll .dll)
- #     (os_type Win32)
- #     (default_executable_name camlprog.exe)
- #     (systhread_supported true)
- #     (host )
- #     (target x86_64-w64-mingw32)
- #     (profiling false)
- #     (flambda false)
- #     (spacetime false)
- #     (safe_string false)
- #     (exec_magic_number Caml1999X023)
- #     (cmi_magic_number Caml1999I023)
- #     (cmo_magic_number Caml1999O023)
- #     (cma_magic_number Caml1999A023)
- #     (cmx_magic_number Caml1999Y023)
- #     (cmxa_magic_number Caml1999Z023)
- #     (ast_impl_magic_number Caml1999M023)
- #     (ast_intf_magic_number Caml1999N023)
- #     (cmxs_magic_number Caml1999D023)
- #     (cmt_magic_number Caml1999T023)
- #     (natdynlink_supported true)
- #     (supports_shared_libraries true)
- #     (windows_unicode true)))
- #   (which
- #    ((ocaml ((External /home/opam/.opam/4.07.0/bin/ocaml)))
- #     (ocamlc ((External /home/opam/.opam/4.07.0/bin/ocamlc.opt)))
- #     (ocamlfind ((External /home/opam/.opam/4.07.0/bin/ocamlfind)))
- #     (ocamlobjinfo ((External /home/opam/.opam/4.07.0/bin/ocamlobjinfo.opt))))))
- # Actual targets:
- # -  alias @./default
- Running[4]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep -modules -intf src/lib/sedlexing.mli) > _build/default.windows/src/lib/.sedlex.objs/sedlexing.mli.d
- Running[5]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w +A-4-9 -safe-string -g -bin-annot -I src/lib/.sedlex.objs/byte -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -no-alias-deps -o src/lib/.sedlex.objs/byte/sedlexing.cmi -c -intf src/lib/sedlexing.mli)
- Running[6]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep -modules -impl src/lib/sedlexing.ml) > _build/default.windows/src/lib/.sedlex.objs/sedlexing.ml.d
- Running[7]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w +A-4-9 -safe-string -g -bin-annot -I src/lib/.sedlex.objs/byte -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -intf-suffix .ml -no-alias-deps -o src/lib/.sedlex.objs/byte/sedlexing.cmo -c -impl src/lib/sedlexing.ml)
- Running[8]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w +A-4-9 -safe-string -g -a -o src/lib/sedlex.cma src/lib/.sedlex.objs/byte/sedlexing.cmo)
- Running[9]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w -49 -nopervasives -nostdlib -g -bin-annot -I src/syntax/.sedlex_ppx.objs/byte -no-alias-deps -o src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx.cmo -c -impl src/syntax/sedlex_ppx.ml-gen)
- Running[10]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -w -40 -w -49 -nopervasives -nostdlib -g -I src/syntax/.sedlex_ppx.objs/byte -I src/syntax/.sedlex_ppx.objs/native -intf-suffix .ml-gen -no-alias-deps -o src/syntax/.sedlex_ppx.objs/native/sedlex_ppx.cmx -c -impl src/syntax/sedlex_ppx.ml-gen)
- Running[11]: (cd _build/default && /home/opam/.opam/4.07.0/bin/ocamlopt.opt -o .ppx/112fe19966b0154286a2a2d1d0aa7d7f/ppx.exe -I /home/opam/.opam/4.07.0/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/lib/ppx_tools_versioned/metaquot_405 -I /home/opam/.opam/4.07.0/lib/result /home/opam/.opam/4.07.0/lib/ocaml/compiler-libs/ocamlcommon.cmxa /home/opam/.opam/4.07.0/lib/result/result.cmxa /home/opam/.opam/4.07.0/lib/ocaml-migrate-parsetree/migrate_parsetree.cmxa /home/opam/.opam/4.07.0/lib/ppx_tools_versioned/ppx_tools_versioned.cmxa /home/opam/.opam/4.07.0/lib/ppx_tools_versioned/metaquot_405/ppx_tools_versioned_metaquot_405.cmxa .ppx/112fe19966b0154286a2a2d1d0aa7d7f/ppx.ml)
- Running[12]: (cd _build/default.windows && ../default/.ppx/112fe19966b0154286a2a2d1d0aa7d7f/ppx.exe --cookie 'library-name="sedlex_ppx"' -o src/syntax/sedlex.pp.mli --intf src/syntax/sedlex.mli --dump-ast)
- Running[13]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep -modules -intf src/syntax/sedlex.pp.mli) > _build/default.windows/src/syntax/.sedlex_ppx.objs/sedlex.pp.mli.d
- Running[14]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -w -40 -w +A-4-9 -safe-string -g -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -intf-suffix .ml -no-alias-deps -o src/lib/.sedlex.objs/native/sedlexing.cmx -c -impl src/lib/sedlexing.ml)
- Running[15]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -w -40 -w +A-4-9 -safe-string -g -a -o src/lib/sedlex.cmxa src/lib/.sedlex.objs/native/sedlexing.cmx)
- Running[16]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -w -40 -w +A-4-9 -safe-string -g -shared -linkall -I src/lib -o src/lib/sedlex.cmxs src/lib/sedlex.cmxa)
- Running[17]: (cd _build/default.windows && ../default/.ppx/112fe19966b0154286a2a2d1d0aa7d7f/ppx.exe --cookie 'library-name="sedlex_ppx"' -o src/syntax/sedlex.pp.ml --impl src/syntax/sedlex.ml --dump-ast)
- Running[18]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep -modules -impl src/syntax/sedlex.pp.ml) > _build/default.windows/src/syntax/.sedlex_ppx.objs/sedlex.pp.ml.d
- Running[19]: (cd _build/default.windows && ../default/.ppx/112fe19966b0154286a2a2d1d0aa7d7f/ppx.exe --cookie 'library-name="sedlex_ppx"' -o src/syntax/sedlex_cset.pp.mli --intf src/syntax/sedlex_cset.mli --dump-ast)
- Running[20]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep -modules -intf src/syntax/sedlex_cset.pp.mli) > _build/default.windows/src/syntax/.sedlex_ppx.objs/sedlex_cset.pp.mli.d
- Running[21]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w -9 -g -bin-annot -I src/syntax/.sedlex_ppx.objs/byte -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Sedlex_cset.cmi -c -intf src/syntax/sedlex_cset.pp.mli)
- Running[22]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w -9 -g -bin-annot -I src/syntax/.sedlex_ppx.objs/byte -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Sedlex.cmi -c -intf src/syntax/sedlex.pp.mli)
- Running[23]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w -9 -g -bin-annot -I src/syntax/.sedlex_ppx.objs/byte -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -intf-suffix .ml -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Sedlex.cmo -c -impl src/syntax/sedlex.pp.ml)
- Running[24]: (cd _build/default.windows && ../default/.ppx/112fe19966b0154286a2a2d1d0aa7d7f/ppx.exe --cookie 'library-name="sedlex_ppx"' -o src/syntax/sedlex_cset.pp.ml --impl src/syntax/sedlex_cset.ml --dump-ast)
- Running[25]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep -modules -impl src/syntax/sedlex_cset.pp.ml) > _build/default.windows/src/syntax/.sedlex_ppx.objs/sedlex_cset.pp.ml.d
- Running[26]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w -9 -g -bin-annot -I src/syntax/.sedlex_ppx.objs/byte -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -intf-suffix .ml -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Sedlex_cset.cmo -c -impl src/syntax/sedlex_cset.pp.ml)
- Running[27]: (cd _build/default.windows && ../default/.ppx/112fe19966b0154286a2a2d1d0aa7d7f/ppx.exe --cookie 'library-name="sedlex_ppx"' -o src/syntax/unicode63.pp.mli --intf src/syntax/unicode63.mli --dump-ast)
- Running[28]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep -modules -intf src/syntax/unicode63.pp.mli) > _build/default.windows/src/syntax/.sedlex_ppx.objs/unicode63.pp.mli.d
- Running[29]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w -9 -g -bin-annot -I src/syntax/.sedlex_ppx.objs/byte -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Unicode63.cmi -c -intf src/syntax/unicode63.pp.mli)
- Running[30]: (cd _build/default.windows && ../default/.ppx/112fe19966b0154286a2a2d1d0aa7d7f/ppx.exe --cookie 'library-name="sedlex_ppx"' -o src/syntax/unicode63.pp.ml --impl src/syntax/unicode63.ml --dump-ast)
- Running[31]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep -modules -impl src/syntax/unicode63.pp.ml) > _build/default.windows/src/syntax/.sedlex_ppx.objs/unicode63.pp.ml.d
- Running[32]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w -9 -g -bin-annot -I src/syntax/.sedlex_ppx.objs/byte -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -intf-suffix .ml -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Unicode63.cmo -c -impl src/syntax/unicode63.pp.ml)
- Running[33]: (cd _build/default.windows && ../default/.ppx/112fe19966b0154286a2a2d1d0aa7d7f/ppx.exe --cookie 'library-name="sedlex_ppx"' -o src/syntax/ppx_sedlex.pp.ml --impl src/syntax/ppx_sedlex.ml --dump-ast)
- Running[34]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamldep -modules -impl src/syntax/ppx_sedlex.pp.ml) > _build/default.windows/src/syntax/.sedlex_ppx.objs/ppx_sedlex.pp.ml.d
- Running[35]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w -9 -g -bin-annot -I src/syntax/.sedlex_ppx.objs/byte -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Ppx_sedlex.cmo -c -impl src/syntax/ppx_sedlex.pp.ml)
- Running[36]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlc -w -40 -w -9 -g -a -o src/syntax/sedlex_ppx.cma -linkall src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx.cmo src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Sedlex_cset.cmo src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Sedlex.cmo src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Unicode63.cmo src/syntax/.sedlex_ppx.objs/byte/sedlex_ppx__Ppx_sedlex.cmo)
- Running[37]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -w -40 -w -9 -g -I src/syntax/.sedlex_ppx.objs/byte -I src/syntax/.sedlex_ppx.objs/native -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -intf-suffix .ml -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/native/sedlex_ppx__Sedlex_cset.cmx -c -impl src/syntax/sedlex_cset.pp.ml)
- Running[38]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -w -40 -w -9 -g -I src/syntax/.sedlex_ppx.objs/byte -I src/syntax/.sedlex_ppx.objs/native -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -intf-suffix .ml -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/native/sedlex_ppx__Sedlex.cmx -c -impl src/syntax/sedlex.pp.ml)
- Running[39]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -w -40 -w -9 -g -I src/syntax/.sedlex_ppx.objs/byte -I src/syntax/.sedlex_ppx.objs/native -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -intf-suffix .ml -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/native/sedlex_ppx__Unicode63.cmx -c -impl src/syntax/unicode63.pp.ml)
- Running[40]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -w -40 -w -9 -g -I src/syntax/.sedlex_ppx.objs/byte -I src/syntax/.sedlex_ppx.objs/native -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -intf-suffix .ml -no-alias-deps -open Sedlex_ppx -o src/syntax/.sedlex_ppx.objs/native/sedlex_ppx__Ppx_sedlex.cmx -c -impl src/syntax/ppx_sedlex.pp.ml)
- Output[40]:
- File "_none_", line 1:
- Warning 58: no cmx file was found in path for module Location, and its interface was not compiled with -opaque
- Running[41]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -w -40 -w -9 -g -a -o src/syntax/sedlex_ppx.cmxa -linkall src/syntax/.sedlex_ppx.objs/native/sedlex_ppx.cmx src/syntax/.sedlex_ppx.objs/native/sedlex_ppx__Sedlex_cset.cmx src/syntax/.sedlex_ppx.objs/native/sedlex_ppx__Sedlex.cmx src/syntax/.sedlex_ppx.objs/native/sedlex_ppx__Unicode63.cmx src/syntax/.sedlex_ppx.objs/native/sedlex_ppx__Ppx_sedlex.cmx)
- Running[42]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -w -40 -w -9 -g -shared -linkall -I src/syntax -o src/syntax/sedlex_ppx.cmxs src/syntax/sedlex_ppx.cmxa)
- Running[43]: (cd _build/default.windows && /home/opam/.opam/4.07.0/windows-sysroot/bin/ocamlopt -o .ppx/sedlex.ppx/ppx.exe -I /home/opam/.opam/4.07.0/windows-sysroot/lib/bytes -I /home/opam/.opam/4.07.0/windows-sysroot/lib/gen -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs -I /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned -I /home/opam/.opam/4.07.0/windows-sysroot/lib/result -I /home/opam/.opam/4.07.0/windows-sysroot/lib/uchar -I src/lib -I src/lib/.sedlex.objs/byte -I src/lib/.sedlex.objs/native -I src/syntax -I src/syntax/.sedlex_ppx.objs/byte -I src/syntax/.sedlex_ppx.objs/native /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml/compiler-libs/ocamlcommon.cmxa /home/opam/.opam/4.07.0/windows-sysroot/lib/result/result.cmxa /home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml-migrate-parsetree/migrate_parsetree.cmxa /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned/ppx_tools_versioned.cmxa /home/opam/.opam/4.07.0/windows-sysroot/lib/ppx_tools_versioned/ppx_metaquot_405.cmx /home/opam/.opam/4.07.0/windows-sysroot/lib/gen/gen.cmxa src/lib/sedlex.cmxa src/syntax/sedlex_ppx.cmxa .ppx/sedlex.ppx/ppx.ml)
-> compiled  sedlex-windows.2.0
@ghost
Copy link

ghost commented Jun 6, 2019

This is actually the expected behaviour. Inside a given package, all the artifacts are meant for the same target. When you think about it, it makes sense for ppx.exe as well. It would be odd to have the object files of the library be Windows object files and the ppx.exe, which in the end is just the library linked with the driver be a Linux executable. Having all the object files of the library be Linux object files would complicate the system a lot. In particular, what would we do for libraries that are needed both for the build and at runtime?

What the current scheme means is that in order to cross-compile a project using sedlex, you need both sedlex and sexlex-windows.

@toots
Copy link
Contributor Author

toots commented Jun 6, 2019

@diml Hmm okay. In this case, what is the recommended ocamlfind call to cross-compile using sedlex? Currently, I set OCAMLFIND_TOOLCHAIN=windows and then run:

ocamlfind ocamlopt -g -annot  -g -w +A-4@5-7@8-9@11@12@20-35-44-45-50 \
  -ccopt "-I.. -I/home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml -g" \
  -package bytes -package pcre -package sedlex -package sedlex.ppx (...) \
  -c tools/log.mli

And I get:

Error: Error while running external preprocessor
Command line: /home/opam/.opam/4.07.0/windows-sysroot/lib/sedlex/ppx/./ppx.exe --as-ppx '/tmp/camlppx9ea966' '/tmp/camlppxb74b72'

Any advice on how to properly do that would be greatly appreciated!

@toots
Copy link
Contributor Author

toots commented Jun 6, 2019

I'd argue that the most likely scenario is that the generated artifacts are meant to be run by the system compiling them and, thus, that the executable should be compiled for the hosting architecture.

Pretty sure dune can handle building a specific binary for the host while building the rest of the objects for the cross target, I believe that's the way is was designed to begin with.

cc/ @rgrinberg for opinion 🙂

@ghost
Copy link

ghost commented Jun 6, 2019

The model we implement in dune is the following: we have two parallel worlds: the one for the one for the build and the one for the target. When we need to run an executable during the build, we get it in the build world.

It seems to me that the model you are thinking of is one where for each library/executable, you have to make a decision of whether the element is needed only for the build or whether it is only needed at runtime. Which is quite limiting since you cannot use the same library for both.

@toots
Copy link
Contributor Author

toots commented Jun 6, 2019

This is not the way the windows-sysroot prefix is setup for build tools. Typically, windows-sysroot/bin/ocamlc is a cross-compiler. Likewise, it seems reasonable to assume that all build tools living under this prefix are meant to be run on the host to generate stuff for the cross target.

@toots
Copy link
Contributor Author

toots commented Jun 6, 2019

Note that ppx.exe is not defined in the dune file for sedlex. It is entirely generated by dune for the purpose of creating a ppx package under this configuration. Were it a project-defined binary it should have been an executable native to the cross target but in this case, it qualifies as a build binary in my opinion.

@ghost
Copy link

ghost commented Jun 6, 2019

Where do you install the Windows binaries in this world?

@toots
Copy link
Contributor Author

toots commented Jun 6, 2019

It's complicated 🙂

I believe most people use the cross-compiling environment as leverage to produce binaries that aren't living inside the cross-compiling path. Typically, most of the packages in opam-cross-windows are libraries.

One way to keep this conversation going could be to figure out the right call to compile using sedlex.ppx in the cross-compiling context, as exemplified above. I'd be curious to know how you would suggest this should be done?

@ghost
Copy link

ghost commented Jun 7, 2019

I believe most people use the cross-compiling environment as leverage to produce binaries that aren't living inside the cross-compiling path. Typically, most of the packages in opam-cross-windows are libraries.

I see, I was wondering about that.

One way to keep this conversation going could be to figure out the right call to compile using sedlex.ppx in the cross-compiling context, as exemplified above. I'd be curious to know how you would suggest this should be done?

I have no idea ¯_(ツ)_/¯

To be clear, I'm not against solving this particular problem, however I'm against solving it in an ad-hoc way.

Here is an attempt at a general design we could follow in dune:

Let's consider a package P and a file X installed by this package. We cross-compile on B for T.

  • if X is a compiler, then P-T.X is a B binary that targets T
  • if X is an executable or a shared library (.cmxs, .so, .dll) that is not a compiler, then P-T.X is the same as P.X
  • otherwise, P-T.X aims to be the same thing as P.X when compiling natively on a T machine

@toots
Copy link
Contributor Author

toots commented Jun 8, 2019

Yes, that makes sense. But in this case, don't you think that this ppx.exe qualifies as a compiler? It's not compiling per-say but it's an essential tool in the compile chain, much like ocamlyacc, ocamllex and etc. which are also B binaries targeting T.

@ghost
Copy link

ghost commented Jun 10, 2019

Not sure. Do you think it matters though?

@toots
Copy link
Contributor Author

toots commented Jun 11, 2019

To get back at my original report and issue, if ppx.exe was compiled as a binary running on the host/compiling machine, the command line:

ocamlfind ocamlopt -g -annot  -g -w +A-4@5-7@8-9@11@12@20-35-44-45-50 \
  -ccopt "-I.. -I/home/opam/.opam/4.07.0/windows-sysroot/lib/ocaml -g" \
  -package bytes -package pcre -package sedlex -package sedlex.ppx (...) \
  -c tools/log.mli

Would just work when executed with OCAMLFIND_TOOLCHAIN=windows since this call would then succeed:

/home/opam/.opam/4.07.0/windows-sysroot/lib/sedlex/ppx/./ppx.exe --as-ppx '/tmp/camlppx9ea966' '/tmp/camlppxb74b72'

@toots
Copy link
Contributor Author

toots commented Jun 11, 2019

This makes sense to me because when cross-compiling, ocamlopt and ppx.exe are both part of the compiling toolchain.

@ghost
Copy link

ghost commented Jun 12, 2019

I agree with you, but I still feel odd about making an exception just for this executable. We should either implement a new better proposal completely or stick with the current one.

@toots
Copy link
Contributor Author

toots commented Jun 13, 2019

Okay. Unless you can provide an alternative command line to cross-compile using sedlex (or a similar ppx pre-processor), I'd rather argue that this is currently a feature that is unavailable and/or broken. Thus, this would be a fix of the current proposal, not an exception.

I will go ahead and push a PR with the changes that I have in mind so we can see what we're talking about concretely. What's the best way to get more eyes on the topic? I was hoping to get some feedback from @rgrinberg about it since he was my original point of contact for the original proposal but perhaps he is not the right person to talk to nowadays?

@ghost
Copy link

ghost commented Jun 13, 2019

It's not broken, dune is just being consistent about the model it implements: the sedlex-windows package is the same as the sedlex package you'd get if you were building on Windows. If you cross-compile another project using sedlex via dune, it will work perfectly fine.

However, I thought a bit more about this and given that you are the one maintaining the opam-cross repositories and these are the only use case for the dune cross compilation feature, we should just trust your judgement here. So making an exception seems fine. The change itself is simple: you can add the following line to the get_compat_ppx_exe function in src/preprocessing.ml:

let sctx = SC.host sctx in

If you can confirm that it works for you, let's merge it.

Opening an issue here is the best way to get eyes on the topic. However, we are quite busy with other things right now, in particular preparing for the next major release. So we can't focus on every problem.

@rgrinberg
Copy link
Member

@toots sorry I haven't gotten back to you about this earlier. As Jeremie said, we are more focused on getting 2.0 out of the door right now. This does not mean we'll abandon dune 1.x, but that smaller issues like this would have to wait a bit.

I agree with Jeremie on both counts:

  • That the choice we're making here is a bit arbitrary.

  • But as you've pointed out, the .ppx binaries are clearly only necessary for the build since otherwise they would be defined as public binaries. So the workaround suggested by Jeremie is the right way to proceed now.

@toots do you want the prepare the patch?

@diml I think that eventually this problem will eventually disappear once we drop support for classical ppx. In the end, all we're losing is some edge case functionality for other users compiling with classical ppx.

@ghost
Copy link

ghost commented Jun 17, 2019

@diml I think that eventually this problem will eventually disappear once we drop support for classical ppx. In the end, all we're losing is some edge case functionality for other users compiling with classical ppx.

Indeed, that's a good point

@toots
Copy link
Contributor Author

toots commented Jun 17, 2019

Thanks guys. I pushed the changes in #2286, gonna test them next.

@toots
Copy link
Contributor Author

toots commented Jun 17, 2019

I can confirm that it fixes all of our compilation issues. Thanks for baring with me on this, let me know if I can help further.

toots added a commit to toots/dune that referenced this issue Jun 17, 2019
rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Jul 18, 2019
CHANGES:

- Don't select all local implementations in `dune utop`. Instead, let the
  default implementation selection do its job. (ocaml/dune#2327, fixes ocaml/dune#2323, @TheLortex,
  review by @rgrinberg)

- Check that selected implementations (either by variants or default
  implementations) are indeed implementations. (ocaml/dune#2328, @TheLortex, review by
  @rgrinberg)

- Don't reserve the `Ppx` toplevel module name for ppx rewriters (ocaml/dune#2242, @diml)

- Redesign of the library variant feature according to the ocaml/dune#2134 proposal. The
  set of variants is now computed when the virtual library is installed.
  Introducing a new `external_variant` stanza. (ocaml/dune#2169, fixes ocaml/dune#2134, @TheLortex,
  review by @diml)

- Add proper line directives when copying `.cc` and `.cxx` sources (ocaml/dune#2275,
  @rgrinberg)

- Fix error message for missing C++ sources. The `.cc` extension was always
  ignored before. (ocaml/dune#2275, @rgrinberg)

- Add `$ dune init project` subcommand to create project boilerplate according
  to a common template. (ocaml/dune#2185, fixes ocaml/dune#159, @shonfeder)

- Allow to run inline tests in javascript with nodejs (ocaml/dune#2266, @hhugo)

- Build `ppx.exe` as compiling host binary. (ocaml/dune#2286, fixes ocaml/dune#2252, @toots, review
  by @rgrinberg and @diml)

- Add a `cinaps` extension and stanza for better integration with the
  [cinaps tool](https://github.com/janestreet/cinaps) tool (ocaml/dune#2269,
  @diml)

- Allow to embed build info in executables such as version and list
  and version of statically linked libraries (ocaml/dune#2224, @diml)

- Set version in `META` and `dune-package` files to the one read from
  the vcs when no other version is available (ocaml/dune#2224, @diml)

- Add a variable `%{target}` to be used in situations where the context
  requires at most one word, so `%{targets}` can be confusing; stdout
  redirections and "-o" arguments of various tools are the main use
  case; also, introduce a separate field `target` that must be used
  instead of `targets` in those situations.  (ocaml/dune#2341, @aalekseyev)

- Fix dependency graph of wrapped_compat modules. Previously, the dependency on
  the user written entry module was omitted. (ocaml/dune#2305, @rgrinberg)

- Allow to promote executables built with an `executable` stanza
  (ocaml/dune#2379, @diml)

- When instantiating an implementation with a variant, make sure it matches
  virtual library's list of known implementations. (ocaml/dune#2361, fixes ocaml/dune#2322,
  @TheLortex, review by @rgrinberg)

- Add a variable `%{ignoring_promoted_rules}` that is `true` when
  `--ingore-promoted-rules` is passed on the command line and false
  otherwise (ocaml/dune#2382, @diml)

- Fix a bug in `future_syntax` where the characters `@` and `&` were
  not distinguished in the names of binding operators (`let@` was the
  same as `let&`) (ocaml/dune#2376, @aalekseyev, @diml)

- Workspaces with non unique project names are now supported. (ocaml/dune#2377, fix ocaml/dune#2325,
  @rgrinberg)

- Improve opam generation to include the `dune` dependncies with the minimum
  constraint set based on the dune language version specified in the
  `dune-project` file. (2383, @avsm)

- The order of fields in the generated opam file now follows order preferred in
  opam-lib. (@avsm, ocaml/dune#2380)

- Fix coloring of error messages from the compiler (@diml, ocaml/dune#2384)

- Add warning `66` to default set of warnings starting for dune projects with
  language verison >= `1.11` (@rgrinberg, @diml, fixes ocaml/dune#2299)

- Add (dialect ...) stanza
  (@nojb, ocaml/dune#2404)

- Add a `--context` argument to `dune install/uninstall` (@diml, ocaml/dune#2412)

- Do not warn about merlin files pre 1.9. This warning can only be disabled in
  1.9 (ocaml/dune#2421, fixes ocaml/dune#2399, @emillon)
mlasson pushed a commit to mlasson/dune that referenced this issue Jul 19, 2019
Fixes: ocaml#2252

Signed-off-by: Romain Beauxis <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Jul 22, 2019
CHANGES:

- Don't select all local implementations in `dune utop`. Instead, let the
  default implementation selection do its job. (ocaml/dune#2327, fixes ocaml/dune#2323, @TheLortex,
  review by @rgrinberg)

- Check that selected implementations (either by variants or default
  implementations) are indeed implementations. (ocaml/dune#2328, @TheLortex, review by
  @rgrinberg)

- Don't reserve the `Ppx` toplevel module name for ppx rewriters (ocaml/dune#2242, @diml)

- Redesign of the library variant feature according to the ocaml/dune#2134 proposal. The
  set of variants is now computed when the virtual library is installed.
  Introducing a new `external_variant` stanza. (ocaml/dune#2169, fixes ocaml/dune#2134, @TheLortex,
  review by @diml)

- Add proper line directives when copying `.cc` and `.cxx` sources (ocaml/dune#2275,
  @rgrinberg)

- Fix error message for missing C++ sources. The `.cc` extension was always
  ignored before. (ocaml/dune#2275, @rgrinberg)

- Add `$ dune init project` subcommand to create project boilerplate according
  to a common template. (ocaml/dune#2185, fixes ocaml/dune#159, @shonfeder)

- Allow to run inline tests in javascript with nodejs (ocaml/dune#2266, @hhugo)

- Build `ppx.exe` as compiling host binary. (ocaml/dune#2286, fixes ocaml/dune#2252, @toots, review
  by @rgrinberg and @diml)

- Add a `cinaps` extension and stanza for better integration with the
  [cinaps tool](https://github.com/janestreet/cinaps) tool (ocaml/dune#2269,
  @diml)

- Allow to embed build info in executables such as version and list
  and version of statically linked libraries (ocaml/dune#2224, @diml)

- Set version in `META` and `dune-package` files to the one read from
  the vcs when no other version is available (ocaml/dune#2224, @diml)

- Add a variable `%{target}` to be used in situations where the context
  requires at most one word, so `%{targets}` can be confusing; stdout
  redirections and "-o" arguments of various tools are the main use
  case; also, introduce a separate field `target` that must be used
  instead of `targets` in those situations.  (ocaml/dune#2341, @aalekseyev)

- Fix dependency graph of wrapped_compat modules. Previously, the dependency on
  the user written entry module was omitted. (ocaml/dune#2305, @rgrinberg)

- Allow to promote executables built with an `executable` stanza
  (ocaml/dune#2379, @diml)

- When instantiating an implementation with a variant, make sure it matches
  virtual library's list of known implementations. (ocaml/dune#2361, fixes ocaml/dune#2322,
  @TheLortex, review by @rgrinberg)

- Add a variable `%{ignoring_promoted_rules}` that is `true` when
  `--ingore-promoted-rules` is passed on the command line and false
  otherwise (ocaml/dune#2382, @diml)

- Fix a bug in `future_syntax` where the characters `@` and `&` were
  not distinguished in the names of binding operators (`let@` was the
  same as `let&`) (ocaml/dune#2376, @aalekseyev, @diml)

- Workspaces with non unique project names are now supported. (ocaml/dune#2377, fix ocaml/dune#2325,
  @rgrinberg)

- Improve opam generation to include the `dune` dependncies with the minimum
  constraint set based on the dune language version specified in the
  `dune-project` file. (2383, @avsm)

- The order of fields in the generated opam file now follows order preferred in
  opam-lib. (@avsm, ocaml/dune#2380)

- Fix coloring of error messages from the compiler (@diml, ocaml/dune#2384)

- Add warning `66` to default set of warnings starting for dune projects with
  language verison >= `1.11` (@rgrinberg, @diml, fixes ocaml/dune#2299)

- Add (dialect ...) stanza
  (@nojb, ocaml/dune#2404)

- Add a `--context` argument to `dune install/uninstall` (@diml, ocaml/dune#2412)

- Do not warn about merlin files pre 1.9. This warning can only be disabled in
  1.9 (ocaml/dune#2421, fixes ocaml/dune#2399, @emillon)

- Add a new `inline_tests` field in the env stanza to control inline_tests
  framework with a variable (ocaml/dune#2313, @mlasson, original idea by @diml, review
  by @rgrinberg).

- New binary kind `js` for executables in order to explicitly enable Javascript
  targets, and a switch `(explicit_js_mode)` to require this mode in order to
  declare JS targets corresponding to executables. (ocaml/dune#1941, @nojb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment