Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm32-unknown-unknown target build error for LLVM 9+ #446

xxuejie opened this issue Oct 11, 2019 · 1 comment

wasm32-unknown-unknown target build error for LLVM 9+ #446

xxuejie opened this issue Oct 11, 2019 · 1 comment


Copy link

@xxuejie xxuejie commented Oct 11, 2019

Here's the steps to reproduce this:

$ # ensure PATH has clang 9+
$ clang --version
clang version 9.0.0 ( 1931d3cb20a00da732c5210b123656632982fde0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-9/bin
$ git clone
$ cd blake2b-rs
$ cargo build --target=wasm32-unknown-unknown
   Compiling cc v1.0.45
   Compiling blake2b-rs v0.1.5 (/home/ubuntu/code/blake2b-rs)
error: failed to run custom build command for `blake2b-rs v0.1.5 (/home/ubuntu/code/blake2b-rs)`

Caused by:
  process didn't exit successfully: `/home/ubuntu/code/blake2b-rs/target/debug/build/blake2b-rs-55b914c5314ec856/build-script-build` (exit code: 1)
--- stdout
TARGET = Some("wasm32-unknown-unknown")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
CC_wasm32-unknown-unknown = None
CC_wasm32_unknown_unknown = None
CC = None
CFLAGS_wasm32-unknown-unknown = None
CFLAGS_wasm32_unknown_unknown = None
DEBUG = Some("true")
running: "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-o" "/home/ubuntu/code/blake2b-rs/target/wasm32-unknown-unknown/debug/build/blake2b-rs-cc59db8c9c4ef2be/out/BLAKE2/ref/blake2b-ref.o" "-c" "BLAKE2/ref/blake2b-ref.c"
cargo:warning=BLAKE2/ref/blake2b-ref.c:17:10: fatal error: 'string.h' file not found
cargo:warning=#include <string.h>
cargo:warning=         ^~~~~~~~~~
cargo:warning=1 error generated.
exit code: 1

--- stderr

error occurred: Command "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-o" "/home/ubuntu/code/blake2b-rs/target/wasm32-unknown-unknown/debug/build/blake2b-rs-cc59db8c9c4ef2be/out/BLAKE2/ref/blake2b-ref.o" "-c" "BLAKE2/ref/blake2b-ref.c" with args "clang" did not execute successfully (status code exit code: 1)

I'm using blake2b-rs crate just as an example here, I suspect any crate using cc could run into this issue.

The same issue can be reproduced on macOS with latest LLVM.

Thanks in advance!

Copy link

@alexcrichton alexcrichton commented Oct 15, 2019

Thanks for the report! This crate can't arrange for everyone's sysroot to be set up right though nor fix all errors in C compilation. This is one you'll need to work with locally, since there's nothing this crate can do to fix this. Configuring a working toolchain for wasm32-unknown-unknown isn't easy, I'd recommend using wasm32-wasi if you can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants