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

Would you please strip for release assets? #276

Closed
abcfy2 opened this issue Jul 3, 2020 · 12 comments · Fixed by #750
Closed

Would you please strip for release assets? #276

abcfy2 opened this issue Jul 3, 2020 · 12 comments · Fixed by #750
Assignees

Comments

@abcfy2
Copy link
Contributor

abcfy2 commented Jul 3, 2020

I think you can strip for release assets so that thin the tar package.

@zonyitoo
Copy link
Collaborator

zonyitoo commented Jul 4, 2020

What do you mean? Release packages only contains executable binaries.

@abcfy2
Copy link
Contributor Author

abcfy2 commented Jul 4, 2020

I mean that maybe we could use strip to reduce binaries size.

Example:

# Before strip
$ file sslocal
sslocal: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=54d3e530a75fc39515e4c4f56f439c61cbd6133b, with debug_info, not stripped  

$ du -h sslocal
11M     sslocal

# After strip
$ strip sslocal
$ file sslocal
sslocal: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=54d3e530a75fc39515e4c4f56f439c61cbd6133b, stripped

$ du -h sslocal
8.4M    sslocal

You can see after strip, sslocal file size reduced from 11M to 8.4M.

@zonyitoo
Copy link
Collaborator

zonyitoo commented Jul 4, 2020

I am going to wait for cargo's strip option: rust-lang/cargo#3483 to be stablized.

Calling strip manually in build script may be nasty in cross builds.

Also, stripped binaries will not be able to show stacktrace when panicking. (But I have already set panic to be abort in release anyway.)

@zonyitoo zonyitoo self-assigned this Jul 4, 2020
@zonyitoo
Copy link
Collaborator

zonyitoo commented Jul 4, 2020

cargo-features = ["strip"]

[profile.release]
strip = "symbols"

This will require a nightly build of cargo. I will keep this issue open until this feature is stablized.

@Kein
Copy link

Kein commented Jul 29, 2020

strip with UPX on top? ;P

@xnoreq
Copy link

xnoreq commented Nov 28, 2020

@Kein Why would you ever want to use UPX? To increase memory usage further because now it also needs to be uncompressed in memory?

@xnoreq
Copy link

xnoreq commented Nov 29, 2020

Disabling trust-dns (which is not a performance problem for the client sslocal) and switching from log4rs to stderrorlog (who needs a full-blown logging framework for a socks client?) I get a Windows sslocal binary that's 2.7 MB vs the almost 9MB in the release.

I think this could be reduced further still, but would require going into the dependencies and patching them to make some of their dependencies optional.

@Kein
Copy link

Kein commented Nov 30, 2020

I get a Windows sslocal binary that's 2.7 MB vs the almost 9MB in the release.

That is pretty sweet. Got a fork or PR?

@zonyitoo
Copy link
Collaborator

You could just build it without the trust-dns feature.

@zonyitoo
Copy link
Collaborator

Some guides about how to minimize target files of Rust:

https://github.com/johnthagen/min-sized-rust

@abcfy2
Copy link
Contributor Author

abcfy2 commented Jan 30, 2022

Hi @zonyitoo . Seems latest release still not strip ?

$ file ss*
sslocal:   ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped
ssmanager: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped
ssserver:  ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped
ssservice: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped
ssurl:     ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped

@zonyitoo
Copy link
Collaborator

Yes. The strip option will be released in 1.59. The current stable Rust version is 1.58.

The v1.13 release is to make shadowsocks-rust to be built with stable Rust, so I temporary disable the option until 1.59 releases.

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

Successfully merging a pull request may close this issue.

4 participants