bsansouci / reprocessing-example

79 stars 27 forks source link

`npm run start:native` and `npm run start` fail with "That operation is not supported" #13

Open joshmhanson opened 6 years ago

joshmhanson commented 6 years ago

System: Ubuntu 18.04. Note that I happen to have an OCaml compiler installed (the BuckleScript version), but this shouldn't make a difference.

All three build commands worked fine, but the two of the three start commands are not working, as you can see below.

start:native

$ npm run start:native

> reprocessing-example@ start:native /home/hanjiexi/reprocessing-example
> ./lib/bs/native/index.native

Fatal error: exception Failure("That operation is not supported")
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! reprocessing-example@ start:native: `./lib/bs/native/index.native`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the reprocessing-example@ start:native 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/hanjiexi/.npm/_logs/2018-10-23T05_49_49_922Z-debug.log

Referenced debug log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'start:native' ]
2 info using npm@6.4.1
3 info using node@v8.12.0
4 verbose run-script [ 'prestart:native', 'start:native', 'poststart:native' ]
5 info lifecycle reprocessing-example@~prestart:native: reprocessing-example@
6 info lifecycle reprocessing-example@~start:native: reprocessing-example@
7 verbose lifecycle reprocessing-example@~start:native: unsafe-perm in lifecycle true
8 verbose lifecycle reprocessing-example@~start:native: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/hanjiexi/reprocessing-example/node_modules/.bin:/home/hanjiexi/.opam/4.02.3+buckle-master/bin:/home/hanjiexi/.cargo/bin:/home/hanjiexi/.yarn/bin:/home/hanjiexi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-9-oracle/bin:/usr/lib/jvm/java-9-oracle/db/bin
9 verbose lifecycle reprocessing-example@~start:native: CWD: /home/hanjiexi/reprocessing-example
10 silly lifecycle reprocessing-example@~start:native: Args: [ '-c', './lib/bs/native/index.native' ]
11 silly lifecycle reprocessing-example@~start:native: Returned: code: 2  signal: null
12 info lifecycle reprocessing-example@~start:native: Failed to exec start:native script
13 verbose stack Error: reprocessing-example@ start:native: `./lib/bs/native/index.native`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:915:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid reprocessing-example@
15 verbose cwd /home/hanjiexi/reprocessing-example
16 verbose Linux 4.15.0-38-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "start:native"
18 verbose node v8.12.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error reprocessing-example@ start:native: `./lib/bs/native/index.native`
22 error Exit status 2
23 error Failed at the reprocessing-example@ start:native script.
23 error This is probably not a problem with npm. There is likely additional logging output above.

start

npm run start

> reprocessing-example@ start /home/hanjiexi/reprocessing-example
> ./lib/bs/bytecode/indexhot.byte

ninja: no work to do.
bsb running with pid: 13072
Reloading hotloaded module
Successfully changed functions
Stale file detected :  /home/hanjiexi/reprocessing-example/.bsb.lock
Retry:
>>>> Start compiling
ninja: no work to do.
>>>> Finish compiling
Fatal error: exception Failure("Unknown error while loading plugin: Failure(\"That operation is not supported\")")
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! reprocessing-example@ start: `./lib/bs/bytecode/indexhot.byte`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the reprocessing-example@ start 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/hanjiexi/.npm/_logs/2018-10-23T05_50_53_388Z-debug.log

Referenced debug log:

1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'start' ]
2 info using npm@6.4.1
3 info using node@v8.12.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle reprocessing-example@~prestart: reprocessing-example@
6 info lifecycle reprocessing-example@~start: reprocessing-example@
7 verbose lifecycle reprocessing-example@~start: unsafe-perm in lifecycle true
8 verbose lifecycle reprocessing-example@~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/hanjiexi/reprocessing-example/node_modules/.bin:/home/hanjiexi/.opam/4.02.3+buckle-master/bin:/home/hanjiexi/.cargo/bin:/home/hanjiexi/.yarn/bin:/home/hanjiexi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-9-oracle/bin:/usr/lib/jvm/java-9-oracle/db/bin
9 verbose lifecycle reprocessing-example@~start: CWD: /home/hanjiexi/reprocessing-example
10 silly lifecycle reprocessing-example@~start: Args: [ '-c', './lib/bs/bytecode/indexhot.byte' ]
11 silly lifecycle reprocessing-example@~start: Returned: code: 2  signal: null
12 info lifecycle reprocessing-example@~start: Failed to exec start script
13 verbose stack Error: reprocessing-example@ start: `./lib/bs/bytecode/indexhot.byte`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:915:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid reprocessing-example@
15 verbose cwd /home/hanjiexi/reprocessing-example
16 verbose Linux 4.15.0-38-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "start"
18 verbose node v8.12.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error reprocessing-example@ start: `./lib/bs/bytecode/indexhot.byte`
22 error Exit status 2
23 error Failed at the reprocessing-example@ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

