rescript-lang / rescript-compiler

The compiler for ReScript.
https://rescript-lang.org
Other
6.68k stars 445 forks source link

`scripts/ninja.js config` depends on shipped `linux/refmt.exe` #5187

Closed Minnozz closed 3 years ago

Minnozz commented 3 years ago

I tried to build rescript-compiler on NixOS. Normal Linux binaries do not work on NixOS, so it is expected that shipped binaries do not work. When I followed these steps, the scripts/ninja.js config command failed:

(...)
rescript: [70/70] ../linux/bsc.byte
(node:20841) UnhandledPromiseRejectionWarning: Error: Command failed: /home/bart.schuurmans/src/github.com/Minnozz/rescript-compiler/native/4.06.1/bin/ocamldep.opt -pp '../../linux/refmt.exe --print=binary' -modules -one-line -native -ml-synonym .re -mli-synonym .rei arity.re gentTypeReTest.re gpr_3865.re gpr_3865_bar.re gpr_3865_foo.re lazy_demo.re method_string_name.re re_first_test.re react.re reactDOMRe.re reactDOMServerRe.re reactEvent.re reactEvent.rei reactTestUtils.re reactTestUtils.rei reasonReact.re reasonReact.rei reasonReactCompat.re reasonReactCompat.rei reasonReactOptimizedCreateClass.re reasonReactRouter.re reasonReactRouter.rei recursive_react_component.re
sh: ../../linux/refmt.exe: No such file or directory
File "arity.re", line 1, characters 0-0:
Error: Error while running external preprocessor
Command line: ../../linux/refmt.exe --print=binary 'arity.re' > /run/user/1000/ocamlppd80699

sh: ../../linux/refmt.exe: No such file or directory
File "gentTypeReTest.re", line 1, characters 0-0:
Error: Error while running external preprocessor
Command line: ../../linux/refmt.exe --print=binary 'gentTypeReTest.re' > /run/user/1000/ocamlpp53ec29

sh: ../../linux/refmt.exe: No such file or directory
File "gpr_3865.re", line 1, characters 0-0:
Error: Error while running external preprocessor
Command line: ../../linux/refmt.exe --print=binary 'gpr_3865.re' > /run/user/1000/ocamlppe11994

(...)

It seems the shipped refmt.exe is used before it is (re)compiled locally.

bobzhang commented 3 years ago

Note there are two modes of build. dev build and release build, the dev build is not expected to work while the release build should work, the release build also supports build from source. The refmt is legacy stuff, if you do the release build, it should not matter

bobzhang commented 3 years ago

close this. In general, if you have build questions, you are welcome to ask on the forum, I will answer it there