3
26
Fork
You've already forked mere
1

fix: build and test on non-Mere hosts (Arch Linux, etc.) #47

Merged
jhuntwork merged 1 commit from fix/build-on-foreign-hosts into main 2026年04月01日 18:10:25 +02:00

Five fixes for building and running on systems with glibc:

  1. Fix var->const for envp in namespace.zig (caught by newer zig
    nightly builds).

  2. Prevent vendored curl from auto-detecting host libraries. The
    configure step was finding system nghttp2, brotli, libidn2,
    librtmp, and openldap, then linking against them without
    including them in the final link line. Added explicit --without
    and --disable flags.

  3. Prevent vendored libarchive from auto-detecting host libmd.
    On systems with libmd/libbsd installed, configure found BSD
    digest headers (md5.h, sha.h, etc.) and linked against libmd
    for SHA/MD5/RMD160 functions. Added ac_cv overrides to skip
    these header and library checks.

  4. Fix EBADF from fchmod on glibc. When opening a directory with
    default options (.{}), zig uses O_PATH which returns a path-only
    fd. fchmod/fchown on O_PATH fds returns EBADF on Linux. On musl
    this was masked because O_PATH may not be set. Fixed all call
    sites that open a directory and then call setPermissions or
    setOwner to use .{ .iterate = true } which avoids O_PATH.

  5. Move ld-musl interpreter provision detection outside the
    target_exists check. The detection is name-based (symlink named
    ld-musl-*.so.1 under lib/) and does not need the symlink target
    to resolve on the build host. On glibc systems, the absolute
    target /lib/libc.so does not exist.

Closes #43

Five fixes for building and running on systems with glibc: 1. Fix var->const for envp in namespace.zig (caught by newer zig nightly builds). 2. Prevent vendored curl from auto-detecting host libraries. The configure step was finding system nghttp2, brotli, libidn2, librtmp, and openldap, then linking against them without including them in the final link line. Added explicit --without and --disable flags. 3. Prevent vendored libarchive from auto-detecting host libmd. On systems with libmd/libbsd installed, configure found BSD digest headers (md5.h, sha.h, etc.) and linked against libmd for SHA/MD5/RMD160 functions. Added ac_cv overrides to skip these header and library checks. 4. Fix EBADF from fchmod on glibc. When opening a directory with default options (.{}), zig uses O_PATH which returns a path-only fd. fchmod/fchown on O_PATH fds returns EBADF on Linux. On musl this was masked because O_PATH may not be set. Fixed all call sites that open a directory and then call setPermissions or setOwner to use .{ .iterate = true } which avoids O_PATH. 5. Move ld-musl interpreter provision detection outside the target_exists check. The detection is name-based (symlink named ld-musl-*.so.1 under lib/) and does not need the symlink target to resolve on the build host. On glibc systems, the absolute target /lib/libc.so does not exist. Closes #43
jhuntwork force-pushed fix/build-on-foreign-hosts from 4e50c69cab
Some checks failed
/ test (pull_request) Has been cancelled
to db584c0419
All checks were successful
/ test (pull_request) Successful in 6m3s
2026年04月01日 17:34:11 +02:00
Compare
jhuntwork deleted branch fix/build-on-foreign-hosts 2026年04月01日 18:10:40 +02:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
merelinux/mere!47
Reference in a new issue
merelinux/mere
No description provided.
Delete branch "fix/build-on-foreign-hosts"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?