Can not install bs-platform


#1

Hi all
I am trying to install bs-platform on my ubuntu as following:

developer@khinkali:~$ npm install -g bs-platform
/home/developer/.nvm/versions/node/v9.8.0/bin/bsb -> /home/developer/.nvm/versions/node/v9.8.0/lib/node_modules/bs-platform/lib/bsb
/home/developer/.nvm/versions/node/v9.8.0/bin/bsc -> /home/developer/.nvm/versions/node/v9.8.0/lib/node_modules/bs-platform/lib/bsc
/home/developer/.nvm/versions/node/v9.8.0/bin/bsrefmt -> /home/developer/.nvm/versions/node/v9.8.0/lib/node_modules/bs-platform/lib/bsrefmt

> bs-platform@2.2.3 postinstall /home/developer/.nvm/versions/node/v9.8.0/lib/node_modules/bs-platform
> node scripts/install.js

No working prebuilt compiler
/bin/sh: 1: ocamlc.opt: not found
Build a local version of OCaml compiler, it may take a couple of minutes
configure again with local ocaml installed
The OCaml compiler, version 4.02.3+BS
Standard library directory: /home/developer/.nvm/versions/node/v9.8.0/lib/node_modules/bs-platform/vendor/ocaml/lib/ocaml

Use the compiler above
config finished
Making compiler
make -B -C lib -j 6 all
make[1]: Entering directory '/home/developer/.nvm/versions/node/v9.8.0/lib/node_modules/bs-platform/lib'
ocamlopt.opt -g -w -40-30 ../jscomp/stubs/ext_basic_hash_stubs.c whole_compiler.mli whole_compiler.ml  -o bsc.exe
ocamlopt.opt -g -w -40-30 ../jscomp/stubs/ext_basic_hash_stubs.c unix.cmxa str.cmxa bsb.mli bsb.ml -o bsb.exe
ocamlopt.opt -g -w -40-30 ../jscomp/stubs/ext_basic_hash_stubs.c bsppx.mli bsppx.ml -o bsppx.exe
ocamlopt.opt -g -w -40-30 ../jscomp/stubs/ext_basic_hash_stubs.c unix.cmxa -w -a bsb_helper.mli bsb_helper.ml -o bsb_helper.exe
ocamlopt.opt -w -40-30 -no-alias-deps -I +compiler-libs ocamlcommon.cmxa refmt_main3.mli refmt_main3.ml -o refmt.exe
ocamlopt.opt -w -40-30 -no-alias-deps -I +compiler-libs ocamlcommon.cmxa reactjs_jsx_ppx_v2.mli reactjs_jsx_ppx_v2.ml -o reactjs_jsx_ppx_2.exe
File "reason_parser.mly", line 2562, characters 12-155:
Warning 21: this statement never returns (or has an unsound type.)
File "reason_parser.mly", line 2562, characters 12-155:
Warning 21: this statement never returns (or has an unsound type.)
File "reason_parser.mly", line 2562, characters 12-155:
Warning 21: this statement never returns (or has an unsound type.)
File "reason_parser.mly", line 2562, characters 12-155:
Warning 21: this statement never returns (or has an unsound type.)
File "reason_parser.mly", line 2562, characters 12-155:
Warning 21: this statement never returns (or has an unsound type.)
File "reason_parser.mly", line 2562, characters 12-155:
Warning 21: this statement never returns (or has an unsound type.)
File "reason_parser.mly", line 3139, characters 58-59:
Warning 28: wildcard pattern given as argument to a constant constructor
File "reason_parser.mly", line 3139, characters 58-59:
Warning 28: wildcard pattern given as argument to a constant constructor
Makefile:31: recipe for target 'bsc.exe' failed
make[1]: *** [bsc.exe] Segmentation fault (core dumped)
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/developer/.nvm/versions/node/v9.8.0/lib/node_modules/bs-platform/lib'
Makefile:9: recipe for target 'world' failed
make: *** [world] Error 2
child_process.js:615
    throw err;
    ^

Error: Command failed: make world && make install
    at checkExecSyncError (child_process.js:575:11)
    at Object.execSync (child_process.js:612:13)
    at non_windows_npm_release (/home/developer/.nvm/versions/node/v9.8.0/lib/node_modules/bs-platform/scripts/install.js:157:23)
    at Object.<anonymous> (/home/developer/.nvm/versions/node/v9.8.0/lib/node_modules/bs-platform/scripts/install.js:179:5)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Function.Module.runMain (module.js:690:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bs-platform@2.2.3 postinstall: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bs-platform@2.2.3 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/developer/.npm/_logs/2018-04-05T18_09_00_457Z-debug.log  

As you can see I’ve got the error message. What am I doing wrong?
Thanks


#2

I’m not sure but please try this:

sudo apt-get install make

#3

Mmmh the actual error seems to be make[1]: *** [bsc.exe] Segmentation fault (core dumped) which is really messed up.

Could you clone github.com/bucklescript/bucklescript and modify this line https://github.com/BuckleScript/bucklescript/blob/cd266b960c1a0f647799d4341810b2d23111fcda/Makefile#L10 to be $(MAKE) -B -C lib all (so it doesn’t build in parallel) and run node scripts/install.js (which should do the whole build process).
Maybe this is a concurrency issue.


#4

Solved. The version of gcc was old