cross-rs/cross

Allow to run custom commands in cross containers to be able to use strip after the build

Closed this issue · 5 comments

Checklist

Describe your request

I think will be really useful to have a cross subcommand to run a custom command in the docker container. It could be something like cross runsh --target <target> "shell commands"

Describe why this would be a good inclusion for cross

In my use case, I want to strip the binaries and I need the target strip to do it properly.
I know that you can configure striping in Cargo.toml but in Apple targets don't work, it shows the next error (this should be solved in cargo anyway probably is using the host strip to strip the target).

warning: stripping debug info with `strip` failed: exit status: 1
  |
  = note: strip: /target/aarch64-apple-darwin/release/deps/run_local_network-899c3ee2eced8839: file format not recognized

If I we have the option to run custom commands in cross I could run cross runsh --target <target> "<target>-strip path/to/my/bin". I know that I can use the docker container directly but is handy to have cross setting up the volumes and all needed environment.

Also I can see how others can beneficiate from this if they want to run other target specific tools like objdump or nm in their binaries/libs.

I will be happy to implement it if the team agrees that is a good use case and we can include it in cross.

I think this is a duplicate of #716

I think it's in the same area as #716 but not the same thing. This one is also much easier to implement.

I think this would be good to have also for debugging issues in a cross container

Implementing this should be pretty easy, it'd have to be implemented as a cross-util command and would just have to modify docker::run to allow for an interpretive session

implemented in #1280 🎉