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

test/link/glibc_compat: Add C test case for glibc versions #19007

Merged
merged 2 commits into from
Jun 8, 2024

Conversation

rootbeer
Copy link
Contributor

@rootbeer rootbeer commented Feb 19, 2024

Add glibc_runtime_check.c: a simple test case that exercises glibc functions that might smoke out linking problems with Zig's C compiler. The build.zig compiles it against a variety of glibc versions.

Also mark the aarch64 glibc minimum version as 2.17 (the aarch64_be target was already marked). This is necessary because earlier versions of glibc do not support the aarch64 architecture.

Also document and test glibc v2.2.5 (from 2002) as the oldest working glibc target for C binaries. (Earlier versions fail with a raft of missing symbols.)

@rootbeer rootbeer force-pushed the glibc-c-test branch 2 times, most recently from c47defa to fe42c88 Compare February 24, 2024 19:27
@rootbeer rootbeer force-pushed the glibc-c-test branch 2 times, most recently from 996bdf8 to 92030ed Compare February 29, 2024 03:55
@rootbeer rootbeer force-pushed the glibc-c-test branch 2 times, most recently from af860bc to c85dd5c Compare March 16, 2024 23:29
rootbeer added 2 commits June 6, 2024 09:36
glibc_runtime_check.c is a simple test case that exercises glibc functions
that might smoke out linking problems with Zig's C compiler.  The
build.zig compiles it against a variety of glibc versions.

Also document and test glibc v2.2.5 (from 2002) as the oldest working
glibc target for C binaries.
Had constrained the `aarch64_be` target, but not `aarch64`.  This
constraint is necessary because earlier versions of glibc do not support
the aarch64 architecture.

Also, skip unsupported test cases.
@andrewrk
Copy link
Member

andrewrk commented Jun 8, 2024

Nice!

@andrewrk andrewrk merged commit 7ae9d80 into ziglang:master Jun 8, 2024
10 checks passed
@andrewrk
Copy link
Member

andrewrk commented Jun 8, 2024

BTW, here are some pre-built glibc sets that you can use:

https://ziglang.org/deps/glibc-multi-2.33.tar.zst
https://ziglang.org/deps/glibc-multi-2.34.tar.zst
https://ziglang.org/deps/glibcs-2.36.tar.zst
https://ziglang.org/deps/glibcs-2.37.tar.zst
https://ziglang.org/deps/glibcs-2.38.tar.zst
https://ziglang.org/deps/glibcs-2.39.tar.zst

Warning: these files are massive - multiple GiB each.

testing instructions

I have not enabled any such testing on the CI (yet?)

Basically, QEMU can be used to run cross-compiled zig code that uses glibc.

@rootbeer rootbeer deleted the glibc-c-test branch June 8, 2024 20:39
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.

2 participants