Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2018
This is an "in flux" snapshot of my experiments to make cross-compilation to mingw work.
Status
I've based this work on 5.4 because so many cross-compilation fixes have landed in this release cycle. As a consequence, I haven't imported any cross-compilation patch to the compiler. Instead, it relies on just the following sequence of commands to work:
(I used the upstream instructions)
Remarks
I'd like to list the quirks I faced while doing this:
host
vstarget
confusionBy default, nix was trying to build a compiler with
build=linux
,host=mingw
,target=mingw
(a compiler that would run on windows) instead ofbuild=linux
,host=linux
,target=mingw
(a compiler that runs on linux, whose resulting programs run on windows). I thought that this was an issue with the nix environment, but in the end, just passing--target
to./configure
fixes the issue.Bootstrapping
flexdll
On Windows, it's necessary to build
flexdll
to getflexlink
working. This can now be bootstrapped directly but it's necessary to fetch submodules for this to work.Also, nix packages the pthreads implementation separately so it's necessary to alter the default link command to add a
-L
flag. I haven't found a way to do this with./configure
flags (LD_FLAGS=
sets-link -L
which passes arguments to the linker and not toflexlink
itself) so I patchedMakefile.config
instead..exe
extensionFor a reason I haven't understood, this produces binaries with the
.exe
extension. I believe that this extension should be determined byhost
rather thantarget
, but I'm not sure. I added symlinks.Next steps
The next failing step is to get
findlib
/ocamlfind
to work. It doesn't seem to find libraries.