Appreciate any help!

Schmavery commented 6 years ago

Do any of the executables exist in the lib folder? ex: lib/bs/native/index.native or lib/bs/bytecode/indexhot.byte? If so, I'm guessing you get the same result when invoking those binaries directly (taking npm out of the equation)?

joshmhanson commented 6 years ago

Yep that's correct. When attempting to run the files directly, I got the plain "operation not supported" error without all the surrounding npm-generated noise.

On Tue, Oct 23, 2018, 6:39 PM Avery Morin notifications@github.com wrote:

Do any of the executables exist in the lib folder? ex: lib/bs/native/index.native or lib/bs/bytecode/indexhot.byte? If so, I'm guessing you get the same result when invoking those binaries directly (taking npm out of the equation)?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bsansouci/reprocessing-example/issues/13#issuecomment-432447277, or mute the thread https://github.com/notifications/unsubscribe-auth/AFbnYlBgx7urvm8J6ATwYt4HmzkOd2FSks5un5qTgaJpZM4X0wdl .

joshmhanson commented 6 years ago

To follow up on this: I tried it on a different computer (also Ubuntu 18.04) but one that didn't have OCaml installed. I made a fresh install of ReasonML and followed the exact instructions for the reprocessing-example.

This time, I got almost exactly the same result except that the error is different. Under Wayland, it would say "wayland not available", and underxorg, it says that there's no graphics device available.

Schmavery commented 6 years ago

Hmm, thanks for following up. The issue with an existing ocaml install might be something @bsansouci is interested in for bsb-native, whereas the graphics device issue seems like more complications with how we're building sdl2 on linux (which has ended up being very picky).

You can see we've tried to fix this a couple of different ways (https://github.com/Schmavery/reprocessing/issues/74#issuecomment-390326310) but it looks like there's something we've overlooked, so thanks for pointing it out! Likely we will need as much of your help as we can get to help debug it as we're pretty much guessing when it comes to some of this linux configuration stuff.

We do this hack to try and detect and enable wayland support: https://github.com/bsansouci/reasongl/commit/e664d18961a49960fbedb8fcaa941a7b45276fe3 but maybe it isn't getting detected properly on your machine. Can you try setting the environment variable SDL_VIDEODRIVER=wayland manually before running the reprocessing binary? If we're lucky, that will work.

If that doesn't work and you want to fiddle with how we invoke the configure command for building sdl2, you can find that here: https://github.com/bsansouci/SDL-mirror/blob/fast/postinstall.js#L74

