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

Compile Linux binaries with Zig #39

Merged
merged 36 commits into from
Feb 5, 2024
Merged

Conversation

bjia56
Copy link
Collaborator

@bjia56 bjia56 commented Feb 3, 2024

Resolves #37

All Linux builds are now run on the stock ubuntu-latest GH Actions runners, cross-compiling if necessary. Zig's ability to target glibc 2.17 is used to ensure we comply with manylinux2014.

The arm build has also been tweaked to target the Raspberry Pi 1 armv6 configuration instead of armv7l. This resolves the illegal instruction issue discovered in lexiforest/curl_cffi#192.

@perklet
Copy link
Collaborator

perklet commented Feb 3, 2024

Sounds cool, are there any potential performance downsides?

@perklet
Copy link
Collaborator

perklet commented Feb 3, 2024

Is it possible to support musl linux with zig cc? #5

@bjia56
Copy link
Collaborator Author

bjia56 commented Feb 3, 2024

I haven't done any profiling myself, but since zig uses clang, I would expect the results to be properly optimized and not significantly different than gcc.

Zig can also link against musl libc. An interesting writeup here: https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html

@perklet
Copy link
Collaborator

perklet commented Feb 4, 2024

I came across that post, too. It would be great to have musl libc binaries out of the box. It seems that we just need to ensure that CFLAGS like -O3 are passed correctly, then there will be no issue to worry about.

@bjia56
Copy link
Collaborator Author

bjia56 commented Feb 4, 2024

I can take a look at compiling against musl

@perklet
Copy link
Collaborator

perklet commented Feb 5, 2024

I can take a look at compiling against musl

Do you want to continue work on this branch or a new PR?

@perklet
Copy link
Collaborator

perklet commented Feb 5, 2024

zig is awesome, this should be able to close #17 for Linux 32bit build, too.

@bjia56
Copy link
Collaborator Author

bjia56 commented Feb 5, 2024

I can take a look at compiling against musl

Do you want to continue work on this branch or a new PR?

Probably a separate PR if that's ok with you

@perklet perklet merged commit bc86bed into lexiforest:main Feb 5, 2024
8 checks passed
@bjia56 bjia56 deleted the zig-cross-compile branch February 7, 2024 18:31
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.

Compile Linux releases with zig cc
2 participants