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

cargo install fails – could not find asset folder #21

Open
hiimsergey opened this issue Oct 30, 2023 · 4 comments
Open

cargo install fails – could not find asset folder #21

hiimsergey opened this issue Oct 30, 2023 · 4 comments

Comments

@hiimsergey
Copy link

Describe the bug
When performing cargo install lavagna, the compilation process fails. The bevy_embedded_assets can't find the assets folder.

Full output, directly after Compiling <dependency> v<version>:

The following warnings were emitted during compilation:

warning: bevy_embedded_assets@0.7.0: Could not find asset folder, please specify its path with $BEVY_ASSET_PATH

error: failed to run custom build command for `bevy_embedded_assets v0.7.0`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installklO25G/release/build/bevy_embedded_assets-36be3b4b8a9ca65c/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed={}
  cargo:rerun-if-env-changed=BEVY_ASSET_PATH
  cargo:warning=Could not find asset folder, please specify its path with $BEVY_ASSET_PATH

  --- stderr
  thread 'main' panicked at /home/sergey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_embedded_assets-0.7.0/build.rs:111:9:
  No asset folder found
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `lavagna v2.1.7`, intermediate artifacts can be found at `/tmp/cargo-installklO25G`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

To Reproduce
Steps to reproduce the behavior:

  1. Assure that you have cargo installed.
  2. cargo install lavagna

Expected behavior
The log throws no errors and lavagna is installed at ~/.cargo/bin/lavagna.

Desktop (please complete the following information):

  • OS: Arch Linux
  • Version:
    • rustup 1.26.0
    • cargo 1.75.0-nightly

Side Note
In my project, I have the same issue. I uploaded it to crates.io but can't cargo install, due to the same error messages, although cargo package --list lists my assets folder.

Thank you in advance.

@hiimsergey
Copy link
Author

I found a kind of hack to get it to compile:

  1. cargo install lavagna and let it fail (it spawns a /tmp/cargo-install<random letters> directory)
  2. git clone the source code and cd into it
  3. BEVY_ASSET_PATH=assets/ CARGO_TARGET_DIR=/tmp/cargo-install\<random letters\> cargo install lavagna
  4. The compiler throws and error message and points to /tmp/cargo-install<random letters>/release/build/bevy_embedded_assets-<random hash>/out/include_all_assets.rs
    Delete the body of the only function there and replace it with:
embedded.add_asset(std::path::Path::new("fonts/FiraMono-Medium.ttf"), include_bytes!("/absolute/path/to/lavagna/assets/fonts/FiraMono-Medium.ttf"));
embedded.add_asset(std::path::Path::new("sprites/pen.png"), include_bytes!("/absolute/path/to/lavagna/assets/sprites/pen.png"));
  1. Run step 3 again

I did this for both your and my project and it seemed to work, although I don't know how to use this information so that users can install the program normally.

@alepez
Copy link
Owner

alepez commented Nov 2, 2023

Hi @hiimsergey, thanks for sharing this issue.

I've just tested it and I confirm that cargo install lavagna gives this error:

error: failed to run custom build command for `bevy_embedded_assets v0.7.0`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installZgTg2e/release/build/bevy_embedded_assets-5842e00b13fe4b91/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed={}
  cargo:rerun-if-env-changed=BEVY_ASSET_PATH
  cargo:warning=Could not find asset folder, please specify its path with $BEVY_ASSET_PATH

  --- stderr
  thread 'main' panicked at 'No asset folder found', /home/alepez/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_embedded_assets-0.7.0/build.rs:111:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `lavagna v2.1.7`, intermediate artifacts can be found at `/tmp/cargo-installZgTg2e`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

But cargo install --path . from a fresh clone of the last commit dd260dd seems to be ok.

I've also tried cargo clone lavagna (https://crates.io/crates/cargo-clone) and cargo install --path . from the downloaded directory and it seems to be fine.

I need more time to handle this issue, but if in the meanwhile you've find a solution, feel free to PR.

@hiimsergey
Copy link
Author

Any updates?

@alepez
Copy link
Owner

alepez commented Dec 28, 2023

I think this is related to vleue/bevy_embedded_assets#5

When executing cargo install lavagna, dependencies are built first. bevy_embedded_assets is expecting to find the assets folder, but when it is built, that folder does not exist yet.

I think cargo install lavagna cannot be used to install this crate.

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

2 participants