Bug 252759 - WITHOUT_LIBCPLUSPLUS build option fails on usr.bin/dtc
Summary: WITHOUT_LIBCPLUSPLUS build option fails on usr.bin/dtc
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2021-01-17 00:37 UTC by Michael Dexter
Modified: 2021-02-01 10:07 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Dexter 2021-01-17 00:37:08 UTC
If WITHOUT_LIBCPLUSPLUS=YES is set in /etc/src.conf on 13.0-ALPHA1 amd64, the following warning and error are generated:

--- all_subdir_usr.bin ---
--- all_subdir_usr.bin/dtc ---
In file included from /usr/src/usr.bin/dtc/dtc.cc:46:
/usr/src/usr.bin/dtc/fdt.hh:37:10: fatal error: 'algorithm' file not found
#include <algorithm>
--- netstat.o ---
cc -target x86_64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin  -O2 -pipe -fno-common   -DNDEBUG -MD  -MF.depend.netstat.o -MTnetstat.o -std=gnu99 -Wno-format-zero-length -nobuiltininc -idirafter /usr/lib/clang/10.0.1/include -Qunused-arguments   -c /usr/src/usr.bin/systat/netstat.c -o netstat.o
--- all_subdir_usr.sbin ---
--- all_subdir_usr.sbin/periodic ---
--- all_subdir_usr.sbin/periodic/etc/daily ---
===> usr.sbin/periodic/etc/daily (all)
--- all_subdir_usr.bin ---
--- all_subdir_usr.bin/procstat ---
--- procstat_pwdx.o ---
--- all_subdir_usr.bin/dtc ---
*** [dtc.o] Error code 1

make[4]: stopped in /usr/src/usr.bin/dtc

The following syntax appears to resolve the issue:

diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index 8ea3b1c2bfe3..8e32e82bdc0f 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -212,9 +212,12 @@ SUBDIR.${MK_GAMES}+=       number
 SUBDIR.${MK_GAMES}+=   pom
 SUBDIR.${MK_GAMES}+=   primes
 SUBDIR.${MK_GAMES}+=   random
+.if ${MK_LIBCPLUSPLUS}  != "no"
+#.if ${COMPILER_FEATURES:Mc++11} || ${MK_LIBCPLUSPLUS} != "no"
 SUBDIR+=       dtc
 .if ${MK_GH_BC} == "yes"
 SUBDIR+=               gh-bc

This syntax, commented out, did not resolve the issue, but is included should someone be able to combine the two conditions:

+#.if ${COMPILER_FEATURES:Mc++11} || ${MK_LIBCPLUSPLUS} != "no"
Comment 1 Ed Maste freebsd_committer 2021-01-17 01:09:00 UTC
See also https://reviews.freebsd.org/D27974
Comment 2 Michael Dexter 2021-01-17 01:23:08 UTC
THAT is great news! Make it so!
Comment 3 Michael Dexter 2021-01-17 01:34:04 UTC
Being dtc related, this fix would need to be conditional on ARM platforms.
Comment 4 Alex Richardson freebsd_committer 2021-01-19 11:52:59 UTC
IMO the check should be MK_CXX, since this is not related to libc++ vs libstdc++ but rather having a C++ compiler plus standard library.

Since C++11 is required now, we could change:

SUBDIR+=	dtc


SUBDIR.${MK_CXX}+=	dtc
Comment 5 Alex Richardson freebsd_committer 2021-01-19 11:56:54 UTC
Comment 6 commit-hook freebsd_committer 2021-01-19 21:40:00 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=c1a3d7f20696ab5b72eee45863f3e04410d81fc8

commit c1a3d7f20696ab5b72eee45863f3e04410d81fc8
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-01-19 15:05:43 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2021-01-19 21:37:36 +0000

    Remove remaining uses of ${COMPILER_FEATURES:Mc++11}

    All supported compilers have C++11 support so these checks can be replaced
    with MK_CXX guards.
    See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252759

    PR:             252759
    Reviewed By:    emaste
    Differential Revision: https://reviews.freebsd.org/D28234

 lib/libc/tests/stdlib/Makefile | 2 --
 lib/ofed/libibnetdisc/Makefile | 2 --
 usr.bin/Makefile               | 4 +---
 usr.sbin/Makefile              | 4 +---
 4 files changed, 2 insertions(+), 10 deletions(-)
Comment 7 Alex Richardson freebsd_committer 2021-02-01 10:07:39 UTC
Should be fixed now that https://reviews.freebsd.org/D28234 and https://reviews.freebsd.org/D27974 have been committed.