Skip to content

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

Merged
andrewrk merged 2 commits into
ziglang:masterfrom
rootbeer:glibc-c-test
Jun 8, 2024
Merged

test/link/glibc_compat: Add C test case for glibc versions#19007
andrewrk merged 2 commits into
ziglang:masterfrom
rootbeer:glibc-c-test

Conversation

@rootbeer

@rootbeer rootbeer commented Feb 19, 2024

Copy link
Copy Markdown
Contributor

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

andrewrk commented Jun 8, 2024

Copy link
Copy Markdown
Member

Nice!

@andrewrk
andrewrk merged commit 7ae9d80 into ziglang:master Jun 8, 2024
@andrewrk

andrewrk commented Jun 8, 2024

Copy link
Copy Markdown
Member

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