Page MenuHomeFreeBSD

Fix make release with -DNOPKGBASE
Needs ReviewPublic

Authored by olivier on Oct 28 2025, 7:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Feb 18, 10:46 AM
Unknown Object (File)
Tue, Feb 17, 12:38 PM
Unknown Object (File)
Mon, Feb 16, 7:21 PM
Unknown Object (File)
Mon, Feb 2, 1:39 PM
Unknown Object (File)
Sat, Jan 31, 10:10 AM
Unknown Object (File)
Mon, Jan 26, 10:46 AM
Unknown Object (File)
Sun, Jan 25, 10:13 AM
Unknown Object (File)
Thu, Jan 22, 7:54 PM
Subscribers

Details

Summary

Problem: When building FreeBSD release with -DNOPKGBASE, the build failed because PKG_ABI was undefined, leading to pkg commands with empty ABI parameters (-o ABI=).

Root Cause: The PKG_ABI variable was only defined inside the !defined(NOPKGBASE) conditional block, but pkg installation commands were still executed in NOPKGBASE mode.

Solution: Moved the PKG_ABI definition (and its dependencies WSTAGEDIR and PKG_ABI_FILE) outside the NOPKGBASE condition and into the !defined(NOPKG) condition, so it's defined whenever packages need to be installed, regardless of whether pkgbase is used or not.

Notice: All troubleshooting and patch made by claude code.

Test Plan

Before:

$ sudo make -C release -DNOPORTS -DNODOC -DNOSRC -DNOPKGBASE memstick -j $(nproc)
(etc.)
pkg: Unknown OS '' in ABI string
pkg: Cannot parse configuration file!
*** [disc1] Error code 1

After:

$ sudo make -C release -DNOPORTS -DNODOC -DNOSRC -DNOPKGBASE memstick -j $(nproc)
(etc.)
$ ls /usr/obj/usr/src/amd64.amd64/release/memstick.img
/usr/obj/usr/src/amd64.amd64/release/memstick.img

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

olivier created this revision.

Does this work with cross-builds? I suspect that WSTAGEDIR is getting set to "" and then you're setting PKG_ABI based on /usr/bin/uname in the host system.

Why are we using PKG_ABI with NOPKGBASE?

Makefile
82

We still need pkg to be usable if NOPKG is set (it just controls 3rd party packages)

Does this work with cross-builds? I suspect that WSTAGEDIR is getting set to "" and then you're setting PKG_ABI based on /usr/bin/uname in the host system.

when packages aren't being built (e.g. with -DNOPKGBASE), worldstage is never populated at all, right? the release just installs directly from objdir into the release image.

Does this work with cross-builds? I suspect that WSTAGEDIR is getting set to "" and then you're setting PKG_ABI based on /usr/bin/uname in the host system.

Why are we using PKG_ABI with NOPKGBASE?

No idea why PKG is used with NOPKGBASE, I’m discovering the Makefile.

Does this work with cross-builds? I suspect that WSTAGEDIR is getting set to "" and then you're setting PKG_ABI based on /usr/bin/uname in the host system.

It points to ${OBJTOP}/worldstage either way, but like @ivy mentioned, it doesn't exist if we're building with NOPKGBASE.

I think the correct fix would be to remove the ABI argument when we're building with NOPKGBASE see, P681.
That patch also fixes the installation of packages in VM_EXTRA_PACKAGES with -DNOPKGBASE.