janestreet / base

Standard library for OCaml
MIT License
848 stars 124 forks source link

v0.16.2 is broken with MSVC on Windows #157

Closed jonahbeckford closed 1 year ago

jonahbeckford commented 1 year ago

Because of https://github.com/janestreet/base/blob/a38618a3fbc832c9bcb53724ee1a1e49d7923641/src/int_math_stubs.c#L192C37-L192C37 we get

(cd _build/default/hash_types/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe" -nologo -O2 -Gy- -MD -nologo -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD -nologo -I Z:/source/dkml/build/pkg/bump/.ci/o/PT/lib/ocaml /Fointernalhash_stubs.obj -c internalhash_stubs.c)
internalhash_stubs.c
(cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe" -nologo -O2 -Gy- -MD -nologo -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD -nologo -D_LARGEFILE64_SOURCE -I Z:/source/dkml/build/pkg/bump/.ci/o/PT/lib/ocaml -I Z:\source\dkml\build\pkg\bump\.ci\o\PT\lib\sexplib0 -I ../compiler-stdlib/src -I ../hash_types/src -I ../shadow-stdlib/src /Fobytes_stubs.obj -c bytes_stubs.c)
bytes_stubs.c
(cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe" -nologo -O2 -Gy- -MD -nologo -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD -nologo -D_LARGEFILE64_SOURCE -I Z:/source/dkml/build/pkg/bump/.ci/o/PT/lib/ocaml -I Z:\source\dkml\build\pkg\bump\.ci\o\PT\lib\sexplib0 -I ../compiler-stdlib/src -I ../hash_types/src -I ../shadow-stdlib/src /Foam_testing.obj -c am_testing.c)
am_testing.c
(cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe" -nologo -O2 -Gy- -MD -nologo -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD -nologo -D_LARGEFILE64_SOURCE -I Z:/source/dkml/build/pkg/bump/.ci/o/PT/lib/ocaml -I Z:\source\dkml\build\pkg\bump\.ci\o\PT\lib\sexplib0 -I ../compiler-stdlib/src -I ../hash_types/src -I ../shadow-stdlib/src /Foexn_stubs.obj -c exn_stubs.c)
exn_stubs.c
(cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe" -nologo -O2 -Gy- -MD -nologo -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD -nologo -D_LARGEFILE64_SOURCE -I Z:/source/dkml/build/pkg/bump/.ci/o/PT/lib/ocaml -I Z:\source\dkml\build\pkg\bump\.ci\o\PT\lib\sexplib0 -I ../compiler-stdlib/src -I ../hash_types/src -I ../shadow-stdlib/src /Fohash_stubs.obj -c hash_stubs.c)
hash_stubs.c
File "src/dune", line 14, characters 32-46:
14 |  (c_names bytes_stubs exn_stubs int_math_stubs hash_stubs am_testing)
                                     ^^^^^^^^^^^^^^
(cd _build/default/src && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe" -nologo -O2 -Gy- -MD -nologo -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD -nologo -D_LARGEFILE64_SOURCE -I Z:/source/dkml/build/pkg/bump/.ci/o/PT/lib/ocaml -I Z:\source\dkml\build\pkg\bump\.ci\o\PT\lib\sexplib0 -I ../compiler-stdlib/src -I ../hash_types/src -I ../shadow-stdlib/src /Foint_math_stubs.obj -c int_math_stubs.c)
int_math_stubs.c
int_math_stubs.c(192): error C2143: syntax error: missing ')' before '('
int_math_stubs.c(192): error C2059: syntax error: ')'
int_math_stubs.c(193): error C2146: syntax error: missing ')' before identifier 'caml_csel_value'
int_math_stubs.c(193): error C2091: function returns function
int_math_stubs.c(193): error C2061: syntax error: identifier 'caml_csel_value'
int_math_stubs.c(193): error C2059: syntax error: ';'
int_math_stubs.c(193): error C2059: syntax error: '<parameter-list>'
jonahbeckford commented 1 year ago

I've also asked that this version be marked unavailable for MSVC in the opam repository: https://github.com/ocaml/opam-repository/issues/24151

hhugo commented 1 year ago

Should have been fix by https://github.com/janestreet/base/pull/152 but it seems something when wrong for this release as the previous fix was reverted but the new fix was not applied.

dkalinichenko-js commented 1 year ago

Base.v0.16.2 is marked as unavailable on Windows now, and https://github.com/janestreet/base/pull/152 should be fixed by Base v0.16.3 (I hope :upside_down_face:).