flaneur2020 / pua-lang

a dialect of The Monkey Programming Language
MIT License
3.28k stars 125 forks source link

build_wasm 失败求助 #39

Closed nobodxbodon closed 3 years ago

nobodxbodon commented 3 years ago

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 commented 3 years ago

rustup target add wasm32-unknown-unknown

nobodxbodon commented 3 years ago

谢谢. 现在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 commented 3 years ago

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

suulnnka commented 3 years ago

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

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

Artoria2e5 commented 3 years ago

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

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