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
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds an explicit build dependency so libmagic links against libz reliably under high parallelism by updating Makefile.inc1.

File-Level Changes

Change Details Files
Add missing libmagic → libz build dependency to avoid linker races under high parallelism.
  • Declare lib/libmagic__L dependency on lib/libz__L in the global build orchestration makefile.
  • Ensure libz is built and installed into the sysroot before the libmagic shared library link step runs.
  • Align main branch build dependencies with the already-fixed stable/4.0 branch for consistent behavior.
Makefile.inc1

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@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