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

[#87] Use statically linked binaries for linux #95

Merged
merged 7 commits into from
Sep 16, 2022

Conversation

chshersh
Copy link
Owner

Resolves #87

@chshersh chshersh self-assigned this Sep 16, 2022
@chshersh chshersh added the CI label Sep 16, 2022
@chshersh
Copy link
Owner Author

chshersh commented Sep 16, 2022

I checked that the binary is indeed statically linked:

~/Downloads/tool-x86_64-unknown-linux-musl$ ldd tool 
	statically linked

~/Downloads/tool-x86_64-unknown-linux-gnu$ ldd tool
	linux-vdso.so.1 (0x00007fffb8469000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd588bfe000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd588bdb000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd588a8c000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd588a86000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd588894000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd588f4e000)

@chshersh
Copy link
Owner Author

chshersh commented Sep 16, 2022

The release with assets is here:

I'll keep it for now (in case anyone wants to test it) but I'll delete it before making an actual v0.2.0 release (so don't really on it!)

@MitchellBerend
Copy link
Collaborator

This looks like a good change but why do we need to keep the dynamically linked one?

@chshersh
Copy link
Owner Author

This looks like a good change but why do we need to keep the dynamically linked one?

It's a bit awkward situation due to mutual dependency. tool-sync is hardcoded in the DB with the dynamically linked asset:

tool-sync/src/sync/db.rs

Lines 86 to 96 in 65b53bd

"tool-sync".into(),
ToolInfo {
owner: "chshersh".to_string(),
repo: "tool-sync".to_string(),
exe_name: "tool".to_string(),
asset_name: AssetName {
linux: Some("x86_64-unknown-linux-gnu".to_string()),
macos: Some("x86_64-apple-darwin".to_string()),
windows: Some("x86_64-pc-windows-msvc".to_string()),
},
tag: ToolInfoTag::Latest,

And it's used in tests:

if [[ ! -x $SYNC_DIR/tool ]]; then echo "error on: tool"; false; fi

Unfortunately, GitHub API doesn't return draft releases as latest. So I can only update the test and hard-coded tool-sync info only if there's a release with musl assets.

So the easiest solution would be to just keep both of them and remove the dynamically linked asset for the v0.3.0 version after the v0.2.0 release goes live.

@chshersh chshersh merged commit c768b8a into main Sep 16, 2022
@chshersh chshersh deleted the chshersh/87-Use-statically-linked-binaries-for branch September 16, 2022 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use statically linked binaries for linux
2 participants