Bug 245973 - [12.1R] Unbuildable on -current
Summary: [12.1R] Unbuildable on -current
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-27 14:52 UTC by Sean Bruno
Modified: 2020-04-29 19:30 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sean Bruno freebsd_committer freebsd_triage 2020-04-27 14:52:23 UTC
12.1R is currently unbuildable on -current and fails with:

-------------------------------------------------------------
>>> stage 3: cross tools
--------------------------------------------------------------
cd /usr/home/sbruno/bsd/12.1R; INSTALL="sh
/usr/home/sbruno/bsd/12.1R/tools/install.sh"
TOOLS_PREFIX=/var/tmp/usr/home/sbruno/bsd/12.1R/amd64.amd64/tmp
PATH=/var/tmp/usr/home/sbruno/bsd/12.1R/amd64.amd64/tmp/legacy/usr/sbin:/var/tmp/usr/home/sbruno/bsd/12.1R/amd64.amd64/tmp/legacy/usr/bin:/var/tmp/usr/home/sbruno/bsd/12.1R/amd64.amd64/tmp/legacy/bin:/sbin:/bin:/usr/sbin:/usr/bin
 WORLDTMP=/var/tmp/usr/home/sbruno/bsd/12.1R/amd64.amd64/tmp
MAKEFLAGS="-m /usr/home/sbruno/bsd/12.1R/tools/build/mk  -D NO_CLEAN -m
/usr/home/sbruno/bsd/12.1R/share/mk" make  -f Makefile.inc1  DESTDIR=
OBJTOP='/var/tmp/usr/home/sbruno/bsd/12.1R/amd64.amd64/tmp/obj-tools'
OBJROOT='${OBJTOP}/'  MAKEOBJDIRPREFIX=  BOOTSTRAPPING=1300092
BWPHASE=cross-tools  SSP_CFLAGS=  MK_HTML=no NO_LINT=yes MK_MAN=no
-DNO_PIC MK_PROFILE=no -DNO_SHARED  -DNO_CPU_CFLAGS MK_WARNS=no
MK_CTF=no  MK_CLANG_EXTRAS=no MK_CLANG_FULL=no  MK_LLDB=no
MK_RETPOLINE=no MK_TESTS=no  MK_INCLUDES=yes MK_LLVM_TARGET_ALL=no
TARGET=amd64 TARGET_ARCH=amd64  MK_GDB=no MK_TESTS=no cross-tools
===> lib/clang (obj,all,install)
===> lib/clang/libllvm (all)
make[4]: "/usr/home/sbruno/bsd/12.1R/lib/clang/libllvm/Makefile" line
18: Please enable at least one of: MK_LLVM_TARGET_AARCH64,
MK_LLVM_TARGET_ARM, MK_LLVM_TARGET_BPF, MK_LLVM_TARGET_MIPS,
MK_LLVM_TARGET_POWERPC, MK_LLVM_TARGET_RISCV, MK_LLVM_TARGET_SPARC,  or
MK_LLVM_TARGET_X86
*** Error code 1
Comment 1 Sean Bruno freebsd_committer freebsd_triage 2020-04-27 14:54:22 UTC
I did have to update from January -current to April to get this to fail:

FreeBSD alice 13.0-CURRENT FreeBSD 13.0-CURRENT #1 r360134: Mon Apr 20 17:12:37 MDT 2020     sbruno@alice:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG  amd64
Comment 2 Warner Losh freebsd_committer freebsd_triage 2020-04-27 17:17:18 UTC
This is caused by MK_CLANG defaulting to 'no'. I'm not 100% sure why that's the case. So, when MK_LLVM_BOOTSTRAP=yes (which is the default) we wind up in lib/clang/libllvm with none of the list MK options enabled because we only enable them when MK_CLANG=yes. This is an unfortunate coupling between CLANG and LLDB, coupled with, I think, smarts to not build clang needlessly. This was fixed in -current in r355588 and MFC'd in r356696, but 12.0R is forever immutable. The root cause of why MK_CLANG winds up being no I've not investigated very deeply.

