Skip to content

Instantly share code, notes, and snippets.

@nadako
Last active May 25, 2019 19:23
Show Gist options
  • Save nadako/1e73ee2fa759d2ea9bf4acb65e3e3052 to your computer and use it in GitHub Desktop.
Save nadako/1e73ee2fa759d2ea9bf4acb65e3e3052 to your computer and use it in GitHub Desktop.

NOTE: This gist was added to the official building manual and will be updated there from now on: https://haxe.org/documentation/introduction/building-haxe.html

Preparation

  • Uninstall OCaml, MinGW, Cygwin
  • Remove leftover environment vars, cleanup PATH

Installation

  • Download 32-bit installer from the fdopen's fork: https://fdopen.github.io/opam-repository-mingw/installation/
  • Install it, in Cygwin package selection also check mingw64-i686-zlib (used by Haxe). You might need to switch "View" in top-right corner to "Not Installed" to see it in the list.
  • Run OCaml32 terminal from the desktop shortcut, from it:
    • Install camlp4 with opam install camlp4
    • Install merlin with opam install merlin

Running from cmd/powershell

  • Add these to your PATH (actual paths may differ depending on your install path and username):
    • cygwin tools: C:\OCaml32\bin
    • runtime dlls: C:\OCaml32\usr\i686-w64-mingw32\sys-root\mingw\bin
    • ocaml bin: C:\OCaml32\home\nadako\.opam\4.02.3+mingw32c\bin
    • flexlink bin: C:\OCaml32\usr\local\bin
  • Add new env variables (actual paths may differ depending on your install path and username):
    • OCAML_TOPLEVEL_PATH=C:\OCaml32\home\nadako\.opam\4.02.3+mingw32c\lib\toplevel
    • OCAMLLIB=C:\OCaml32\home\nadako\.opam\4.02.3+mingw32c\lib\ocaml
  • I couldn't get opam itself running through cmd/powershell because it needs some more environment that's inited in .bashrc, but I think installing opam packages from within Cygwin terminal is acceptable.

Testing

@nadako
Copy link
Author

nadako commented Aug 17, 2016

opam install sedlex also worked!

@dstrekelj
Copy link

Thanks for sharing!

In my case, I had some trouble with the installation process failing because of git not being set up properly (according to the installer). Restarting the computer and re-running the installer fixed the issue.

@Gama11
Copy link

Gama11 commented Aug 27, 2016

I had issues compiling haxe in cmd.exe (worked fine in ocaml32):

Interrupt/Exception caught (code = 0xc00000fd, addr = 0x4227d3

This helped: http://hdrlab.org.nz/articles/windows-development/make-interrupt-exception-caught-code-0xc00000fd-addr-0x4217b/
TL;DR: put the environemnt variables at the start of your PATH, not at the end like I did at first

@nadako
Copy link
Author

nadako commented Feb 4, 2017

Note that this is now added to the official manual and will be updated there: https://haxe.org/documentation/introduction/building-haxe.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment