Error while compiling a workspace
Kaendor opened this issue · comments
Hello,
I have a workspace with the following structure :
client
| assets
server
| assets
But when I run/build one crate or the other, I have this error :
warning: Could not find the asset folder from the Cargo build directory
warning: Could not find asset folder, please specify its path with $BEVY_ASSET_PATH
error: failed to run custom build command forbevy_embedded_assets v0.4.0
I managed to fix the issue by copying/pasting my asset folders at the root level, but duplicating assets isn't an ideal solution.
This issue appeared right after I split my project into multiple crates.
If you need more information, I would be glad to help!
How are you selecting the correct asset folder with Bevy?
Could you try setting the BEVY_ASSET_PATH
environment variable to the path of your asset folder?
I use the default asset folder of bevy without tinkering with env vars usually, but I will try to set the BEVY_ASSET_PATH
and share the results.
It works for me if I set the env var, it would be great if it were able to check it depending on the sub crate folder.
Right now I have to export the var like
export BEVY_ASSET_PATH=${PWD}/main-workspace/bevy-crate/assets
while running cargo from ${PWD}/main-workspace
.
Is there a way to define this?
I am facing the same issue after publishing my application to crates.io
Upon doing cargo install ncube
Compiling cargo-emit v0.2.1
Compiling nohash-hasher v0.2.0
Compiling bevy_embedded_assets v0.8.0
Compiling epaint v0.22.0
Compiling url v2.4.1
Compiling bevy v0.11.2
Compiling home v0.5.5
The following warnings were emitted during compilation:
warning: 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.8.0`
Caused by:
process didn't exit successfully: `/tmp/cargo-installtcCLm1/release/build/bevy_embedded_assets-fba8b0b576aee5b2/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/ndavd/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_embedded_assets-0.8.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 `ncube v1.0.0`, intermediate artifacts can be found at `/tmp/cargo-installtcCLm1`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
How should one go about to configure that env on a cargo install
? cc @mockersf @pietrosophya