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

build_wasm 失败求助 #39

Closed
nobodxbodon opened this issue Apr 22, 2021 · 5 comments
Closed

build_wasm 失败求助 #39

nobodxbodon opened this issue Apr 22, 2021 · 5 comments

Comments

@nobodxbodon
Copy link

rust 新手尝试搭建在线环境:

$ rustup toolchain list
stable-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin (override)
$ make build_wasm
cargo build --bin wasm -Z unstable-options --profile tiny --target wasm32-unknown-unknown --features=wasm
    Updating crates.io index
  Downloaded tinyvec v1.2.0
  Downloaded unicode-normalization v0.1.17
  Downloaded unicode-xid v0.2.1
  Downloaded tinyvec_macros v0.1.0
  Downloaded 4 crates (158.2 KB) in 0.58s
   Compiling tinyvec_macros v0.1.0
   Compiling unicode-xid v0.2.1
error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `tinyvec_macros`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
make: *** [target/wasm32-unknown-unknown/tiny/wasm.wasm] Error 101
@suulnnka
Copy link

rustup target add wasm32-unknown-unknown

@nobodxbodon
Copy link
Author

谢谢. 现在shell报错:

$ make build_wasm
cargo build --bin wasm -Z unstable-options --profile tiny --target wasm32-unknown-unknown --features=wasm
   Compiling tinyvec_macros v0.1.0
   Compiling unicode-xid v0.2.1
   Compiling tinyvec v1.2.0
   Compiling unicode-normalization v0.1.17
   Compiling pua-lang v0.1.0 (/Users/xuanwu/git/pua-lang)
    Finished tiny [optimized] target(s) in 19.82s
if command -v wasm-opt >/dev/null; \
                wasm-opt --strip-debug -Oz -o web/src/pua-lang.wasm target/wasm32-unknown-unknown/tiny/wasm.wasm; \
        else \
            cp target/wasm32-unknown-unknown/tiny/wasm.wasm web/src/pua-lang.wasm;\
        fi
/bin/sh: -c: line 0: syntax error near unexpected token `else'
/bin/sh: -c: line 0: `if command -v wasm-opt >/dev/null;        wasm-opt --strip-debug -Oz -o web/src/pua-lang.wasm target/wasm32-unknown-unknown/tiny/wasm.wasm; else     cp target/wasm32-unknown-unknown/tiny/wasm.wasm web/src/pua-lang.wasm;fi'
make: *** [web/src/pua-lang.wasm] Error 2

@flaneur2020
Copy link
Owner

ls +1,窝也遇到了这个报错信息 🤔

@suulnnka
Copy link

suulnnka commented Apr 22, 2021

@Artoria2e5 你的rust版本太新了,我这用不了太新的特性.建议makefile保留原来的编译选项,并且新建一个新的选项用于使用新特性

makefile中第23行后面要加一个then.
sh中if后面要跟;then的.(shell中的一个大坑,都有分号了,还要写then)

@Artoria2e5
Copy link
Collaborator

Artoria2e5 commented Apr 22, 2021

是我大意了,我其实没有在用 Makefile(因为 git bash 没有 make)。我切进 Cygwin 里面试吧。

那个 -Z 确实不能 stable。我暂时没有什么修的意向,因为那样需要改两份 Cargo.toml。

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

No branches or pull requests

4 participants