How to implement new Haxe target?

I have a project to do that,, it’s starting to run a good amount of haxe code (single file), but there is so so so so much that it can’t run, haxe is really big :wink:
I don’t see it being usable for several months.

But you can do the prototyping of an haxe target using but with very strong limitations, especially you can’t do your own std.


After various installation steps, I have on my desktop 2 “Cygwin64 Terminal” icons, and 1 “OCaml64” icon.
All 3 seem to do the same thing: open a unix bash shell.
But the current directory (using pwd) shows “/home/matt”.
Obviously, this is not a “real” directory under C:, as C:\home\ doesn’t exist.
How do I find out where this directory is, and, more importantly: how do I change it?
Because from this bash shell, I cannot access my Haxe sources.
Because those are under C:\HaxeToolkit\dev\haxe…

use ls instead of dir command
use cd but you need to do:

cd "C:\HaxeToolkit\dev\haxe"   (notice the Quote characters)

I just always include Quotes around any Windows style paths when messing with cygwin or mingw.

Cygwin Example from my setup:

Randy@Randy-PC ~
# ls

Randy@Randy-PC ~
# cd ..

Randy@Randy-PC /home
# cd "C:\Randy\Programming\Haxe\HaxeUI\HaxeUI_Test_App"

Randy@Randy-PC /cygdrive/c/Randy/Programming/Haxe/HaxeUI/HaxeUI_Test_App

Above was from a 32 bit cygwin (which should not matter for directory navigation).
Hang in there!

1 Like

Your haxe sources are at “/cygdrive/c/HaxeToolkit/dev/haxe/…”.

At bit off topic, but pertinent to your situation:

Supposing you installed cygwin to “C:\cygwin64”, then the home directory that the cygwin bash gives you is at “C:\cygwin64\home\matt” and when in the bash shell, your “C:” drive is at “/cygdrive/c/”. Essentially, cygwin bash thinks that it’s directory is root (e.g. the Windows path “C:\cygwin64” is bash path “/”). And dos drive letters are “mounted” (using that term loosely) at “/cygdrive/”.

On my machine:

$ mount
C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64 on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
D: on /cygdrive/d type ntfs (binary,posix=0,user,noumount,auto)
F: on /cygdrive/f type ntfs (binary,posix=0,user,noumount,auto)

(And, though I wish I had… I never got the compiler building on Windows. :frowning: )

1 Like

you could install chere(the windows context menu for cygwin bash) from cygwin.exe and then run chere -i with Administrator

1 Like

(sorry, sorry for my tone but feeling very very depressed and disillusioned)


why does it ask for dumpbin?
I have 4 different dumpbin.exe, none of which are in my path.
what does dumpbin do, and which one should be in my path?
(or something)

You don’t want to build ocamlhaxe, that requires a whole bunch a things including dumpbin and cygwin.

What you want is get one of the release and run config.bat, which is enough to setup everything.

All I want is be able to build haxe.
I have no clue what I am doing.
Ho do I use ocamlhaxe to build haxe?

(sorry for my tone; I am depressed and this close to giving up, not just on trying to build haxe but on haxe completely)

If ocamlhaxe is not for building haxe, then what is it for?

Download, unzip it, run config.bat. You now have ocaml setup.

Follow the instructions at to get and build haxe:

git clone --recursive
opam pin add haxe path/to/haxe --no-action
opam install haxe --deps-only
make -f

Using ocamlhaxe Build.exe is to build the ocamlhaxe installer, which you don’t need to do since you download a release of it.

Fatal error:
“git”: command not found.
Like, what?

Git is installed.
I have been using git for years.

Strange error, but opam is not known to work flawlessly :wink: do the next two commands work?

It’s actually the command

opam pin add haxe path/to/haxe --no-action

that gives the git error.

I’ll just delete everything (again) and start again.

I know, I was asking if opam install haxe --deps-only works.

Maybe the previous one (pin) half worked/half failed just enough to allow you to continue, since it did say I pinned it before throwing the error.

I’ll have a look.
I just deleted all related folders, cleaned my path and any other environment variables, I’ll reboot my system and start again.
Fingers crossed.


