Makefile.inc1: fix intermittent libmagic build failure under high parallelism by laffer1 · Pull Request #400 · MidnightBSD/src · GitHub
Skip to content

Makefile.inc1: fix intermittent libmagic build failure under high parallelism#400

Merged
laffer1 merged 1 commit into
stable/4.1from
fix-libmagic-libz-dep-4.1
Jun 15, 2026
Merged

Makefile.inc1: fix intermittent libmagic build failure under high parallelism#400
laffer1 merged 1 commit into
stable/4.1from
fix-libmagic-libz-dep-4.1

Conversation

@laffer1

@laffer1 laffer1 commented Jun 15, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds missing lib/libmagic__L: lib/libz__L dependency in Makefile.inc1
  • lib/libmagic/Makefile has LIBADD= z but no __L ordering constraint was declared
  • Under high parallelism (make -j28) the linker step for libmagic.so.4.full can race ahead of libz being installed into the sysroot

Observed failure:

ld: error: unable to find library -lz
cc: error: linker command failed with exit code 1
*** [libmagic.so.4.full] Error code 1

Same fix already merged to stable/4.0 in PR #399.

Test plan

  • make -j28 buildworld on amd64 — confirm lib/libmagic builds cleanly
  • make -j4 buildworld — confirm no regression at lower parallelism

🤖 Generated with Claude Code

Summary by Sourcery

Bug Fixes:

  • Add an explicit libmagic-to-libz dependency to ensure libmagic linking does not race ahead of libz installation during parallel builds.

libmagic links against -lz (LIBADD= z in lib/libmagic/Makefile) but
Makefile.inc1 had no explicit lib/libmagic__L: lib/libz__L dependency.
Under high parallelism (e.g. make -j28) libmagic could begin linking
before libz was installed into the sysroot, producing:

  ld: error: unable to find library -lz
  *** [libmagic.so.4.full] Error code 1

All other libraries that link libz already have this dependency
declared (libarchive, libssh, libzfs, libsqlite3, etc).

Signed-off-by: Lucas Holt <luke@foolishgames.com>
@sourcery-ai

sourcery-ai Bot commented Jun 15, 2026

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates Makefile.inc1 to declare a dependency on lib/libz__L for lib/libmagic__L. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@laffer1 laffer1 merged commit b895cc1 into stable/4.1 Jun 15, 2026
2 of 4 checks passed
@laffer1 laffer1 deleted the fix-libmagic-libz-dep-4.1 branch June 15, 2026 17:55

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

1 participant