Installation of compiler fails (probably due to glibc 2.34)

$ npm install rescript --save-dev

...
No prebuilt Ninja, building Ninja now
bootstrapping ninja...
...
bootstrap complete.  rebuilding...
ninja binary is ready:  <dir>/node_modules/rescript/linux/ninja.exe
No working prebuilt buckleScript compiler
...
Configuring OCaml version 4.06.1+BS
...
signals_asm.c:185:13: error: variably modified ‘sig_alt_stack’ at file scope
  185 | static char sig_alt_stack[SIGSTKSZ];
      |             ^~~~~~~~~~~~~
make[3]: *** [Makefile:150: signals_asm.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/home/jayesh/projects/hillridge/simulated-yield/node_modules/rescript/ocaml/asmrun'
make[2]: *** [Makefile:1007: makeruntimeopt] Error 2
make[2]: Leaving directory '/home/jayesh/projects/hillridge/simulated-yield/node_modules/rescript/ocaml'
make[1]: *** [Makefile:484: opt.opt] Error 2
make[1]: Leaving directory '/home/jayesh/projects/hillridge/simulated-yield/node_modules/rescript/ocaml'
make: *** [Makefile:556: world.opt] Error 2
child_process.js:866
    throw err;
    ^

Error: Command failed: make -j9 world.opt && make install 
    at checkExecSyncError (child_process.js:790:11)
    at Object.execSync (child_process.js:863:15)
    at Object.build (/home/jayesh/projects/hillridge/simulated-yield/node_modules/rescript/scripts/buildocaml.js:70:6)
    at provideCompiler (/home/jayesh/projects/hillridge/simulated-yield/node_modules/rescript/scripts/install.js:190:34)
    at Object.<anonymous> (/home/jayesh/projects/hillridge/simulated-yield/node_modules/rescript/scripts/install.js:219:1)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12) {
  status: 2,
  signal: null,
  output: [ null, null, null ],
  pid: 51891,
  stdout: null,
  stderr: null
}

I found an issue on ocaml repo (https://github.com/ocaml/ocaml/issues/10250) which talks about this issue. The root cause was determined to be a change in glibc 2.34. The problem has been fixed there, but on more recent (and stock) versions of the ocaml compiler.

glibc on my system is indeed 2.34.

$  ldd --version
ldd (GNU libc) 2.34
...

I suspect more and more people will start encountering this error soon because rescript uses OCaml 4.06 (if my understanding is correct).

Full log here: Rescript installation error (probably due to glibc 2.34) - Pastebin.com

Can you install OCaml on your system? Which version is default?

I can install OCaml via opam.

$ opam init
...
<><> Creating initial switch 'default' (invariant ["ocaml" {>= "4.05.0"}] - initially with ocaml-base-compiler) 

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml" {>= "4.05.0"}]
[NOTE] External dependency handling not supported for OS family 'nixos'.
       You can disable this check using 'opam option --global depext=false'

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
∗ installed ocaml-options-vanilla.1
⬇ retrieved ocaml-base-compiler.4.14.0  (https://opam.ocaml.org/cache)
∗ installed ocaml-base-compiler.4.14.0
∗ installed ocaml-config.2
∗ installed ocaml.4.14.0
Done.

Follow-up and resolution at https://github.com/rescript-lang/rescript-compiler/issues/5494