yallop / ocaml-ctypes

Library for binding to C libraries using pure OCaml
MIT License
363 stars 95 forks source link

Can't compile on Windows. #719

Closed discapes closed 11 months ago

discapes commented 1 year ago

Hi. I cloned the repository and ran opam install ./. I am using Diskuv OCaml on windows, and I've set up the environment. Here's the output I get:

PS C:\Users\Miika\code\ocaml\helloworld\ocaml-ctypes> opam install ./
[ctypes-foreign.dev] synchronised (no changes)
[ctypes.dev] synchronised (no changes)
[WARNING] File C:\Users\Miika\AppData\Local\Programs\DISKUV~1\0\dkml\_opam\bin\with-dkml.exe, which package conf-withdkml.1 depends upon, is no longer in your PATH.
[NOTE] Package ctypes-foreign is already installed (current version is dev).
The following actions will be performed:
=== install 1 package
  ✶ ctypes dev (pinned)

Proceed with ✶ 1 installation? [y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of ctypes.dev failed at "make XEN=disable COVERAGE=true libffi.config ctypes-base ctypes-stubs".

#=== ERROR while compiling ctypes.dev =========================================#
# context     2.2.0~alpha~dev | win32/x86_64 | conf-withdkml.1 ocaml-system.4.12.1 | pinned(git+file://C:/Users/Miika/code/ocaml/helloworld/ocaml-ctypes#master#cc3ccdd5)
# path        ~\code\ocaml\switch\_opam\.opam-switch\build\ctypes.dev
# command     ~\AppData\Local\Programs\DISKUV~1\0\dkml\_opam\bin\with-dkml.exe make XEN=disable COVERAGE=true libffi.config ctypes-base ctypes-stubs
# exit-code   2
# env-file    ~\AppData\Local\opam\log\ctypes-43508-396ccb.env
# output-file ~\AppData\Local\opam\log\ctypes-43508-396ccb.out
### output ###
# [...]
# C:/msys64/mingw64/bin/../include\stdlib.h(712): error C2085: 'putenv': not in formal parameter list
# C:/msys64/mingw64/bin/../include\stdlib.h(716): error C2085: 'swab': not in formal parameter list
# C:/msys64/mingw64/bin/../include\stdlib.h(719): error C2085: 'ultoa': not in formal parameter list
# C:/msys64/mingw64/bin/../include\stdlib.h(720): error C2085: 'onexit': not in formal parameter list
# C:/msys64/mingw64/bin/../include\stdlib.h(726): error C2085: 'lldiv_t': not in formal parameter list
# C:/msys64/mingw64/bin/../include\stdlib.h(728): error C2061: syntax error: identifier 'lldiv_t'
# C:/msys64/mingw64/bin/../include\stdlib.h(732): error C2169: 'llabs': intrinsic function, cannot be defined
# C:/msys64/mingw64/bin/../include\malloc.h(50): warning C4820: '_heapinfo': '4' bytes padding added after data member '_useflag'
# C:/msys64/mingw64/bin/../include\malloc.h(82): fatal error C1083: Cannot open include file: 'mm_malloc.h': No such file or directory
# ocamlc.opt.exe returned with exit code 2
# Fatal error: exception Failure("sizeof: Char")
# make: *** [Makefile:131: src/ctypes/ctypes_primitives.ml] Error 1

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ctypes dev
└─ 
╶─ No changes have been performed
# Run eval $(opam env) to update the current shell environment
yallop commented 11 months ago

I'm not sure what's going on here, but this

# C:/msys64/mingw64/bin/../include\malloc.h(82): fatal error C1083: Cannot open include file: 'mm_malloc.h': No such file or directory

looks like a local issue. The GitHub Actions CI checks that ctypes can be built on Windows.