1. Cleaned system:

  • CygWin, OCaml, etc, all removed, all traces erased from path, environment variables; except:
  • things probably/possibly related to this that I have left installed and in my path (because I use them) are:
    ** git (in C:\Program Files\Git\cmd)
    ** haxe and neko (haxe 3.4.7 in C:\HaxeToolkit\3 (not in path), haxe 4.0.0 in C:\HaxeToolkit\4 (path has C:\HaxeToolkit\4\haxe and C:\HaxeToolkit\4\neko)).


2. Downloaded ocamhaxe


3. In cmd.exe, navigated to C:\HaxeToolkit\dev\ocamhaxe, ran config.bat.

After UAC confirmation, new command window opened.

Cygwin not found
Querying environment…
> regedit /E C:\Users\Heeb\AppData\Local\Temp\env.txt HKEY_CURRENT_USER\Environment
Updating Environment…
> regedit /S C:\Users\Heeb\AppData\Local\Temp\env.txt
> setx OCAMLLIB C:\HAXETO~1\dev\ocamhaxe/.opam/4.03.0+mingw32/lib/ocaml

SUCCESS: Specified value was saved.
> setx OCAMLFIND_CONF C:\HAXETO~1\dev\ocamhaxe/.opam/4.03.0+mingw32/lib/findlib.conf

SUCCESS: Specified value was saved.
> setx OPAMROOT C:\HAXETO~1\dev\ocamhaxe/.opam

SUCCESS: Specified value was saved.
> setx OCAMHAXE C:\HAXETO~1\dev\ocamhaxe/bin;C:\HAXETO~1\dev\ocamhaxe/.opam/4.03.0+mingw32/bin;C:\HAXETO~1\dev\ocamhaxe/mingw/bin

SUCCESS: Specified value was saved.
Setup successful!
Press enter to exit


4. In C:\HaxeToolkit\dev, ran git clone --recursive

C:\HaxeToolkit\dev now contains haxe and ocamhaxe folders.


5. Reopened cmd.exe, navigated to folder C:\HaxeToolkit\dev\haxe to run:

opam pin add haxe C:\HaxeToolkit\dev\haxe --no-action

Strange output:

tput: unknown terminal "cygwin"
Package haxe does not exist, create as a NEW package ? [Y/n]

Note the "Ou" missing from "Output"…

Typing Y to confirm.


haxe is now git-pinned to git+file://C:\HaxeToolkit\dev\haxe
[NOTE] Pinning in mixed mode: OPAM will use tracked files in the current working tree from C:/HaxeToolkit/dev/haxe. If this is not what you want, pin to a given branch (e.g. git+file://C:\HaxeToolkit\dev\haxe#HEAD)
Fatal error:
"git": command not found.


6. Ran: opam install haxe --deps-only.


tput: unknown terminal "cygwin"

=-=- Synchronising pinned packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
‘uname’ is not recognized as an internal or external command, operable program or batch file.
Fatal error:


6. Ran: make -f

This bring up a dialog box with the text:

The code execution cannot proceed because cygguile-2.0-22.dll was not found. Reinstalling the program may fix this problem.


tput isn’t a cut output but the name of a software :wink:

What terminal did you use for these commands? I see there’s a mingw/bin/bash.exe in ocamlhaxe, maybe that one would help.

If that’s still doesn’t work maybe ocamlhaxe needs some fixes.

Oh, haha :joy::joy::joy:

Just the standard cmd.exe

I’ll give it a try!

When running bash inside cmd.exe:

bash-4.4$ opam pin add haxe C:\HaxeToolkit\dev\haxe --no-action
tput: unknown terminal "cygwin"
[1;34m[NOTE][m haxe is currently git-pinned to git+file://C:\HaxeToolkit\dev\haxe.
Proceed ? [Y/n] Y
haxe is now [01mpath[m-pinned to file://C:HaxeToolkitdevhaxe
Fatal error:
"rsync": command not found.

So this time, rsync isn’t found instead of git.


bash-4.4$ opam install haxe --deps-only
tput: unknown terminal “cygwin”
[36m=-=-[m [01mSynchronising pinned packages[m [36m=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[m
‘uname’ is not recognized as an internal or external command, operable program or batch file.
Fatal error:


bash-4.4$ make -f
C:/HAXETO~1/dev/ocamhaxe/mingw/bin/make.exe: error while loading shared libraries: cygguile-2.0-22.dll: cannot open shared object file: No such file or directory

So no success yet