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)
Fri, Nov 21, 9:32 AM
Unknown Object (File)
Sun, Nov 16, 2:12 PM
Unknown Object (File)
Fri, Nov 14, 3:27 PM
Unknown Object (File)
Mon, Nov 10, 3:28 PM
Unknown Object (File)
Sun, Nov 9, 4:20 PM
Unknown Object (File)
Sun, Nov 9, 4:12 PM
Unknown Object (File)
Sat, Nov 8, 3:40 PM
Unknown Object (File)
Fri, Nov 7, 1:59 AM
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.