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

MSYS2/ucrt64 support #134

Open
kit-ty-kate opened this issue Feb 29, 2024 · 2 comments
Open

MSYS2/ucrt64 support #134

kit-ty-kate opened this issue Feb 29, 2024 · 2 comments

Comments

@kit-ty-kate
Copy link
Member

kit-ty-kate commented Feb 29, 2024

By default MSYS2 doesn't have a prefixed windres tool in most of its environments (except for the mingw one which seems to fail due to unrelated reasons). When building flexdll vendored inside OCaml, the TOOLPREF variable gets set to x86_64-w64-mingw32-, which makes the compilation of flexdll fail under MSYS2 which doesn't have x86_64-w64-mingw32-windres but has windres

There is an issue upstream about the lack of prefixed windres tool here: msys2/MSYS2-packages#2595

However regardless of whether or not it is a good decision for such platform to have it or not, it would be nice for OCaml to compile without having to either patch the Makefile or create a custom windres binary/script/link.

While I'm not certain what this windres program is, maybe flexdll could do the following change:

version_res.o: version.rc
-        $(TOOLPREF)windres -i $< -o $@
+        $(TOOLPREF)windres -i $< -o $@ || windres -i $< -o $@

Relatedly there is also the following comment in configure.ac in ocaml/ocaml:

# Note: This is present for the flexdll bootstrap where it exposed as the old
# TOOLPREF variable. It would be better if flexdll where updated to require
# WINDRES instead.
AC_SUBST([ac_tool_prefix])

Side note: I remember talking with someone about this issue some months ago and I thought a ticket was opened somewhere but i couldn't find it anywhere so I'm creating it here to at least kickstart the discussion once more

@dra27
Copy link
Member

dra27 commented May 21, 2024

It's worth hardening regardless, but what's the context of this issue? MSYS2's gcc is not a cross-compiler, so it configures using a standard ./configure, which causes flexlink to use an unprefixed version. This is why all the filters on --host= in the compiler packages begin with {os-distribution = "cygwin" & (restricting it to Cygwin's prefixed packaging of gcc) and then system-mingw:installed & arch-x86_64:installed

@kit-ty-kate
Copy link
Member Author

i was trying to compile opam on MSYS2 using its MinGW toolchain, where gcc is x86_64-w64-mingw32-gcc

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