Skip to content

Conversation

@jmid
Copy link
Member

@jmid jmid commented Aug 21, 2025

This PR adds MinGW and MSys support for libao. It is based on

The PR is modeled after #26072 by @dra27 who wrote (I quote): 😃

I'm very happy to be pinged to review them

Polite ping to @gridbugs who struggled to get this working https://www.gridbugs.org/sound-on-ocaml-on-windows/ and thus may be interested in testing it... 🤞

"conf-mingw-w64-gcc-x86_64" {build}
]
depexts: [
["mingw64-x86_64-libao"] {os = "win32" & os-distribution = "cygwin"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While working on my blog post about libao I used exactly this depext entry for cygwin and found that it didn't work properly. The mingw64-x86_64-* package seem to install to \root\usr\x86_64-w64-mingw32\sys-root\mingw\lib, and I found that pkgconf doesn't look in this directory when searching for libraries. I only managed to get this working on msys2 (using the exact same line you have below).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you invoke pkgconf with the --personality=x86_64-w64-mingw32 flag like the tests in conf-mingw-w64-ao-x86_64.1/opam and conf-ao.1/opam do?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh interesting, no I did not. That might be what I was doing wrong. Let me see if that works for me!

@gridbugs
Copy link
Contributor

I've tested this on my x86_64 windows machine with opam configured to use msys2 and I can build the ao package after pinning the conf-ao package from this branch. While you were developing this which windows package manager did you use for testing? I'm curious about whether you've found a way to make the cygwin lib-ao package work as I was unable to when I tried a few months ago. I might set up an opam environment on my windows machine with cygwin and see if it works for me.

@jmid
Copy link
Member Author

jmid commented Aug 22, 2025

I've tested this on my x86_64 windows machine with opam configured to use msys2 and I can build the ao package after pinning the conf-ao package from this branch.

Excellent! 🎉

While you were developing this which windows package manager did you use for testing?

I've just used the CI workflow, which at the moment only tests MinGW (installed via Cygwin).
I have hacked an extension of it that also tests on MSys, where it also held up nicely.

@gridbugs
Copy link
Contributor

I just set up a cygwin-based opam environment and confirmed that I can also build the ao package there after pinning the relevant packages from this PR. TIL about pkgconf --personality. Nice work @jmid!

@mseri
Copy link
Member

mseri commented Aug 28, 2025

I am going to merge. This is a strict improvement over the previous situation. Thanks!

@mseri mseri merged commit 523805e into ocaml:master Aug 28, 2025
1 of 2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants