rust-osdev / cargo-xbuild

Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc.
Apache License 2.0
256 stars 25 forks source link

`cargo install cargo-xbuild` fails with noexec /tmp mount #90

Closed ChaiTRex closed 3 years ago

ChaiTRex commented 3 years ago

There are many systems out there with a noexec /tmp mount. The current cargo install cargo-xbuild will fail to work on all of them.

$ mount | fgrep /tmp
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,noatime)

$ cargo install cargo-xbuild
    Updating crates.io index
  Downloaded cargo-xbuild v0.6.0
  Downloaded 1 crate (32.6 KB) in 1.50s
  Installing cargo-xbuild v0.6.0
  Downloaded tempfile v3.1.0
  Downloaded toml v0.5.6
  Downloaded version_check v0.9.2
  Downloaded error-chain v0.12.4
  Downloaded fs2 v0.4.3
  Downloaded remove_dir_all v0.5.3
  Downloaded ppv-lite86 v0.2.9
  Downloaded getrandom v0.1.14
  Downloaded rand_chacha v0.2.2
  Downloaded rand v0.7.3
  Downloaded rand_core v0.5.1
  Downloaded syn v1.0.39
  Downloaded cargo_metadata v0.9.1
  Downloaded 13 crates (575.6 KB) in 1.21s
   Compiling libc v0.2.76
   Compiling serde v1.0.115
   Compiling proc-macro2 v1.0.19
   Compiling getrandom v0.1.14
   Compiling unicode-xid v0.2.1
   Compiling cfg-if v0.1.10
   Compiling syn v1.0.39
   Compiling ryu v1.0.5
   Compiling serde_json v1.0.57
   Compiling serde_derive v1.0.115
   Compiling ppv-lite86 v0.2.9
   Compiling version_check v0.9.2
   Compiling semver-parser v0.7.0
   Compiling itoa v0.4.6
   Compiling cargo-xbuild v0.6.0
   Compiling same-file v1.0.6
   Compiling remove_dir_all v0.5.3
error: failed to run custom build command for `getrandom v0.1.14`

Caused by:
  could not execute process `/tmp/cargo-install0JhqDB/release/build/getrandom-ac71bc84a3ffb541/build-script-build` (never executed)

Caused by:
  Permission denied (os error 13)
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-xbuild v0.6.0`, intermediate artifacts can be found at `/tmp/cargo-install0JhqDB`

Caused by:
  build failed
phil-opp commented 3 years ago

Unfortunately, this is an issue with the cargo install command itself: https://github.com/rust-lang/cargo/issues/4350

So there is nothing specific to the cargo-xbuild crate that is causing this issue, apart from using a dependency that has a build script. I'm therefore closing this issue in favor of the linked cargo issue because there is nothing we can do about it from our side. For the short term, maybe the workaround described in https://github.com/rust-lang/cargo/issues/4350#issuecomment-340215811 helps.