Installation fails on Mac M1

The build process went further than I thought. It looks like the boot and bytecode versions of ocaml built and ran. However the process failed to build world.opt:

npm ERR! Error: Command failed: make -j9 world.opt && make install 
npm ERR!     at checkExecSyncError (node:child_process:828:11)
npm ERR!     at Object.execSync (node:child_process:902:15)
npm ERR!     at (/Users/haitao/proj/mathui/node_modules/rescript/scripts/buildocaml.js:70:6)
npm ERR!     at provideCompiler (/Users/haitao/proj/mathui/node_modules/rescript/scripts/install.js:190:34)
npm ERR!     at Object.<anonymous> (/Users/haitao/proj/mathui/node_modules/rescript/scripts/install.js:219:1)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1103:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
npm ERR!   status: 2,
npm ERR!   signal: null,
npm ERR!   output: [ null, null, null ],
npm ERR!   pid: 68629,
npm ERR!   stdout: null,
npm ERR!   stderr: null
npm ERR! }

Other than C99 warnings the critical error appears to be:

npm ERR! make[3]: *** No rule to make target `none.o', needed by `libasmrun.a'.  Stop.

It appears to be working on yacc right before the error:

npm ERR! x yacc/
npm ERR! x yacc/Makefile
npm ERR! x yacc/Makefile.nt
npm ERR! x yacc/closure.c
npm ERR! x yacc/defs.h
npm ERR! x yacc/error.c
npm ERR! x yacc/lalr.c
npm ERR! x yacc/lr0.c
npm ERR! x yacc/main.c
npm ERR! x yacc/mkpar.c
npm ERR! x yacc/output.c
npm ERR! x yacc/reader.c
npm ERR! x yacc/skeleton.c
npm ERR! x yacc/symtab.c
npm ERR! x yacc/verbose.c
npm ERR! x yacc/warshall.c

I use ReScript on an M1 Mac without any issue. Let me know if I can be of any help.

Thanks! Are you using native builds (no rosetta)? Did your install build its own ocaml? My failure is when building ocaml 4.06.1+BS:

npm ERR! Configuring OCaml version 4.06.1+BS
npm ERR! Configuring for host arm-apple-darwin21.4.0 ...
npm ERR! Configuring for target arm-apple-darwin21.4.0 ...

And it failed at the final stage building the native version of the optimizing compiler (opt.opt). It appears I asked the same question over a year ago. So maybe there has not been much progress here.

As far as I know, rescript is still not compatible with M1 without Rosetta

Probably rosetta. I simply install the npm rescript package, and it doesn’t seem like it builds from source, probably comes with a binary.