rustler icon indicating copy to clipboard operation
rustler copied to clipboard

Compilation fails due to permision denied on shared object in `priv/native` while working as a root

Open ytoml opened this issue 3 years ago • 0 comments

Hello, I'm encountered error on file rights in compilation. I'm working on Docker container based on the official docker.io/elixir:otp-25 image (running on lima vm and the host machine is M1 macbook pro).

Now I'm following tutorials on documentation and trying to just confirm that add function (generated by default) works. And I encompilation fails on write permission on shared object in priv/native while I'm working as root in container.

root@2c0fb44e416c: /workspace/minialgo
$ iex -S mix
Erlang/OTP 25 [erts-13.0.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]

Compiling 1 file (.ex)
Compiling crate algocore in debug mode (native/algocore)
    Finished dev [unoptimized + debuginfo] target(s) in 0.21s

== Compilation error in file lib/minialgo.ex ==
** (File.Error) could not write file stats "priv/native/libalgocore.so": permission denied
    (elixir 1.13.4) lib/file.ex:526: File.write_stat!/3
    (elixir 1.13.4) lib/file.ex:961: File.do_cp_file/4
    (elixir 1.13.4) lib/file.ex:795: File.cp/3
    (elixir 1.13.4) lib/file.ex:813: File.cp!/3
    (elixir 1.13.4) lib/enum.ex:937: Enum."-each/2-lists^foreach/1-0-"/2
    (rustler 0.25.0) lib/rustler/compiler.ex:44: Rustler.Compiler.compile_crate/2
    lib/minialgo.ex:2: (module)

I'm sorry if it's not an issue on rustler compiler itself, but does anyone have an idea on this?

ytoml avatar Jul 23 '22 06:07 ytoml