-
Notifications
You must be signed in to change notification settings - Fork 416
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
Unable to build Rust dependency with C dependency #621
Comments
i think this is the right place! i'll need to try to reproduce this- what C dependency were you using? or if you can just push up an example repo, that'd be helpful. thanks for filing! |
@ashleygwilliams glad to hear! The example repo for this simplified example is here: https://github.com/tmfink/simple-wasm/tree/master The README gives an overview of where/what the dependencies are. |
I commented on rust-lang/cc-rs#392 as well, but I think the issue here is that |
@alexcrichton thanks for the info! I'm not as familiar with this web programming. |
After clearing the
I'm running Ubuntu 18.04, which comes with clang 6.0.0. However, after installing
However, I don't know how to test my change since, when I run |
I replaced "hello-wasm-pack" with "simple-wasm" as described in the "Using your library" tutorial page: However, when building with: #!/bin/sh
set -eux
cd "$(dirname "$0")"
CC=clang-8 wasm-pack build --dev -- -v
( cd pkg && npm link )
(
cd www
npm link simple-wasm
npm install
npm run start
) I get an error during
Full log:
@ashleygwilliams Am I not running |
i'm not sure but it does seem to be a npm/web-pack sitch. i'll need to carve out some time to look at this more closely. i'm not sure what this error causing "env" bit means! |
I am also trying to compile the Capstone engine to WebAssembly and getting the same results. Using @ashleygwilliams Could there be a way to direct wasm-pack to compile functions found in the C standard library to wasm when the rest of the package is built? That way there won't be an imports to be missing, and a more static library will be produced. |
This basic example seems to work now, perhaps from a Rust or clang update?
@ct-porco any success on your end? My proof-of-concept C code here is simple, just:
unsigned int double_it(unsigned int x) {
return x * 2;
} |
I'm not sure if
wasm-pack
is the correct project to open an issue. My goal is to create a web-interface for https://github.com/capstone-rust/capstone-rs (Rust bindings around a C library) that runs completely client-side in webassembly. However, I had issues with a proof-of-concept that tried to link transitively to a C library.🐛 Bug description
wasm-pack
fails to build Rust code that has C dependency for targetwasm32-unknown-unknown
.Project available here: https://github.com/tmfink/simple-wasm/tree/master
🤔 Expected Behavior
wasm-pack build
should succeed.emcc
*-sys
library built library with wasm binary.-rs
code links*-sys
library.👟 Steps to reproduce
wasm-pack build
.~/.cargo/config
:Do no set
CC
:Set
CC=emcc
🌍 Your environment
Include the relevant details of your environment.
wasm-pack version:
wasm-pack 0.8.1
rustc version:
1.33.0 (2aa4c46cf 2019-02-28)
emcc version:
1.38.12 (commit 0d8576c0e8f5ee09a36120b9d44184b5da2f2e7a)
The text was updated successfully, but these errors were encountered: