Bug 235107 - 'make buildworld' of 12.0-RELEASE sources fails in special circumstances
Summary: 'make buildworld' of 12.0-RELEASE sources fails in special circumstances
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-21 12:41 UTC by oz42
Modified: 2019-02-18 08:17 UTC (History)
2 users (show)

See Also:


Attachments
src.conf and make.conf (1.21 KB, application/x-zip-compressed)
2019-02-01 07:18 UTC, oz42
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description oz42 2019-01-21 12:41:05 UTC
===> lib/ofed/libibnetdisc (all)
===> lib/ofed/libopensm (all)
===> lib/libpcap (all)
/usr/local/libexec/ccache/world/cc  -O2 -pipe   -DHAVE_CONFIG_H -I/usr/src/lib/libpcap -I/usr/obj/usr/src/amd64.amd64/lib/libpcap -D_U_="__attribute__((unused))" -DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DBUILDING_PCAP -DHAVE_NET_PFVAR_H -DPCAP_SUPPORT_NETMAP -DPCAP_SUPPORT_RDMASNIFF -I/usr/src/contrib/libpcap -DNDEBUG -MD  -MF.depend.gencode.o -MTgencode.o -std=gnu99 -fstack-protector-strong -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses  -Qunused-arguments  -c /usr/src/contrib/libpcap/gencode.c -o gencode.o
In file included from /usr/src/contrib/libpcap/gencode.c:77:
/usr/include/net/pfvar.h:52:10: fatal error: 'netpfil/pf/pf.h' file not found
#include <netpfil/pf/pf.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.
*** Error code 1

Stop.
make[5]: stopped in /usr/src/lib/libpcap


root@betsy:/usr/src # find . -name pf.h
./sys/netpfil/pf/pf.h
Comment 1 Kristof Provost freebsd_committer freebsd_triage 2019-01-21 19:17:32 UTC
Can you include your build command?
Comment 2 oz42 2019-01-22 08:06:14 UTC
It was a simple 'make buildworld'
Comment 3 Kristof Provost freebsd_committer freebsd_triage 2019-01-22 08:28:30 UTC
Are you building on 12.0?
Comment 4 oz42 2019-01-22 08:43:02 UTC
Yes, it is a 12.0-RELEASE system.

This is the src.conf:

WITHOUT_ACCT=YES
WITHOUT_AMD=YES
WITHOUT_ASSERT_DEBUG=YES
WITHOUT_ATM=YES
#
WITHOUT_AUTHPF=YES
WITHOUT_BHYVE=YES
WITHOUT_BLUETOOTH=YES
WITHOUT_BOOTPARAMD=YES
WITHOUT_BOOTPD=YES
WITHOUT_BSNMP=YES
WITHOUT_CALENDAR=YES
WITHOUT_CAPSICUM=YES    # includes WITHOUT_CASPER
WITHOUT_CCD=YES
WITHOUT_CDDL=YES        # includes WITHOUT_CTF WITHOUT_ZFS
#
WITHOUT_LLVM_TARGET_AARCH64=YES
WITHOUT_LLVM_TARGET_ALL=YES
WITHOUT_LLVM_TARGET_ARM=YES
WITHOUT_LLVM_TARGET_MIPS=YES
WITHOUT_LLVM_TARGET_POWERPC=YES
WITHOUT_LLVM_TARGET_SPARC=YES
#
WITHOUT_CTM=YES
WITHOUT_CUSE=YES
WITHOUT_CXGBETOOL=YES
WITHOUT_DEBUG_FILES=YES
WITHOUT_DICT=YES
WITHOUT_DMAGENT=YES
WITHOUT_EXAMPLES=YES
WITHOUT_FLOPPY=YES
WITHOUT_FTP=YES
WITHOUT_GCOV=YES
WITHOUT_GSSAPI=YES
WITHOUT_HAST=YES
WITHOUT_HTML=YES
WITHOUT_HYPERV=YES
WITHOUT_INET6=YES
WITHOUT_INETD=YES
WITHOUT_IPFILTER=YES
# WITHOUT_IPFW=YES
WITHOUT_IPSEC_SUPPORT=YES
WITHOUT_ISCSI=YES
WITHOUT_JAIL=YES
WITHOUT_KDUMP=YES
WITHOUT_KERBEROS=YES
WITHOUT_KERNEL_SYMBOLS=YES
WITHOUT_LEGACY_CONSOLE=YES
WITHOUT_LPR=YES
WITHOUT_LS_COLORS=YES
WITHOUT_MAILWRAPPER=YES
WITHOUT_MLX5TOOL=YES
WITHOUT_MODULE_DRM=YES
WITHOUT_MODULE_DRM2=YES
WITHOUT_NDIS=YES
WITHOUT_NIS=YES
WITHOUT_PMC=YES
WITHOUT_PPP=YES
WITHOUT_PROFILE=YES
WITHOUT_RADIUS_SUPPORT=YES
WITHOUT_RBOOTD=YES
WITHOUT_ROUTED=YES
WITHOUT_SENDMAIL=YES
WITHOUT_SOURCELESS=YES  # no sourceless code in kernel, includes WITHOUT_SOURCELESS_HOST WITHOUT_SOURCELESS_UCODE
WITHOUT_TCP_WRAPPERS=YES
WITHOUT_TESTS=YES       # includes WITHOUT_DTRACE_TESTS WITHOUT_TESTS_SUPPORT
WITHOUT_TFTP=YES
WITHOUT_TIMED=YES
WITHOUT_USB=YES
WITHOUT_USB_GADGET_EXAMPLES=YES
WITHOUT_WIRELESS=YES    # includes WITHOUT_WIRELESS_SUPPORT=YES
WITHOUT_WPA_SUPPLICANT_EAPOL=YES
WITHOUT_ZFS=YES
Comment 5 Kristof Provost freebsd_committer freebsd_triage 2019-01-23 00:21:48 UTC
Have you previously done buildworld/installworld with these or other flags? 

