lichess-org / stockfish.js

The strong open source chess engine Stockfish compiled to JavaScript and WebAssembly using Emscripten
GNU General Public License v3.0
200 stars 29 forks source link

em++:Permission denied while running with docker #8

Closed vjuneja closed 7 years ago

vjuneja commented 7 years ago

cannot run with docker. Getting this permission error inside docker container.

vjuneja$ docker run --volume $PWD:/home/builder/stockfish.js --user $(id -u) niklasf/emscripten-for-stockfish
Makefile:613: recipe for target '.depend' failed
make: [.depend] Error 127 (ignored)

Config:
debug: 'no'
sanitize: 'no'
optimize: 'yes'
arch: 'any'
bits: '32'
kernel: 'Linux'
os: 'GNU/Linux'
prefetch: 'no'
popcnt: 'no'
sse: 'no'
pext: 'no'

Flags:
CXX: em++
CXXFLAGS: -Wall -Wcast-qual -std=c++11  -DANTI -DATOMIC -DCRAZYHOUSE -DHORDE -DKOTH -DRACE -DTHREECHECK -DUSELONGESTPV -DNDEBUG -O3 -DNO_PREFETCH
LDFLAGS:  -s TOTAL_MEMORY=33554432 --memory-init-file 0 -s NO_EXIT_RUNTIME=1 -s EXPORTED_FUNCTIONS=[_main, _uci_command] --pre-js pre.js --post-js post.js -O3

Testing config sanity. If this fails, try 'make help' ...

make ARCH=js COMP=emscripten all
make[1]: Entering directory '/home/builder/stockfish.js/src'
Makefile:613: recipe for target '.depend' failed
make[1]: [.depend] Error 127 (ignored)
em++ -Wall -Wcast-qual -std=c++11  -DANTI -DATOMIC -DCRAZYHOUSE -DHORDE -DKOTH -DRACE -DTHREECHECK -DUSELONGESTPV -DNDEBUG -O3 -DNO_PREFETCH   -c -o bitbase.o bitbase.cpp
make[1]: execvp: em++: Permission denied
<builtin>: recipe for target 'bitbase.o' failed
make[1]: *** [bitbase.o] Error 127
make[1]: Leaving directory '/home/builder/stockfish.js/src'
Makefile:491: recipe for target 'build' failed
make: *** [build] Error 2
vjuneja$

Tried running assudo as well.

niklasf commented 7 years ago

Hi, I have no idea what's going on. You could try

docker run --volume $PWD:/home/builder/stockfish.js --user $(id -u) -t -i niklasf/emscripten-for-stockfish /bin/bash

to launch a bash in the docker environment.

Intresting would then be to see how the permissions look like inside the container:

ls -l src
vjuneja commented 7 years ago

The problem was the --user setting that is specified in the readme.md. Based on docker documentation not specifying that runs it as "root" and does not give that error.

https://docs.docker.com/engine/reference/run/#user

I have filed https://github.com/niklasf/stockfish.js/pull/10 if you want to update the readme.

I will close this issue regardless.

niklasf commented 7 years ago

I am curious if you could try the following, slightly changed command without root permissions:

docker run --user $(id -u):$(id -g) --volume $(pwd):/home/builder/stockfish.js:rw niklasf/emscripten-for-stockfish

It's probably best do remove and reclone the repository, to ensure files that are now already owned by root don't interfere.

vjuneja commented 7 years ago

I tried the new command but still got permission denied.

niklasf commented 7 years ago

Thanks for testing.