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

Move towards OCaml 5 #9

Open
Simn opened this issue Jan 6, 2024 · 1 comment
Open

Move towards OCaml 5 #9

Simn opened this issue Jan 6, 2024 · 1 comment

Comments

@Simn
Copy link
Member

Simn commented Jan 6, 2024

I would like to use OCaml 5 on Windows and have been looking into making it work. This repository seems like a good place to log some issues I've come across.

opam 2.2

Opam 2.2 is supposed to have improved Windows support, but so far I've not really seen that. My opam repo now ends up in c:\users\simn\AppData\Local\opam, which I'm not sure is right for a mingw-based tool from cygwin. Some libraries have issues with absolute paths no longer starting with / (see below). There also seems to be some conflation between mingw64 and mscv64 which has to be sorted out. Opam 2.2 is still in alpha, so things will hopefully improve. There's also a good change that I'm just doing something wrong.

prims.c

I ran into the issue with prims.c that is mentioned in the readme here, and reported it to opam. In my case I am using Cygwin git, but I was using it from cmd.exe which didn't work. In my case it came from building opam itself, so I'm not sure why the problem came up here.

ocamlbuild

When installing sedlex, it wants to install uchar and that wants to install ocamlbuild. This in turn lead to some problem with stat on a symlink. I have reported that and so far learned that it's not supposed to use ocamlbuild on Windows in the first place, but rather an ocamlbuild+win variant. Why this happens in my setup remains to be seen.

camlp5

Oh man, this thing... I've had all sorts of issues with this library, and by now I can't even install it on 4.09.0 anymore:

�[K[ERROR] The compilation of camlp5 failed at "./configure --prefix C:/cygwin64/home/simn/.opam/4.09.0+mingw64c -libdir C:/cygwin64/home/simn/.opam/4.09.0+mingw64c/lib -mandir
        C:/cygwin64/home/simn/.opam/4.09.0+mingw64c/man".

#=== ERROR while compiling camlp5.8.00.04 =====================================#
# context     2.0.10 | win32/x86_64 | ocaml-variants.4.09.0+mingw64c | git+https://github.com/ocaml/opam-repository.git
# path        ~/.opam/4.09.0+mingw64c/.opam-switch/build/camlp5.8.00.04
# command     ./configure --prefix C:/cygwin64/home/simn/.opam/4.09.0+mingw64c -libdir C:/cygwin64/home/simn/.opam/4.09.0+mingw64c/lib -mandir C:/cygwin64/home/simn/.opam/4.09.0+mingw64c/man
# exit-code   2
# env-file    ~/.opam/log/camlp5-33472-42bb52.env
# output-file ~/.opam/log/camlp5-33472-42bb52.out
### output ###
# The -prefix directory must be absolute.

As mentioned above, I don't know why it's now using c:/cygwin64 instead of / from within cygwin. Advice appreciated!

@tobil4sk
Copy link
Member

I think it should be doable to compile haxe with ocaml 5 on windows now.

My opam repo now ends up in c:\users\simn\AppData\Local\opam, which I'm not sure is right for a mingw-based tool from cygwin.

This is correct, opam no longer runs as a cygwin tool within cygwin, it now runs as a native windows tool that pulls some project dependencies from a cygwin install.

Some libraries have issues with absolute paths no longer starting with / (see below).

This is a camlp5 specific issue rather than a wider opam issue. I've opened PRs for everything (see #19) and once those are merged and released, camlp5 will work on native opam too, which will be useful when we have to go back to compile old haxe versions. The latest camlp5 also removes the need for the perl libraries.

Opam 2.2 is still in alpha, so things will hopefully improve.

There have since been two official minor releases, and things are looking much better now. With ppx_parser (or with patched camlp5), it is possible to build haxe pretty seamlessly. Opam now also automatically installs missing cygwin packages, which makes it much easier and less frustrating to deal with the required packages.

On opam init, it even gives the option for opam to create its own cygwin install automatically, which makes things much simpler for people setting up a haxe environment from scratch. No need to deal with the ancient cygwin setup GUI!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants