use-ink / cargo-contract

Setup and deployment tool for developing Wasm based smart contracts via ink!
GNU General Public License v3.0
244 stars 120 forks source link

permission denied error while trying to create a verifiable build #1262

Open abhijeetbhagat opened 1 year ago

abhijeetbhagat commented 1 year ago

getting a permission denied error:

(rust:nightly) ↪ cargo contract build --verifiable
 [1/3] Image does not exist. Pulling one from the registry
4.0.0-alpha: Pulling from paritytech/contracts-verifiable
7eaf8c23e6d5: Pull complete
6f3e3b4845f0: Pull complete
ac4d710538ca: Pull complete
01f0e1379a81: Pull complete
Digest: sha256:a3cc95b6e3d54981774e20760da094ba038e666190c57bb01f932c145f1b4f71
Status: Downloaded newer image for paritytech/contracts-verifiable:4.0.0-alpha
 [2/3] Started the build inside the container: ink-verified-verifiablecontract-34568
warning: nothing to print.

To find dependencies that require specific target platforms, try to use option `--target all` first, and then narrow your search scop
e accordingly.
 [1/*] Building cargo project
warning: You are using a rustc version that might emit unsupported wasm instructions. Build using a version lower than 1.70.0 to make
 sure your contract will deploy.
    Updating crates.io index
  Downloaded cc v1.0.77
  Downloaded dlmalloc v0.2.3
  Downloaded getopts v0.2.21
  Downloaded rustc-demangle v0.1.21
  Downloaded hashbrown v0.13.1
  Downloaded compiler_builtins v0.1.92
  Downloaded libc v0.2.143
  Downloaded 7 crates (1.1 MB) in 0.56s
error: failed to create directory `/contract/target`

Caused by:
  Permission denied (oERROR: command ["/usr/local/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo", "build", "--color=alw
ays", "--target=wasm32-unknown-unknown", "-Zbuild-std=core,alloc", "--no-default-features", "--release", "--target-dir=/contract/targ
et/ink", "-Zbuild-std-features=panic_immediate_abort"] exited with code 101
ERROR: Failed to read build result from docker build

To Reproduce Steps to reproduce the behavior:

  1. cargo contract new verifiablecc
  2. cd verifiablecc
  3. cargo contract build --verifiable

Expected behavior a verifiable build should be created.

Environment (please complete the following information):

Additional warning

warning: You are using a rustc version that might emit unsupported wasm instructions. Build using a version lower than 1.70.0 to make sure your contract will deploy.
SkymanOne commented 1 year ago

Since we are modifying files with cargo, docker process and user must be in the same Linux group. Have you done docker post-installation steps?

abhijeetbhagat commented 1 year ago

yes, i am running docker as a non-root user i.e. without needing sudo.

SkymanOne commented 1 year ago

Are you running as a user with sudo privileges?