The workaround is relatively simple. Add MK_CLANG=yes on the command line for make buildworld. It's unfortunate, but cannot be helped if you want to build 12.1R on -current.
Comment 3 Antoine Brodin freebsd_committer freebsd_triage 2020-04-27 18:13:56 UTC
Can't this workaround be published in an EN for releng/12.1?
Comment 4 Ed Maste freebsd_committer freebsd_triage 2020-04-27 19:37:50 UTC
Needs r352033 and r357661

bdrewery points out r355588 could also come; it's 12.1 only though
Comment 5 Bjoern A. Zeeb freebsd_committer freebsd_triage 2020-04-27 20:33:16 UTC
Is this because people compile different major releases without make -m /path/to/other/major/share/mk  ... and are instead of at some point picking up the installed versions for bootstrapping?   That's hit us in the other direction more than once in the last 15 years ... (and we never officially supported downgrading).
Comment 6 Ed Maste freebsd_committer freebsd_triage 2020-04-27 20:43:12 UTC
(In reply to Bjoern A. Zeeb from comment #5)
No, it's because the host compiler / linker version checks in 12.1-REL use a glob expression of [1-9].[0-9]* and so don't match 10.0.
Comment 7 Sean Bruno freebsd_committer freebsd_triage 2020-04-28 17:19:09 UTC
Is there anything further required to be done here?

I don't have a strong opinion one way or the other here.  Which should we proceed with:
 - add a hack of MK_CLANG to portmgr's builds to resume building pkgs
 - or wait for 12.1R to get an EN done
Comment 8 commit-hook freebsd_committer freebsd_triage 2020-04-29 18:52:36 UTC
A commit references this bug:

Author: emaste
Date: Wed Apr 29 18:51:35 UTC 2020
New revision: 360473
URL: https://svnweb.freebsd.org/changeset/base/360473

Log:
  MF10 r352637,r358076: correct Clang and lld version checks

  r352637 (mhorne): Allow for compiler versions >= 10
  r358076 (dim): Correctly recognize linker versions greater than 10.0.

  These routines determine the host compiler and linker version, and caused
  attempts to build 12.1-RELEASE on 13-CURRENT to fail after the latter was
  updated to Clang 10.  We don't guarantee such a build config to work, but
  it is used by FreeBSD ports build processes.  As a result the fixes from
  stable/12 will be included with the next set of advisories, and are being
  committed to the branch now to unblock ports builds.

  PR:		245973
  Reported by:	sbruno, antoine
  Approved by:	so
  Errata:		EN-20:10.build
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  releng/12.1/
  releng/12.1/share/mk/bsd.compiler.mk
  releng/12.1/share/mk/bsd.linker.mk
Comment 9 commit-hook freebsd_committer freebsd_triage 2020-04-29 19:00:42 UTC
A commit references this bug:

Author: emaste
Date: Wed Apr 29 18:59:38 UTC 2020
New revision: 360474
URL: https://svnweb.freebsd.org/changeset/base/360474

Log:
  MF11 r352638,r358076: correct Clang and lld version checks

  r352638 (mhorne): Allow for compiler versions >= 10
  r358076 (dim): Correctly recognize linker versions greater than 10.0.

  These routines determine the host compiler and linker version, and caused
  attempts to build 12.1-RELEASE on 13-CURRENT to fail after the latter was
  updated to Clang 10.  The host compiler version was also misdetected on
  11.3 although it seems not to have caused the same build failure there.

  We don't guarantee such a build config to work, but it is used by FreeBSD
  ports build processes.  As a result the fixes from stable/11 will be
  included with the next set of advisories, and are being committed to the
  releng branch now to unblock ports builds.

  PR:		245973
  Reported by:	sbruno, antoine
  Approved by:	so
  Errata:		EN-20:10.build
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  releng/11.3/
  releng/11.3/share/mk/bsd.compiler.mk
  releng/11.3/share/mk/bsd.linker.mk
Comment 10 Ed Maste freebsd_committer freebsd_triage 2020-04-29 19:30:58 UTC
Merged to 12.1-rel and 11.3-rel and will be EN-20:10.build