cc @zploskey fwiw as he was invaluable last time we had issues like this (in case you're interested)

zploskey commented 6 years ago

I just ran through the basic build process for this repo at a46f1e0d32a4e1f122ce092f6ecd57e3d968071d on Ubuntu 18.04 running Xorg. It does not deal well with having an ocaml compiler in the path (at least not the 4.06.1 opam switch I was on), complaining about a DLL. Once I removed my opam binaries from the path, though, everything built fine and I was able to run them demo for both bytecode and native.

I would suggest perhaps installing the same packages that we pull in to run the Travis build: https://github.com/Schmavery/reprocessing/blob/master/.travis.yml

sudo apt install libsdl2-dev fcitx-libs-dev libibus-1.0-dev

I have these installed and it works. I think the goal is to be able to build without having to manually install additional packages, so we may need to work on making sure we install all required dependencies in one way or another. I've said before I don't think Linux users would mind having to install their system SDL library rather than building it ourselves as long as its spelled out in the instructions. Currently I think we're missing some required dependencies on Linux.

Schmavery commented 6 years ago

Thanks for trying it on your machine! If that's what it takes, we can definitely add a note about that and then potentially look into fixing it

joshmhanson commented 6 years ago

Thanks for your feedback @Schmavery and @zploskey.

I did try it again quickly this morning with the SDL_VIDEODRIVER=wayland and this did not change anything under Wayland.

Regarding having OCaml in the path, I originally had OCaml 4.07 installed and encountered the same Fatal error: cannot load shared library dllunix issue as was experienced in #8. I opam switched to the BuckleScript fork of the OCaml compiler, which resolved this particular issue on the machine where I had OCaml installed.

I'll also note that opam 2.0 supports local switches so this should hypothetically make it possible to work around the global OCaml installation issue by having a local OCaml switch set to the BuckleScript fork. I haven't tested this yet.

When I get the chance I will make another attempt after installing the dependencies you mention above on both my system with OCaml and my system without OCaml. (By the way, libsdl2-dev is unsurprising, but why fcitx and ibus?)

zploskey commented 6 years ago

Feel free to try it without fcitx and/or ibus and see if you have any issues. That list came out of some experimentation when setting up TravisCI for Reprocessing.

Schmavery commented 6 years ago

Yeah by all means let us know if some of those aren't required haha

joshmhanson commented 6 years ago

You were right: SDL2 wasn't enough. sudo apt install libsdl2-dev fcitx-libs-dev libibus-1.0-dev and then rebuilding reprocessing was necessary to get it working in both native and bytecode. At some point I will attempt testing a local opam switch as well.

Schmavery commented 6 years ago

@hanjiexi for now, I added a note to the reprocessing repo that linux users may need those deps. Thanks for following up. https://github.com/Schmavery/reprocessing/blob/master/README.md#getting-started

crakoucas commented 5 years ago

Same error - Ubuntu 18.10 - Gnome - Wayland Fatal error: exception Failure("Unknown error while loading plugin: Failure(\"wayland not available\")") Works well under Ubuntu 18.10 - Gnome - Xorg

Schmavery commented 5 years ago

@crakoucas sorry to hear that, can you give a couple more details and let us know what happens when you try the debugging steps above?

crakoucas commented 5 years ago

I Follow the Readme for the install with

sudo apt install libsdl2-dev fcitx-libs-dev libibus-1.0-dev

Everything works fine on Ubuntu 18.10 Opengl but in Wayland =>

npm start                  
> reprocessing-example@ start /home/renaud/Dev/reprocessing-example
> ./lib/bs/bytecode/indexhot.byte
ninja: no work to do.
bsb running with pid: 19522
Reloading hotloaded module
Successfully changed functions
Fatal error: exception Failure("Unknown error while loading plugin: Failure(\"wayland not available\")")
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! reprocessing-example@ start: `./lib/bs/bytecode/indexhot.byte`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the reprocessing-example@ start 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/renaud/.npm/_logs/2019-01-30T17_16_10_342Z-debug.log

Debug.log

❯ cat /home/renaud/.npm/_logs/2019-01-30T17_21_23_335Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli   '/home/renaud/.npm-packages/bin/npm',
1 verbose cli   'run',
1 verbose cli   'start' ]
2 info using npm@6.7.0
3 info using node@v10.15.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle reprocessing-example@~prestart: reprocessing-example@
6 info lifecycle reprocessing-example@~start: reprocessing-example@
7 verbose lifecycle reprocessing-example@~start: unsafe-perm in lifecycle true
8 verbose lifecycle reprocessing-example@~start: PATH: /home/renaud/.npm-packages/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/renaud/Dev/reprocessing-example/node_modules/.bin:/home/renaud/go/bin:/home/renaud/.rbenv/plugins/ruby-build/bin:/home/renaud/.rbenv/shims:/home/renaud/.rbenv/shims:/home/renaud/.rbenv/bin:/home/renaud/.npm-packages/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/renaud/Android/Sdk/tools:/home/renaud/Android/Sdk/tools/bin:/home/renaud/Android/Sdk/platform-tools:/home/renaud/Android/Sdk/emulator:/home/renaud/.fzf/bin
9 verbose lifecycle reprocessing-example@~start: CWD: /home/renaud/Dev/reprocessing-example
10 silly lifecycle reprocessing-example@~start: Args: [ '-c', './lib/bs/bytecode/indexhot.byte' ]
11 silly lifecycle reprocessing-example@~start: Returned: code: 2  signal: null
12 info lifecycle reprocessing-example@~start: Failed to exec start script
13 verbose stack Error: reprocessing-example@ start: `./lib/bs/bytecode/indexhot.byte`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/home/renaud/.npm-packages/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (/home/renaud/.npm-packages/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid reprocessing-example@
15 verbose cwd /home/renaud/Dev/reprocessing-example
16 verbose Linux 4.18.0-13-generic
17 verbose argv "/usr/bin/node" "/home/renaud/.npm-packages/bin/npm" "run" "start"
18 verbose node v10.15.1
19 verbose npm  v6.7.0
20 error code ELIFECYCLE
21 error errno 2
22 error reprocessing-example@ start: `./lib/bs/bytecode/indexhot.byte`
22 error Exit status 2
23 error Failed at the reprocessing-example@ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
bsansouci commented 5 years ago

@crakoucas Thanks for the debug info. Do you have the WAYLAND_DISPLAY env variable set to something? We'd added this hack to fix Wayland support but it might not be reliable. Can you try setting SDL_VIDEODRIVER=wayland before running the executable? Does this also happen in native?

Alternatively do you have XDG_SESSION_TYPE set to anything?

crakoucas commented 5 years ago

@bsansouci WAYLAND_DISPLAY is set to

WAYLAND_DISPLAY=wayland-0

and when i try with SDL_VIDEODRIVER=wayland => Same error also in native

npm run start:native                                                         
> reprocessing-example@ start:native /home/renaud/Dev/reprocessing-example
> ./lib/bs/native/index.native
Fatal error: exception Failure("wayland not available")
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! reprocessing-example@ start:native: `./lib/bs/native/index.native`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the reprocessing-example@ start:native 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/renaud/.npm/_logs/2019-01-30T20_46_38_552Z-debug.log

And finally XDG_SESSION_TYPE is set to wayland