Re: Undefined symbol "setgroups@FBSD_1.8"

From: Mark Millard <marklmi_at_yahoo.com>
Date: Wed, 15 Oct 2025 06:40:26 UTC
On Oct 14, 2025, at 21:25, void <void@f-m.fm> wrote:

> On Tue, Oct 14, 2025 at 06:24:03PM -0700, Mark Millard wrote:
>> So: in some way an inappropriate mix of vintages seems to
>> be in use.
>> 
>> Based on the messages, it appears that /overlays/sccache/bin/sccache
>> has or leads to loading something that the: "setgroups@FBSD_1.8"
>> reference. It possibly needs to be built for 13.5-RELEASE-p5 . That
>> would have no "setgroups@FBSD_1.8" reference to complain about.
> 
> This is stable/15 server running releng/13.5 poudriere jail.
> poudriere itself calls sccache via the sccache-overlay like
> 
> # poudriere bulk -j 135R-amd64 -O sccache -f filelist.txt

@FBSD_1.0 was created long ago with setgroups (and getgroups)
in it:

QUOTE
author Daniel Eischen <deischen@FreeBSD.org> 2006-03-13 00:53:21 +0000

committer Daniel Eischen <deischen@FreeBSD.org> 2006-03-13 00:53:21 +0000
commit cce72e8860e207b5be84acb82c75f0e644a60e29 (patch)
tree cce59bbc3af80cd57773205c0b711fdd9967fada /lib/libc/sys/Symbol.map
parent 51f38c318bd5ecd8ab91bfcfe6648a56f7a8ea64 (diff)

Add symbol maps and initial symbol version definitions to libc.
Reviewed by: davidxu
END QUOTE

@FBSD_1.8 was created in main during main 15:

QUOTE
author Konstantin Belousov <kib@FreeBSD.org> 2024-01-19 19:55:11 +0000
committer Konstantin Belousov <kib@FreeBSD.org> 2024-01-24 05:11:26 +0000

commit 211bdd601ee51f90da9b123807ef68ac122116b9 (patch)
tree 7bd6d678367da2451a597025e63fa7febd0d9aca /lib/libc/sys/Symbol.map
parent d8decc9ae31af7ffc77276c89639fb13eb1020cc (diff)

Add kcmp(2) userspace bits
Unlike Linux, we do provide libc wrapper. All definitions and prototypes are available from <unistd.h>
END QUOTE

@FBSD_1.8 does not exist in 14.* or before and those
symbols provide binding to code with incompatible
behavior compared to @FBSD_1.0 symbols. 13.5 only
supports the older behavior, not the @FBSD_1.8
behavior.

getgroups and setgroups were redefined later and moved
to @FBSD_1.8 because of the update's incompatibility,
see:

See: https://reviews.freebsd.org/D51648

The change declaring the newer @FBSD_1.8 implementations are
incompatible in a way that prevents incorrect loading and use
of code that has the new behavior looks like:

diff --git a/lib/libsys/Symbol.sys.map b/lib/libsys/Symbol.sys.map
index 45e0160100af..1a297f9df581 100644
--- a/lib/libsys/Symbol.sys.map
+++ b/lib/libsys/Symbol.sys.map
@@ -89,7 +89,6 @@ FBSD_1.0 {
 	geteuid;
 	getfh;
 	getgid;
-	getgroups;
 	getitimer;
 	getpagesize;
 	getpeername;
@@ -204,7 +203,6 @@ FBSD_1.0 {
 	setegid;
 	seteuid;
 	setgid;
-	setgroups;
 	setitimer;
 	setlogin;
 	setpgid;
@@ -380,11 +378,13 @@ FBSD_1.7 {
 FBSD_1.8 {
 	exterrctl;
 	fchroot;
+	getgroups;
 	getrlimitusage;
 	inotify_add_watch_at;
 	inotify_rm_watch;
 	kcmp;
 	setcred;
+	setgroups;
 };
 
I.e., moving the names from @FBSD_1.0 to @FBSD_1.8 .

> so it calls (externally) sccache materials built and installed on the host.

That is not going to work unless the code is built to
use a setgroups@FBSD_1.0 compatible symbol (and, likely
getgroups@FBSD_1.0 as well), avoiding (direct) use of the
new, incompatible FBSD_1.8 code and using code comatibile
with the likes of 13.5 instead.

> So, what you're saying makes sense. 
> But, I cannot install sccache for 13.5 on a stable/15 host.

Yes you can, presuming the usual compat support is included in
the kernel. stable/15 can use older @FBSD_1.* symbols that it
was designed to also be compatible with since the old interfaces
were known at the time 15 was designed and implemented and, so,
the compatibility code can be there to be referenced. That
includes supporting 13.5 programs and libraries.

> I saw nothing
> during install that sccache-overlay use must be with the same major freebsd version of host and builder.

It is not a sccache-overlay specific choice here. FreeBSD 15+
makes any use of what was put into @FBSD_1.8 not available
under older FreeBSD versions than when @FBSD_1.8 as added:
that is exactly part of what @FBSD_1.8 is for: preventing
binding to old context to new incompatible code updates.

sccache(-overlay) needs to be built to use the @FBSD_1.0 compatible
symbol in order to get the old beahvaior that it was designed for.
One way to do that is to be built for 13.5 instead of 15.* and
to run that 13.5 based code on on 15+ .

> Removing the -O sccache allows the build to proceed, some 500 or so packages.
> Do you think this an sccache{-overlay} problem?

The sccache{-overlay} was built with @FBSD_1.8 usage that
provides the new, incompatible behavior for the name setgroups
that does not exist in a 13.5 context. sccache{-overlay} needs
to be built to use @FBSD_1.0 compatible symbols that will
provide the old, 13.5-compatibile behavior instead.

===
Mark Millard
marklmi at yahoo.com