If WITHOUT_CROSS_COMPILER is false, a clang is built with -DDEFAULT_SYSROOT=\"/usr/obj/usr/src/tmp\", world is built with it and everything goes well. With this flag set to true, a clang is built with -DDEFAULT_SYSROOT=\"\" and buildword uses it, using for instance the system includes instead of those from /usr/src, and fails when new include files appear in the source tree. I didn't investigate if this compiler is a misconfigured first stage one or already the final one, but in either case there is a problem since even if it is the second case and this is a feature, it is a much more aggressive shortcut than what src.conf man page suggests, with serious limitations. This is the underlying cause of another PR I opened as misc/195503 and may well be the cause of bin/182170 as well (at least in the case of the me-too comment there).
This problem has occurred several times, and finally I figured out the reason by myself. After that, I searched for WITHOUT_CROSS_COMPILER and found this PR. It's hard for a user to find this PR or a solution of the problem until the user figured out what's wrong. Because the complexity of the build process and the misleading name of the option, it's unclear to the user that this option is the culprit. WITHOUT_CROSS_COMPILER causes MK_CLANG_BOOTSTRAP=no in src.opts.mk, so the current clang is used instead. But the name of the option only suggests something about "cross compiling", which in the common sense is not required if you are building for the same architecture. Please add some comments to src.opts.mk, which I guess is the common way for users to find this option, or just make the option do what its name suggests.
Add two possibly interested parties to the CC: of this older PR which has a new comment.
Take, I was planning to fix this soon.
It's due to the lack of --sysroot when not using the bootstrap compiler (as comment #0 alluded to). https://reviews.freebsd.org/D3970 is the start to resolving that.
A commit references this bug: Author: bdrewery Date: Fri Mar 25 19:12:38 UTC 2016 New revision: 297270 URL: https://svnweb.freebsd.org/changeset/base/297270 Log: Build libcompat (lib32) with a --sysroot pointing into its stage directory. This overrides the cross-compiler's default sysroot to use the WORLD32's sysroot for building the lib32 libraries. Previously the cross-compiler would default the sysroot to the 64bit WORLDTMP and -B/-L/-isystem flags were used to build using the lib32 files. This leads to multiple issues discussed later. Some extra headers are now needed to be staged since the 64bit WORLDTMP is not referenced at all for headers. The 64bit WORLDTMP is still used via PATH for build tools. Overriding the default target/arch is retained in the CC/CXX overrides. This allows reverting the LDSCRIPT rewriting in installworld from r296921 and r235122, thus allowing read-only objdirs to work for installing again. This removes the need for _LDSCRIPTROOT. This allows progressing the change to always use --sysroot for the build rather than only relying on the cross-compiler's default sysroot. The work for that is in D3970 and needed to resolve WITHOUT_CROSS_COMPILER not using a --sysroot [1]. PR: 196193 [1] Sponsored by: EMC / Isilon Storage Division Changes: head/Makefile.inc1 head/Makefile.libcompat head/share/mk/bsd.lib.mk head/share/mk/bsd.sys.mk
A commit references this bug: Author: bdrewery Date: Fri Mar 25 22:36:13 UTC 2016 New revision: 297277 URL: https://svnweb.freebsd.org/changeset/base/297277 Log: WITHOUT_CROSS_COMPILER: Fix this to use external compiler logic. Without this the default toolchain in /usr/bin/ would not use WORLDTMP via --sysroot, and would lack --target if cross-building. PR: 196193 Related: D3970 Sponsored by: EMC / Isilon Storage Division Changes: head/Makefile.inc1
*** Bug 182170 has been marked as a duplicate of this bug. ***
MARKED AS SPAM