Your buildworld system is pulling userland libraries/headers

Nathan Lay enslay at gmail.com
Sat Oct 8 18:13:53 UTC 2016


Hello FreeBSD-stable,
Here's another example:

--- begin snip ---
...
/usr/src/usr.bin/nfsstat/nfsstat.c:262:22: error: use of undeclared
identifier 'NFSSTATS_V1'
        ext_nfsstats.vers = NFSSTATS_V1;
                            ^
/usr/src/usr.bin/nfsstat/nfsstat.c:272:27: error: incomplete definition of
type 'struct nfsstatsv1'
                        (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETATTR],
                                   ~~~~~~~~~~~~^
/usr/src/usr.bin/nfsstat/nfsstat.c:107:15: note: forward declaration of
'struct nfsstatsv1'
static struct nfsstatsv1 ext_nfsstats;
              ^
/usr/src/usr.bin/nfsstat/nfsstat.c:273:27: error: incomplete definition of
type 'struct nfsstatsv1'
                        (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETATTR],
                                   ~~~~~~~~~~~~^
/usr/src/usr.bin/nfsstat/nfsstat.c:107:15: note: forward declaration of
'struct nfsstatsv1'
static struct nfsstatsv1 ext_nfsstats;
              ^
/usr/src/usr.bin/nfsstat/nfsstat.c:274:27: error: incomplete definition of
type 'struct nfsstatsv1'
                        (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOOKUP],

...
--- end snip ---

Now why is this? Your build system is including userland headers. Look it's
correct in /usr/src/sys/fs/nfs/nfsport.h
root at RADIO:/usr/src/lib/libprocstat # grep -r NFSSTATS_V1 /usr/src/sys/
/usr/src/sys/fs/nfs/nfsport.h: * The vers field will be set to NFSSTATS_V1
by the caller.
/usr/src/sys/fs/nfs/nfsport.h:#define   NFSSTATS_V1     1
/usr/src/sys/fs/nfs/nfs_commonport.c:                   if (error == 0 &&
nfsstatver.vers != NFSSTATS_V1)
^C


But nfsstats is including /usr/include/fs/nfs/nfsports.h. This is poisoning
the build.

root at RADIO:/usr/src/lib/libprocstat # diff /usr/include/fs/nfs/nfsport.h
/usr/src/sys/fs/nfs/nfsport.h | less
...
> #define       NFSSTATS_V1     1
...

So I'll copy this and build nfsstat myself:
cp /usr/src/sys/fs/nfs/nfsport.h /usr/include/fs/nfs/nfsport.h

root at RADIO:/usr/src/usr.bin/nfsstat # make
clang -O2 -pipe -DNFS -march=nocona  -g -MD  -MF.depend.nfsstat.o
-MTnfsstat.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Werror
-Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual
-Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align
-Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
-Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations
-Wthread-safety -Wno-empty-body -Wno-string-plus-int
-Wno-unused-const-variable  -Qunused-arguments  -c
/usr/src/usr.bin/nfsstat/nfsstat.c -o nfsstat.o
clang -O2 -pipe -DNFS -march=nocona -g -std=gnu99 -fstack-protector-strong
-Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type
-Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter
-Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
-Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations
-Wthread-safety -Wno-empty-body -Wno-string-plus-int
-Wno-unused-const-variable -Qunused-arguments  -o nfsstat.full nfsstat.o
-ldevstat
objcopy --only-keep-debug nfsstat.full nfsstat.debug
objcopy --strip-debug --add-gnu-debuglink=nfsstat.debug  nfsstat.full
nfsstat
gzip -cn /usr/src/usr.bin/nfsstat/nfsstat.1 > nfsstat.1.gz

This is very very disturbing. A build system that builds a self-contained
operating system should not be pulling in the existing userland's headers
and libraries.

Best regards,
Nathan Lay



On Sat, Oct 8, 2016 at 12:26 AM, Nathan Lay <enslay at gmail.com> wrote:

> Hello once again FreeBSD-stable,
> While upgrading from FreeBSD 10-STABLE and later updating my FreeBSD
> 11-STABLE system, I noticed that your build system is pulling headers and
> libraries from the userland rather than the /usr/src tree. This can't
> possibly be intended. I kind of figured with recent news of delayed
> released you might have realized this. After all, _FOR EXAMPLE_ (may not
> reflect reality), who wants to accidentally include userland's older
> version of OpenSSL headers and link with userland's older version of
> OpenSSL?
>
> I can cope with this by manually copying headers from /usr/src/sys/sys and
> /usr/src/include to their appropriate locations and/or installing the newer
> library manually and then restarting the build. But others may not be so
> familiar with FreeBSD. And I did manage to get FreeBSD 11-STABLE up and
> running just fine eventually.
>
> But just a few days ago, I updated SVN to rebuild world and kernel
> following the news of your delayed release and found libprocstat failing to
> compile. And it failed to compile because it was including
> /usr/include/ufs/ufs/extattr.h instead of /usr/src/sys/sys/ufs/ufs/extattr.h.
> This is very disturbing to me. During the FreeBSD 10 updating phase, I saw
> way more examples of this with even unresolved reference errors during
> linking since the build system was trying to link with userland's FreeBSD
> 10 libraries! I can think of two recurring examples: devctl and procstat.
>
> I also noticed your build system liked to now put modules in
> /boot/modules. I was hacking if_ath and none of my changes were working.
> Well, it was because kldload was loading the unchanged one in /boot/kernel
> rather than the one now being installed in /boot/modules. That's a really
> nasty surprise. I probably spent a couple hours figuring that out :)
>
> Best regards,
> Nathan Lay
>
> P.S. FreeBSD 11 is running great! Great job!
>


More information about the freebsd-stable mailing list