Skip to content

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

@lumasepa

Description

@lumasepa

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions