wasmer icon indicating copy to clipboard operation
wasmer copied to clipboard

C API doesn't build with non-default target directory

Open vapourismo opened this issue 2 years ago • 0 comments

Describe the bug

Building the C API with non-standard --target-dir value causes the build to fail. Interestingly if one provides the --target flag (e.g. --target aarch64-apple-darwin) additionally, the build completes fine.

I first noticed the issue in 2.3.0, but it is still present it seems.

This is the section that causes the issue: https://github.com/wasmerio/wasmer/blob/b37029e43752a29607cc932aaf5470009a98e145/lib/c-api/build.rs#L347-L351

System: M1 Mac Rust: 1.60.0

Steps to reproduce

cargo build --target-dir random-output-dir --package wasmer-c-api

Expected behavior

Build completes fine.

Actual behavior

$ cargo build --target-dir random-output-dir --package wasmer-c-api
...
error: failed to run custom build command for `wasmer-c-api v3.0.0-beta (/Users/ole/Workspace/wasmer/lib/c-api)`

Caused by:
  process didn't exit successfully: `/Users/ole/Workspace/wasmer/random-output-dir/debug/build/wasmer-c-api-91a0be7c50d127e2/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'assertion failed: `(left == right)`
    left: `Some("random-output-dir")`,
   right: `Some("aarch64-apple-darwin")`', lib/c-api/build.rs:350:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

Additional context

vapourismo avatar Sep 15 '22 10:09 vapourismo