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

Add static compilation support #589

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

supercoolspy
Copy link
Contributor

@supercoolspy
Copy link
Contributor Author

Confirmed that it works on nixos

@supercoolspy supercoolspy marked this pull request as ready for review October 8, 2024 19:28
@ConnorNelson
Copy link
Member

bash-5.2# nix-shell -p gcc glibc.static glibc

[nix-shell:/]# echo -e '#include <stdio.h>\nint main() { puts("hello world"); }' > test.c

[nix-shell:/]# gcc test.c

[nix-shell:/]# ./a.out
Segmentation fault (core dumped)

[nix-shell:/]# gcc -static test.c

[nix-shell:/]# ./a.out
hello world

It seems like this causes non-static builds to not work?

@ConnorNelson
Copy link
Member

bash-5.2# nix-shell -p gcc glibc glibc.static

[nix-shell:/]# gcc -static test.c

[nix-shell:/]# ./a.out
hello world

[nix-shell:/]# gcc test.c

[nix-shell:/]# ./a.out
hello world

Hmmm interestingly, swapping the order fixes it. Saw someone talking about that here.

Can you move static to core next to the current glibc and make sure we get the order right?

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.

gcc cannot compile static binaries
2 participants