Cargo install failed but run works

Hey!
I'm trying to publish my first bin crate (rather than lib) to crates.io
I can run the bin crate in the repository (feat/piper-rs-cli branch)
So I published it but when I run

cargo install piper-rs-cli

It failed with

  [ 29%] Building C object src/CMakeFiles/espeak-ng-bin.dir/espeak-ng.c.o
  [ 29%] Linking CXX executable espeak-ng
  [ 29%] Built target espeak-ng-bin
  [ 29%] Link espeak-ng to compat names
  [ 30%] Compile intonations
  [ 30%] Built target speak-ng
  Compiled 34 intonation tunes: 0 errors.
  [ 31%] Compile phonemes
  Compiling phoneme data: /private/var/folders/k6/b4k6mjy92dxbm_l2my6zzlnm0000gn/T/cargo-installl5xntZ/release/build/espeak-rs-sys-c85b2a4d325ef4f3/out/build/espeak-ng-data/../phsource/phonemes
  ph_english_us_nyc(44): Bad vowel file: 'vwl_en_us_nyc/a_raised'

  Refs 4753,  Reused 3776
  Compiled phonemes: 1 errors.

  --- stderr
  CMake Warning:
    Manually-specified variables were not used by the project:

      CMAKE_ASM_COMPILER
      CMAKE_ASM_FLAGS


  make: warning: -jN forced in submake: disabling jobserver mode.
  Failed to open: '/private/var/folders/k6/b4k6mjy92dxbm_l2my6zzlnm0000gn/T/cargo-installl5xntZ/release/build/espeak-rs-sys-c85b2a4d325ef4f3/out/build/espeak-ng-data/../phsource/vwl_en_us_nyc/a_rais'Error: Compile error.
  make[2]: *** [espeak-ng-data/phondata] Error 1
  make[2]: *** Deleting file `espeak-ng-data/phondata'
  make[1]: *** [CMakeFiles/data.dir/all] Error 2
  make: *** [all] Error 2
  thread 'main' panicked at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.52/src/lib.rs:1115:5:

  command did not execute successfully, got: exit status: 2

  build script failed, must exit now
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: failed to compile `piper-rs-cli v0.1.0`, intermediate artifacts can be found at `/var/folders/k6/b4k6mjy92dxbm_l2my6zzlnm0000gn/T/cargo-installl5xntZ`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

I find it hard to explore because every time I run cargo install it recompile everything from source.
And I couldn't find a way to test it iteratively without publish every time to crates.io. How can I reproduce cargo install locally?
cargo run / build works.
For example:

git clone --recursive -b feat/piper-rs-cli https://github.com/thewh1teagle/piper-rs
cd piper-rs
cargo run -p piper-rs-cli

From the error message:

git clone --recursive -b feat/piper-rs-cli https://github.com/thewh1teagle/piper-rs
cargo install --path piper-rs

or

cargo install --git https://github.com/thewh1teagle/piper-rs --branch feat/piper-rs-cli
1 Like

Thanks! cargo is so powerful : )
I tried cargo install --path . in the crate folder. it install successfully. I'm wondering why it doesn't work when trying from crates.io. I guess it's still different in terms of the available files (which I declare in include = in Cargo.toml

you can use cargo package to generate the compressed .crate file without uploading it to crates.io, you can then compare the contents of it with your source repository to figure out what is missing.

EDIT:

you don't need to uncompress the .crate file just to get the file list, there's a flag for the package command:

$ cargo package --list
2 Likes