I can't seem to reproduce this, and I see no obvious reason why it'd happen. You're not disabling pf, so the header should be installed. And I've tested WITHOUT_PF, and that builds fine for me too.
Comment 6 oz42 2019-01-23 09:36:42 UTC
This only happens when /usr/include/netpfil/pf/pf.h (and other *.h files) do not exist.

On 11.0-RELEASE, this is not necessary. It finds and includes /usr/src/sys/netpfil/pf/pf.h


When I change the Makefile line PCAPINCS to a modified 11.0-RELEASE version

PCAPINCS=       pcap/pcap.h pcap/namedb.h pcap/bpf.h pcap/dlt.h

then building does not fail. So the bug seems to exist in Makefile.
Comment 7 Kristof Provost freebsd_committer freebsd_triage 2019-01-23 09:39:39 UTC
(In reply to oz42 from comment #6)
I would not expect the build to use the installed pf.h header file, so that's odd.

Also, why would the header file not be installed?

I can't tell what you changed. Can you post a diff instead?
Comment 8 oz42 2019-01-23 09:42:24 UTC
Sorry, my last comment is invalid, please ignore it. On another 12.0-RELEASE machine, libpcap builds just fine.

I will investigate both machines.
Comment 9 oz42 2019-01-28 11:14:32 UTC
Up to now, I have found that a 'make delete-old' [1] removes all unneccesary *.h files from /usr/include. That's okay. The problem is that files in /usr/src include files from /usr/include that no longer exist.

I am no developer, but I assume the solution would be to include all *.h files from /usr/src only. E.g. /usr/src/lib/libcasper/libcasper/libcasper.h instead of the deleted /usr/include/libcasper.h

Right now, it is possible to remove some stuff from your system by putting lines like WITHOUT_ATM=YES into /etc/src.conf, the result is a more 'lightweight' system. But it is not possible to get those features back once they have been removed from the system.


[1] a suggestion from /usr/src/Makefile
Comment 10 Kristof Provost freebsd_committer freebsd_triage 2019-01-28 16:23:35 UTC
(In reply to oz42 from comment #9)
> I assume the solution would be to include all *.h files from /usr/src only

Yes, but that's what the build already does.

I can't reproduce this build failure, even after 'make delete-old' with WITHOUT_PF=yes set.
Comment 11 oz42 2019-02-01 07:17:36 UTC
I have proven that make buildworld includes *.h files from /usr/include.

Long story short: please install a fresh 12.0-RELEASE system and add attached src.conf and make.conf, then:

- make buildworld && make kernel (add your KERNCONF here)
- nextboot -o "-s" && reboot
- mergemaster -p
- cd /usr/src && make installworld
- mergemaster
- yes|make delete-old
- yes|make delete-old-libs
- reboot

Now you have a stripped down and happy system. But when you delete /etc/src.conf and run "make buildworld" to get back a "generic" system, building will fail.

I have tried once more. Result: another *.h file, same story:

===> bin/chio (all)
===> bin/chmod (all)
===> bin/cp (all)
===> bin/date (all)
===> bin/dd (all)
/usr/local/libexec/ccache/world/cc  -O2 -pipe   -DNDEBUG -MD  -MF.depend.dd.o -MTdd.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -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/bin/dd/dd.c -o dd.o
In file included from /usr/src/bin/dd/dd.c:60:
/usr/include/capsicum_helpers.h:42:10: fatal error: 'libcasper.h' file not found
#include <libcasper.h>
         ^~~~~~~~~~~~~
1 error generated.


root@fb:~ # find /usr -name libcasper.h
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/libcasper.h
/usr/src/lib/libcasper/libcasper/libcasper.h

=> header files from /usr/src are not included, but from /usr/include
Comment 12 oz42 2019-02-01 07:18:03 UTC
Created attachment 201581 [details]
src.conf and make.conf
Comment 13 Kristof Provost freebsd_committer freebsd_triage 2019-02-01 23:04:11 UTC
I seem to be running into different build problems then.
I honestly don't understand the use case for this, and it's not a pf-related bug, so I'm not going to investigate it any further.
Comment 14 Kurt Jaeger freebsd_committer freebsd_triage 2019-02-16 20:43:18 UTC
You are saying: building and installing a reduced system does not install all files necessary to build a full system again -- because make buildworld
expects files from outside /usr/src when it builds and the stripped-down
system does not have all the files required ? This can be seen as a valid problem, but only if one understands *why* one would do this ?

Can you describe why you need such a process (build-install-striped-down,
use it to build-full-system) ?
Comment 15 oz42 2019-02-18 08:17:05 UTC
I could perhaps want to enable a disabled feature again. But this is not the problem.

The point is that 'make buildworld' even bootstraps its own compiler when necessary, but still depends on files outside of /usr/src that exist in /usr/src. *.h and lib* files for example.