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

Fix compilation against musl libc #64

Merged
merged 3 commits into from
Jun 3, 2024
Merged

Conversation

stintel
Copy link
Contributor

@stintel stintel commented Mar 30, 2024

  • usr: do not rely on non-portable __WORDSIZE
  • usr: do not rely on LFS64 interfaces
  • CI: build on Alpine Linux

The __WORDSIZE macro is not properly documented anywhere. Relying on it
causes a compile error.s on systems using musl libc.

POSIX defines LONG_BIT; use that instead.

Signed-off-by: Stijn Tintel <[email protected]>
LFS64 interfaces are non-standard. Relying on them causes multiple
compile errors on systems using musl libc 1.2.4 or later. They could be
worked around by defining _LARGEFILE64_SOURCE, but this only a short
term workaround, and will be removed in a future musl version.

Instead, define _FILE_OFFSET_BITS as 64, which makes all interfaces on
glibc 64-bit by default, and replace the non-standard interfaces with
the standard ones. This replaces all occurences of fstat64 with fstat,
lseek64 with lseek, pread64 with pread, pwrite64 with pwrite, and stat64
with stat.

Signed-off-by: Stijn Tintel <[email protected]>
Add a CI step to build on Alpine Linux, to avoid future breakage on
systems running musl libc.

Signed-off-by: Stijn Tintel <[email protected]>
@stintel
Copy link
Contributor Author

stintel commented May 29, 2024

ping @fujita

@fujita fujita merged commit 636028d into fujita:master Jun 3, 2024
2 checks passed
@fujita
Copy link
Owner

fujita commented Jun 3, 2024

Thanks!

@stintel stintel deleted the fix/musl branch June 4, 2024 06:11
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