'pkg-config': No such file or directory when running opam install dream on windows
Opened this issue · 3 comments
following the tutorial on Ocaml website I tried to install the dream framework through OPAM and I get the following error.
OS: Windows 11 | 23H2
[ERROR] The compilation of conf-pkg-config.2 failed at "pkg-config --help".
#=== ERROR while compiling conf-pkg-config.2 ==================================#
# context 2.2.0~alpha0~20221228 | win32/x86_64 | conf-withdkml.2 ocaml-system.4.14.0 | pinned
# path ~\AppData\Local\opam\playground\.opam-switch\build\conf-pkg-config.2
# command ~\AppData\Local\Programs\DISKUV~1\bin\WITH-D~1.EXE pkg-config --help
# exit-code 127
# env-file ~\AppData\Local\opam\log\conf-pkg-config-12880-c314fb.env
# output-file ~\AppData\Local\opam\log\conf-pkg-config-12880-c314fb.out
### output ###
# /c/Users/Kehinde/AppData/Local/Programs/DISKUV~1/tools/MSYS2/usr/bin/env: 'pkg-config': No such file or directory
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build conf-pkg-config 2
└─
╶─ No changes have been performed
# Run eval $(opam env) to update the current shell environment
pkg-config
is a Unix tool to locate C libraries that is deeply incompatible with Windows. More generally the way that C is used today by OCaml packages is very Unix-specific.
The next version of DkML will "succeed" in installing pkg-config
, but even that is an illusion because many C-based packages will fail. I'd ask that this issue be translated into a "Does Dream support Windows? If so, can it be tested as part of the CI?" issue on the https://github.com/aantron/dream. (I doubt that Dream directly that is the issue, but one of its many dependencies)
By the way, I no longer try to get C-based packages to work on Windows; I can't sustainably create patches for the expanding set of Unix-only packages. I have created a proposal ocaml/dune#8707 for vcpkg
integration that will address much of the problem. That is long-term though. Today, I'm redirecting users to one of the options:
- (Soon) Wait for Cygwin public release (opam 2.2) and Cygwin depexts (not sure when). Since Cygwin is a full Unix environment, running tools like
dream
is one of the few areas where Cygwin excels. - (Today) Use WSL 2. Of course, you wouldn't be able to develop Windows products, but I suspect that
dream
users care about deploying to Linux. - (Today) Subscribe to my DkSDK product where C packages are built in a simple, cross-platform way outside of the Unix-centric OCaml tooling. If a subscriber finds a package (ex.
dream
) that doesn't work on Windows, they can ask for the missing C dependencies to be supported.
Hope that helps.
@kit-ty-kate @jonahbeckford Thanks for the feedback, I have since moved on to using WSL for OCaml.