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

How to avoid repeated "downloading component 'rust-std' " #1579

Open
dmikushin opened this issue Oct 26, 2024 · 6 comments
Open

How to avoid repeated "downloading component 'rust-std' " #1579

dmikushin opened this issue Oct 26, 2024 · 6 comments

Comments

@dmikushin
Copy link

When running cross-rs from within another Docker container, please provide a clear instruction how to avoid repeated download of rust-std:

info: downloading component 'rust-std' for 'aarch64-unknown-linux-gnu'
info: installing component 'rust-std' for 'aarch64-unknown-linux-gnu'
@Emilgardis
Copy link
Member

Emilgardis commented Oct 26, 2024

Please provide more detail, what does repeated download of rust-std mean? Does it mean that it keeps downloading it many times in the same invocation, or does it mean that it always downloads the component on new invocation in a new container?

Are you using CROSS_CONTAINER_IN_CONTAINER=1 ?

@dmikushin
Copy link
Author

@Emilgardis , yes, in my outer Docker I do:

# Set CROSS_CONTAINER_IN_CONTAINER to inform `cross` that it is executed from within a container
ENV CROSS_CONTAINER_IN_CONTAINER=true

Then, I use this container to do:

COMMAND ${DOCKER_EXECUTABLE} run --rm -v "${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/${PROJECT_NAME}:/${PROJECT_NAME}" -v "${CMAKE_CURRENT_BINARY_DIR}/target:/${PROJECT_NAME}/target" -w "/${PROJECT_NAME}" -v /var/run/docker.sock:/var/run/docker.sock ${PROJECT_NAME} cross build --release --target=aarch64-unknown-linux-gnu

Important note: I execute docker run again and again to rebuild the Rust project during my development. And each time I rebuild, I see that:

info: downloading component 'rust-std' for 'aarch64-unknown-linux-gnu'
info: installing component 'rust-std' for 'aarch64-unknown-linux-gnu'

My connection is rather fast, but I still experience additional delay from this "rust-std" every time, and I think it could be removed. I think it could be done by mounting the host folder into the outer docker, and then by mounting the same folder down into the cross container. Please tell me what commands and paths I should use.

@Emilgardis
Copy link
Member

im a bit confused, is this in a docker build? what does COMMAND ${DOCKER_EXECUTABLE} mean?

Are you using cross from the main branch?

@dmikushin
Copy link
Author

This is CMake, here. I build CMake rules to automate the build process, so that it could fit anywhere that could run CMake, for example into VSCode. It is not relevant to this question.

I kindly ask you to return back to the plot: the cross container is not able to avoid repeated download of rust-std package. There must be an instruction from your side to cache rust-std when cross is launched in CROSS_CONTAINER_IN_CONTAINER mode.

@dmikushin
Copy link
Author

Are you using cross from the main branch?

I install cross here, this way:

RUN cargo install cross --git https://github.com/cross-rs/cross

@Emilgardis
Copy link
Member

Ok thank you, I think i have the full context now. Try making RUSTUP_HOME persistant with a volume. /usr/local/rustup

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