Hm, deleting the target directory should be an appropriate way to clean out build artifacts. @freesig you know stuff about rustc; can you identify the issue here?
Relative paths are relative to the current working directory, usually the same as the one containing your Cargo.toml , so you want to open "src/hello.txt" or move hello.txt up to the same level.
result.rs is just the std libraries Result. The error is saying somewhere unwrap() was called on the result of trying to open the path target/wasm32-unknown-unknown/release/cogov.wasm.
Does you’re .hcbuild have $CARGO_TARGET_DIR in it? It should showing up in the output in place of target
That’s ok. Everything is a work in progress. I appreciate your help on this!
Looks like there’s another issue. Am I using the correct versions?
$ rustc -V
rustc 1.41.0-nightly (1bd30ce2a 2019-11-15)
$ hc package
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR "
/home/brian/work/cogov/cogov-dev/target
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR"
Finished release [optimized] target(s) in 0.07s
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/{{ name }}.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/{{ name }}.wasm"
Usage: wasm-gc [options] <INPUT> [OUTPUT]
Options:
-o NAME set output file name
--no-demangle don't demangle symbol names
-h, --help print this help menu
A postprocessing command for wasm files to garbage-collect unused
imports, internal functions, types, etc. This is intended to be
similar to the functionality provided by `--gc-sections` by linkers
in that it is not intended to modify the functionality of the wasm
binary, only make it a little smaller.
Usage of this command typically looks like:
# Read and write output to one file
wasm-gc foo.wasm
# Read input from one file and write it to another file
wasm-gc input.wasm output.wasm
# Passing various options
wasm-gc --no-demangle input.wasm -o output.wasm
Please reports bugs to https://github.com/alexcrichton/wasm-gc if you find
them!
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/{{ name }}.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/{{ name }}.wasm"
Unexpected second positional argument 'name' for INFILE
Error: Couldn't traverse DNA in directory "/home/brian/work/cogov/cogov-dev": command CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/{{ name }}.wasm was not successful