mlir-playground
mlir-playground copied to clipboard
impr(cpp/build-compiler-in-docker.sh)
Permission
build-compiler-inside-docker
pwd may be a symbolic directory. If it is a symbolic, the creation will fail due to permission deny. Replaced it with readlink will fix this.
add support to develop inside docker
npm will install files requiring sudo. That is better to be done inside docker:
pushd cpp
bash create_mlir-wasm.sh
docker start -a -i mlir-playground
# enter into docker
(in_docker_dev)user@host#
@yiakwy-xpu-ml-framework-team Thanks for contributing! Could you clarify which step caused the "permission denied" error, and what kind of permission it was looking for?
I tried locally accessing the workspace via a symlink, and running build-compiler-in-docker.sh while working under the symlink, and it seems to be working for me, so I'm wondering if it's some other related issue. Thank you!
it may relates my local env docker run --rm -w /app/ -v $(pwd):/app/ $image bash -c "./build-compiler.sh" . If one want to bind pwd to a docker path, this may fail if pwd does not point to the actual path and the users don't have privileges write with sudo .
# soft link to /mnt/some_disk/user_name/WorkSpace
~/WorkSpace
cd ~/WorkSpace/Github/mlir-playground
# pwd points to /home/user_name/WorkSpace/Github/mlir-playground, docker will complain that it has no permissions to access /home/user_name/WorkSpace/Github/
Do you have any special permissions set in your workspace? This is what I tried, let me know how it differs from your setup.
mkdir original
ln -s original workspace
cd workspace
git clone <github link>
cd mlir-playground/cpp
./build-compiler-in-docker.sh
This works fine for me, so I want to make sure I can understand what's different in your local environment. Thanks!
I wonder if it's because currently the default user being run inside docker is not yourself. If so, can you try adding -u $(id -u) to the docker run command in the script and see if that works?
@zyx-billy Usually, in this workstation, we don't build anything in the physical machine, and just start a docker or using a cmake package manage system to pull dependencies in a local directory and build it.
Any attempt to install package in system path usr/ usr/local ... will trigger a OAUTH process and need to be verified by IT. Very complicated.
@zyx-billy adding -u $(id -u) won't work
# adding -u $(id -u) won't work. One needs to register the user and annotate the user no passwd required
(py39) leiw@sgjur-pod006-3:~/WorkSpace/Github/mlir-playground/cpp$ bash build-compiler-in-docker_v1.sh
docker: Error response from daemon: error while creating mount source path '/home/leiw/WorkSpace/Github/mlir-playground/cpp': mkdir /home/leiw/WorkSpace: permission denied.
# using the updated script
(py39) leiw@sgjur-pod006-3:~/WorkSpace/Github/mlir-playground/cpp$ bash build-compiler-in-docker.sh
/opt/llvm/llvm-project /app/build/bin
/app/build/bin
compressing package of size 77806918
compressed package into 32787377
compressed in 720 ms
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libGL.a
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libal.a
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libhtml5.a
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libstubs-debug.a
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libnoexit.a
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc-debug.a
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libdlmalloc.a
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libcompiler_rt.a
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++-noexcept.a
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++abi-noexcept.a
/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libsockets.a
compressing package of size 146771844
compressed package into 79797140
compressed in 1566 ms
(py39) leiw@sgjur-pod006-3:~/WorkSpace/Github/mlir-playground/cpp$
oh interesting... found a couple similar cases online as well. Your readlink fix looks good.
As for the create_mlir-wasm script, it looks like it contains some user-specific configs. Can you strip it down to a more minimal one (such as just a mount directory and other required options), and users can customize it with their own flags if they need to.
Can you also rename the file to be more consistent with using - instead of _, and then add a line at the top of the file describing what it does (and the shebang line for bash)? Thank you!