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

Statically link linux build #444

Conversation

stopdropandrew
Copy link
Contributor

stylua's linux build fails to run on Ubuntu 18:

./stylua: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by ./stylua)

One oddity was that --target must be passed explicitly, as documented by this blog post

@codecov
Copy link

codecov bot commented Apr 16, 2022

Codecov Report

Merging #444 (2059ffe) into master (602d1a2) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #444      +/-   ##
==========================================
+ Coverage   96.42%   96.44%   +0.01%     
==========================================
  Files          14       14              
  Lines        5228     5257      +29     
==========================================
+ Hits         5041     5070      +29     
  Misses        187      187              
Impacted Files Coverage Δ
src/formatters/expression.rs 97.04% <100.00%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2241716...2059ffe. Read the comment docs.

@JohnnyMorganz
Copy link
Owner

JohnnyMorganz commented Apr 16, 2022

Thanks for the PR!

Could we instead put this flag in the .cargo/config.toml file similar to this? https://github.com/rojo-rbx/rojo/blob/master/.cargo/config.toml
Hopefully that still should work (and maybe the target won't need to be specified anymore in the build command either?)

(Also no idea why the code coverage has changed here..., seems unrelated, probably flaky)

@stopdropandrew
Copy link
Contributor Author

I did that initially, seen here https://github.com/JohnnyMorganz/StyLua/runs/6049194259?check_suite_focus=true and other action failures, but I was getting the same error mentioned in that blog post.

I thought the easiest solution was to statically link only the release build, rather than figuring out how to pass in --target to every command - it's not even clear that's possible. Do you have a preference?

@JohnnyMorganz
Copy link
Owner

Nope, no particular preference here!

Did a bit more digging into the actual cause of this issue (wasn't happening before), and stumbled across rust-analyzer having the same issue: rust-lang/rust-analyzer#11558

It turns out this is because they switched their CI to Ubuntu 20.04 from 18.04, and Rust now requires a newer version of glibc. Our action is on ubuntu-latest which defaults to 20.04.

Maybe instead of statically linking the whole C runtime here, we just downgrade our CI to Ubuntu 18.04? I think that should also fix the problem, and I don't see any downside to it

@LastTalon
Copy link
Contributor

Maybe instead of statically linking the whole C runtime here, we just downgrade our CI to Ubuntu 18.04? I think that should also fix the problem, and I don't see any downside to it

I think this is the way to go. The issue is with incompatible ABI changes. The newer version will be able to handle the old version linking, just not the other way around.

Possibly in the future (depending on support) CI could even build for each version of libc? This may be unsupported by foreman workflows though.

JohnnyMorganz added a commit to JohnnyMorganz/rojo that referenced this pull request Jun 26, 2022
ubuntu-latest uses Ubuntu 20.04, this causes issues with glibc as older versions of ubuntu/other distros use an older version.

This is fixed by building the release binary on `ubuntu-18.04`, which uses a version of glibc more widely available.

Ref: JohnnyMorganz/StyLua#444
JohnnyMorganz/StyLua#445
LPGhatguy pushed a commit to rojo-rbx/rojo that referenced this pull request Jun 26, 2022
ubuntu-latest uses Ubuntu 20.04, this causes issues with glibc as older versions of ubuntu/other distros use an older version.

This is fixed by building the release binary on `ubuntu-18.04`, which uses a version of glibc more widely available.

Ref: JohnnyMorganz/StyLua#444
JohnnyMorganz/StyLua#445
Dekkonot pushed a commit to UpliftGames/rojo that referenced this pull request Jan 11, 2024
ubuntu-latest uses Ubuntu 20.04, this causes issues with glibc as older versions of ubuntu/other distros use an older version.

This is fixed by building the release binary on `ubuntu-18.04`, which uses a version of glibc more widely available.

Ref: JohnnyMorganz/StyLua#444
JohnnyMorganz/StyLua#445
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.

3 participants