-
Notifications
You must be signed in to change notification settings - Fork 469
"rescript build" crashes on Windows #5517
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
Comments
do you have a local windows box? Is the crash coming from ninja.exe or bsc.exe/bsb_helper.exe? The log is not very informative. if you don't have windows box, maybe you can also run Is the new ninja.exe built with MSVC or MingW?The old one is built with MSVC, I had some bad experience with Mingw |
The new ninja.exe is built with MSVC (see https://github.com/rescript-lang/ninja/blob/rescript/.github/workflows/ci.yml#L28). I do have a Windows VM only, and for some reason it got so excruciatingly slow recently that I can hardly work on it. 😞 I experimented a bit more yesterday though, and if I am not mistaken, then it is actually |
There is a hidden flag that tells rescript.exe only to generate ninja file: https://github.com/rescript-lang/rescript-compiler/blob/master/jscomp/main/rescript_main.ml#L150 |
This is what I get (with or without the $ ./node_modules/rescript/win32/rescript.exe build -verbose
BSB check build spec : Dependencies information missing
Segmentation fault (That is when running in cygwin. When running in cmd.exe, "Segmentation fault" is not displayed.) The |
I now have a setup where I can at least make changes to rescript.ml on Windows and compile them rather quickly. I don't really know how to debug OCaml compiled to native code, so I just added some log statements until I found that the crash occurs when parsing bsconfig.json, at this line: https://github.com/rescript-lang/rescript-compiler/blob/16dceccc07245debf5d4e7ff0f4e5e1af245759b/jscomp/bsb/bsb_parse_sources.ml#L239 With my local paths, this is when calling: Ext_sys.is_directory_no_exn "G:\\packages\\test\\src\\Test.res"
|
What's weird is that this is basically the same code as in https://github.com/ocaml/ocaml/blob/af13e29e0499d479035b064d9d70d9614e76a4fe/runtime/sys.c#L288. There is a compiler warning, however:
|
Ah no, I had already tried to make some changes there, actually without modification the warning is
|
If I add #include "caml/osdeps.h" then the warnings are gone, and the crash is, too! |
With the npm package for 10.0.0-alpha.1 (and the package tarball created by CI in current master), the behavior on Windows is as follows with the package installed in a project:
npx rescript build
causes a crash:This can be observed e.g. here: https://github.com/rescript-lang/rescript-compiler/runs/7209391826?check_suite_focus=true
Compiling a file directly with
bsc
works fine though, as doesnpx rescript -h
:The text was updated successfully, but these errors were encountered: