Page MenuHomeFreeBSD

Makefile.inc1: in _pkgbootstrap, use freshly built pkg, not host version
AbandonedPublic

Authored by dch on Jul 12 2025, 9:27 AM.
Referenced Files
F132237283: D51275.id.diff
Wed, Oct 15, 2:01 AM
F132237275: D51275.id158359.diff
Wed, Oct 15, 2:01 AM
F132198070: D51275.diff
Tue, Oct 14, 5:08 PM
Unknown Object (File)
Sat, Oct 4, 11:06 AM
Unknown Object (File)
Sat, Sep 27, 10:35 PM
Unknown Object (File)
Sat, Sep 20, 7:43 AM
Unknown Object (File)
Thu, Sep 18, 9:18 AM
Unknown Object (File)
Thu, Sep 18, 1:25 AM

Details

Reviewers
None
Group Reviewers
pkgbase
Summary

It seems that _pkgbootstrap relies on the pre-existing system pkg binary which is
not available on cross-built systems, to bootstrap. If we intend to be able to cross-
build packages, this needs fixing in multiple places.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 65372
Build 62255: arc lint + arc unit

Event Timeline

dch requested review of this revision.Jul 12 2025, 9:27 AM
ivy added a subscriber: ivy.

i may be missing something but pkg doesn't ever exist in WSTAGEDIR, does it? it's not part of world since it comes from ports.

edit: or is this meant to call the pkg-bootstrap binary, but that will never work on non-FreeBSD platforms...

In D51275#1176964, @ivy wrote:

i may be missing something but pkg doesn't ever exist in WSTAGEDIR, does it? it's not part of world since it comes from ports.

edit: or is this meant to call the pkg-bootstrap binary, but that will never work on non-FreeBSD platforms...

I don't know how the pkg bootstrap process is supposed to work. What I see that we still build pkg during buildworld/release, and that we use the host pkg command.

find $MAKEOBJDIRPREFIX/ -name pkg -type f -perm +111
/scratch/tmp/wosch/freebsd/home/wosch/projects/freebsd-src/amd64.amd64/worldstage/usr/sbin/pkg
/scratch/tmp/wosch/freebsd/home/wosch/projects/freebsd-src/amd64.amd64/usr.sbin/pkg/pkg
/scratch/tmp/wosch/freebsd/home/wosch/projects/freebsd-src/amd64.amd64/release/dist/base/usr/sbin/pkg
/scratch/tmp/wosch/freebsd/home/wosch/projects/freebsd-src/amd64.amd64/release/disc1-memstick/usr/sbin/pkg
/scratch/tmp/wosch/freebsd/home/wosch/projects/freebsd-src/amd64.amd64/release/bootonly-memstick/usr/sbin/pkg
/scratch/tmp/wosch/freebsd/home/wosch/projects/freebsd-src/amd64.amd64/release/disc1-disc1/usr/sbin/pkg
/scratch/tmp/wosch/freebsd/home/wosch/projects/freebsd-src/amd64.amd64/release/bootonly/usr/sbin/pkg
/scratch/tmp/wosch/freebsd/home/wosch/projects/freebsd-src/amd64.amd64/release/disc1/usr/sbin/pkg
/scratch/tmp/wosch/freebsd/home/wosch/projects/freebsd-src/amd64.amd64/release/bootonly-bootonly/usr/sbin/pkg

Yes, this can't possibly work -- the pkg you see there is built for the target, and it's just the bootstrap that downloads a suitable pkg from pkg.f.o. We don't have a version of pkg that could be used to cross-build packages at the moment, you'd need to bring your own (it is tested on Linux and macOS, IIRC).

i think we agreed this change is wrong, can we close the review?

yup, thanks for the bump.