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 compress binaries with UPX #90

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

mondeja
Copy link

@mondeja mondeja commented Nov 10, 2024

Add upx option to compress binaries with UPX on Windows and Linux (see https://upx.github.io).
Contributes to #6

@mondeja mondeja force-pushed the upx branch 3 times, most recently from 50f5c05 to ee6f91a Compare November 10, 2024 19:16
@taiki-e
Copy link
Owner

taiki-e commented Nov 11, 2024

Thanks for the PR! Could you add a test for this option?

@mondeja mondeja marked this pull request as draft November 11, 2024 16:52
@mondeja mondeja marked this pull request as ready for review November 11, 2024 18:22
@mondeja
Copy link
Author

mondeja commented Nov 11, 2024

Added to CI in c7c5a13

@@ -99,6 +99,7 @@ jobs:
codesign: '-'
codesign-prefix: 'com.example.'
codesign-options: 'runtime'
upx: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.target != 'x86_64-pc-windows-gnu' && matrix.target != 'aarch64-unknown-linux-gnu' }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://github.com/taiki-e/upload-rust-binary-action/actions/runs/12377523218/

Is the reason it doesn't work with aarch64 and windows-gnu because UPX doesn't support cross-compilation?

See https://github.com/taiki-e/upload-rust-binary-action/actions/runs/12377523218/job/34547228299?pr=90#step:6:296

Is it intentional that this is only tested in linux? Have there been any problems when tested otherwise?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the reason it doesn't work with aarch64 and windows-gnu because UPX doesn't support cross-compilation?

See https://github.com/taiki-e/upload-rust-binary-action/actions/runs/12377523218/job/34547228299?pr=90#step:6:296

It seems to work with aarch64 linux-gnu + build-tool=cargo.
https://github.com/taiki-e/upload-rust-binary-action/actions/runs/12377523218/job/34547228655?pr=90

Is it intentional that this is only tested in linux? Have there been any problems when tested otherwise?

This doesn't seem to describe why x86_64 windows is skipped.
https://github.com/taiki-e/upload-rust-binary-action/actions/runs/12377523218/job/34547233333?pr=90

Copy link
Author

@mondeja mondeja Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to work with aarch64 linux-gnu + build-tool=cargo.

Added.

This doesn't seem to describe why x86_64 windows is skipped.

The output of the file command is the same when the exe is compressed with UPX or not:

./test-crate/target/release/test-crate.exe: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows

See this run (compressing) and this run (not compressing). I don't know how to test it.

main.sh Outdated Show resolved Hide resolved
main.sh Outdated Show resolved Hide resolved
main.sh Outdated Show resolved Hide resolved
@taiki-e taiki-e mentioned this pull request Dec 17, 2024
4 tasks
@taiki-e
Copy link
Owner

taiki-e commented Dec 17, 2024

cc @damooo (who requested UPX support in #54)

@mondeja mondeja force-pushed the upx branch 3 times, most recently from 50ba508 to 74e34ce Compare December 27, 2024 13:33
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

Successfully merging this pull request may close these issues.

2 participants