bsansouci / reprocessing-example

79 stars 27 forks source link

`npm run build` error on the Ubuntu 19.04 #20

Open LaMavia opened 5 years ago

LaMavia commented 5 years ago

I've tried building the [example-flow-field](https://github.com/ekosz/reprocessing-example-flow-field example) and I got this error:

> reprocessing-example@ build /home/tomasz/Desktop/projects/cp-flow
> bsb -make-world

ninja: no work to do.
[1/1] Building run_build_script
FAILED: run_build_script 
/home/tomasz/Desktop/projects/cp-flow/node_modules/Tsdl/lib/bs/bytecode/build_script.exe /home/tomasz/Desktop/projects/cp-flow/node_modules/bs-platform/vendor /home/tomasz/Desktop/projects/cp-flow/node_modules/bs-platform/vendor/ocaml/lib/ocaml /home/tomasz/Desktop/projects/cp-flow/node_modules/Tsdl /home/tomasz/Desktop/projects/cp-flow
Fatal error: cannot load shared library dllunix
Reason: /home/tomasz/.opam/default/lib/ocaml/stublibs/dllunix.so: undefined symbol: caml_ba_element_size
ninja: error: rebuilding 'build.ninja': subcommand failed
Failure: /home/tomasz/Desktop/projects/cp-flow/node_modules/bs-platform/lib/ninja.exe 
 Location: /home/tomasz/Desktop/projects/cp-flow/node_modules/Tsdl/lib/bs/bytecode

I'd gone through other issues, such as #8 but I still couldn't solve it.

Schmavery commented 5 years ago

@bsansouci looks like that global ocaml issue again? @LastShadowPL you said you went through #8, do you have a global ocaml/opam install?

LaMavia commented 5 years ago

To make sure I reinstalled both opam and ocaml. First I installed the ocaml with sudo apt install ocaml, then I downloaded the opam's source code from https://github.com/ocaml/opam/releases and built it according to the guide

./configure --prefix=/home/tomasz/.opam
make lib-ext
make
sudo make install
opam init

I used sudo with the make install, because I ran into errors:

Creating directory /home/tomasz/.opam/doc/opam-core
[ERROR] Failure during install
./opam-installer: "mkdir" failed on /home/tomasz/.opam/doc/opam-core: Permission denied
make: *** [Makefile:133: installlib-core] Error 1
rm opam-core.install

Now when running the npm run build I get something like this:

> reprocessing-example@ build /home/tomasz/Desktop/projects/cp-flow
> bsb -make-world

ninja: no work to do.
[1/1] Building run_build_script
[1/1] Building run_build_script
[1/1] Building run_build_script
[1/1] Building run_build_script
Fatal error: exception Unix.Unix_error(Unix.EPERM, "utimes", "/home/tomasz/Desktop/projects/cp-flow/node_modules/Tgls/lib/ocaml/bytecode/tgls_new.cmi")
LaMavia commented 5 years ago

Now I followed this guide from http://ocaml.org/docs/install.html#OPAM :

# environment setup
opam init
eval `opam env`
# install given version of the compiler
opam switch create 4.06.1
eval `opam env`
# check you got what you want
which ocaml
ocaml -version

Here's the which ocaml output: /home/tomasz/.opam/4.06.1/bin/ocaml And here's the the error:

> reprocessing-example@ build /home/tomasz/Desktop/projects/cp-flow
> bsb -make-world

ninja: no work to do.
[1/1] Building run_build_script
[1/1] Building run_build_script
[1/1] Building run_build_script
[1/1] Building run_build_script
[1/4] Building src/RGLInterface.mlast
FAILED: src/RGLInterface.mlast 
/home/tomasz/Desktop/projects/cp-flow/node_modules/bs-platform/lib/bsc.exe -pp "/home/tomasz/Desktop/projects/cp-flow/node_modules/bs-platform/lib/refmt3.exe --print binary"    -bs-super-errors -w -30-40+6+7+27+32..39+44+45+101-44 -bs-D BSB_BACKEND="bytecode" -nostdlib -I '/home/tomasz/Desktop/projects/cp-flow/node_modules/bs-platform/lib/ocaml' -no-alias-deps -color always -c -o src/RGLInterface.mlast -bs-syntax-only -bs-simple-binary-ast -bs-binary-ast -impl /home/tomasz/Desktop/projects/cp-flow/node_modules/Reasongl/src/RGLInterface.re
File "/home/tomasz/Desktop/projects/cp-flow/node_modules/Reasongl/src/RGLInterface.re", line 217, characters 6-7:
Error: 337: <UNKNOWN SYNTAX ERROR>

  We've found a bug for you!
  /home/tomasz/Desktop/projects/cp-flow/node_modules/Reasongl/src/RGLInterface.re

  There's been an error running Reason's refmt parser on a file.
  This was the command:

  /home/tomasz/Desktop/projects/cp-flow/node_modules/bs-platform/lib/refmt3.exe --print binary '/home/tomasz/Desktop/projects/cp-flow/node_modules/Reasongl/src/RGLInterface.re' > /tmp/ocamlpp534e7d

  Please file an issue on github.com/facebook/reason. Thanks!

ninja: error: rebuilding 'build.ninja': subcommand failed
Failure: /home/tomasz/Desktop/projects/cp-flow/node_modules/bs-platform/lib/ninja.exe 
 Location: /home/tomasz/Desktop/projects/cp-flow/node_modules/Reasongl/lib/bs/bytecode
bsansouci commented 5 years ago

Hey! Awesome that you got this far, I think turning off opam is the simplest way to get around this issue. That being said, the project you forked uses an older version of bsb-native. If you bump that to be “bsb-native”: “4.0.7000” and also make reprocessing be the latest version, it should build better.

Schmavery commented 5 years ago

Sorry about the misunderstanding! To be more clear, as ben said, the current release of bsb-native has a known issue where it sometimes doesn't work with a global opam install because of some env vars that opam shoves in your env that confuse the compiler :) (we actually found a fix last night and we're working on making a release)

LaMavia commented 5 years ago

Hi there. I'm sorry to bother you again, but I updated the bsb-native (global install) to the version 4.0.7000 and linked it in the cloned dir (npm link bsb-native). Now I'm getting this error when running npm run build:

> reprocessing-example@ build /home/tomasz/Desktop/projects/cp-flow
> bsb -make-world

[2/2] Building fake_src/sdl_index.mlast.d
[2/2] Building lib.cma
[4/4] Running build_script
Fatal error: cannot load shared library dllunix
Reason: /home/tomasz/.opam/4.06.1/lib/ocaml/stublibs/dllunix.so: undefined symbol: caml_ba_element_size
ninja: error: rebuilding 'build.ninja': subcommand failed
Failure: /home/tomasz/.npm/lib/node_modules/bsb-native/lib/ninja.exe 
 Location: /home/tomasz/Desktop/projects/cp-flow/node_modules/Tsdl/lib/bs/bytecode
LaMavia commented 5 years ago

I got rid of the last error by installing the flexdll lib. sudo apt install flexdll. Thanks for the help :)

bsansouci commented 5 years ago

Wow ok, that's interesting! Could you print out the value of your env variable: CAML_LD_LIBRARY_PATH from where you were building the app?

I'm going to re-open because this is the issue that we're working on fixing, so you don't have to install anything else. I'm glad you were able to make it work though haha.

LaMavia commented 5 years ago

Sure thing, here you go /home/tomasz/.opam/4.06.1/lib/stublibs:/home/tomasz/.opam/4.06.1/lib/ocaml/stublibs:/home/tomasz/.opam/4.06.1/lib/ocaml