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

Consider building statically #10

Open
mattgodbolt opened this issue Feb 4, 2022 · 0 comments
Open

Consider building statically #10

mattgodbolt opened this issue Feb 4, 2022 · 0 comments

Comments

@mattgodbolt
Copy link
Contributor

We use rizzy as an easy-copyable binary at Aquatic. That works as we all agree on the Ubuntu version:

$ ldd target/release/rizzy
	linux-vdso.so.1 (0x00007ffd83470000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f040597e000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f0405776000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0405557000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0405353000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0404f62000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f04061cf000)

It might be worth looking at building a musl static build which ends up with a 7MB static binary.

$ rustup target add x86_64-unknown-linux-musl
$ cargo build --release --target x86_64-unknown-linux-musl
$ ls -hld target/x86_64-unknown-linux-musl/release/rizzy
-rwxrwxr-x 2 mgodbolt mgodbolt 7.0M Feb  3 19:27 target/x86_64-unknown-linux-musl/release/rizzy
$ ldd target/x86_64-unknown-linux-musl/release/rizzy
	not a dynamic executable
@mattgodbolt mattgodbolt changed the title Consdier building statically Consider building statically Feb 5, 2022
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

No branches or pull requests

1 participant