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

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

Closed
1 of 2 tasks
lumasepa opened this issue May 23, 2023 · 5 comments
Closed
1 of 2 tasks

Comments

@lumasepa
Copy link
Contributor

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.

@lumasepa
Copy link
Contributor Author

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

@NobodyXu
Copy link

NobodyXu commented May 23, 2023

I think this is a duplicate of #716

@Emilgardis
Copy link
Member

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

@Emilgardis
Copy link
Member

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

bors bot added a commit that referenced this issue Jun 27, 2023
1280: Allow to run arbitrary commands in containers using cross-util run ... r=Emilgardis a=lumasepa

Implementation for #1266

Co-authored-by: Sergio Medina <lumasepa@gmail.com>
bors bot added a commit that referenced this issue Jun 27, 2023
1280: Allow to run arbitrary commands in containers using cross-util run ... r=Emilgardis a=lumasepa

Implementation for #1266

Co-authored-by: Sergio Medina <lumasepa@gmail.com>
@Emilgardis
Copy link
Member

implemented in #1280 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants