Bug 215684 - ports-mgmt/poudriere-devel: fails to build native-xtools because of libllvmminimal
Summary: ports-mgmt/poudriere-devel: fails to build native-xtools because of libllvmmi...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Only Me
Assignee: Bryan Drewery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-31 15:25 UTC by Sylvain Garrigues
Modified: 2017-01-06 22:09 UTC (History)
8 users (show)

See Also:
bugzilla: maintainer-feedback? (bdrewery)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain Garrigues 2016-12-31 15:25:00 UTC
I encounter an issue when cross-building a recent jail with poudriere, it complains it cannot find /usr/obj/arm.armv6/nxb/usr/src/lib/clang/libllvm/libllvm.a so the native-xtools target fails.

But I do have /usr/obj/arm.armv6/nxb/usr/src/lib/clang/libllvmminimal/libllvmminimal.a

Here is the command which fails. At the bottom is also poudriere version.

[root@dev ~]# poudriere jail -c -j current -a arm.armv6 -m svn -v head@310593 -x
...
c++ -O -pipe -I/usr/obj/arm.armv6/nxb/usr/src/lib/clang/libllvm -I/usr/src/lib/clang/include -I/usr/src/contrib/llvm/include -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DLLVM_DEFAULT_TARGET_TRIPLE=\"armv6-gnueabihf-freebsd12.0\" -DLLVM_HOST_TRIPLE=\"armv6-unknown-freebsd12.0\" -DDEFAULT_SYSROOT=\"\" -Qunused-arguments -std=c++11 -fno-exceptions -fno-rtti -stdlib=libc++ -Wno-c++11-extensions  -static -o llvm-tblgen  AsmMatcherEmitter.o AsmWriterEmitter.o AsmWriterInst.o Attributes.o CTagsEmitter.o CallingConvEmitter.o CodeEmitterGen.o CodeGenDAGPatterns.o CodeGenInstruction.o CodeGenMapTable.o CodeGenRegisters.o CodeGenSchedule.o CodeGenTarget.o DAGISelEmitter.o DAGISelMatcher.o DAGISelMatcherEmitter.o DAGISelMatcherGen.o DAGISelMatcherOpt.o DFAPacketizerEmitter.o DisassemblerEmitter.o FastISelEmitter.o FixedLenDecoderEmitter.o InstrInfoEmitter.o IntrinsicEmitter.o OptParserEmitter.o PseudoLoweringEmitter.o RegisterInfoEmitter.o SearchableTableEmitter.o SubtargetEmitter.o TableGen.o X86DisassemblerTables.o X86ModRMFilters.o X86RecognizableInstr.o /usr/obj/arm.armv6/nxb/usr/src/lib/clang/libllvm/libllvm.a  -lncursesw  -lpthread
c++: error: no such file or directory: '/usr/obj/arm.armv6/nxb/usr/src/lib/clang/libllvm/libllvm.a'
*** [llvm-tblgen] Error code 1

make[2]: stopped in /usr/src/usr.bin/clang/llvm-tblgen
1 error

make[2]: stopped in /usr/src/usr.bin/clang/llvm-tblgen
*** [native-xtools] Error code 2

make[1]: stopped in /usr/src
1 error

make[1]: stopped in /usr/src
*** [native-xtools] Error code 2

make: stopped in /usr/src
1 error

make: stopped in /usr/src
[08:22:09] ====>> Error: Failed to 'make native-xtools'
[08:22:09] ====>> Error while creating jail, cleaning up.
[08:22:09] ====>> Removing current jail... done




[root@dev ~]# pkg show poudriere*
poudriere-devel-3.1.99.20160624_2
Name           : poudriere-devel
Version        : 3.1.99.20160624_2
Installed on   : Thu Dec 29 11:04:32 2016 CET
Origin         : ports-mgmt/poudriere-devel
Architecture   : freebsd:12:x86:64

[root@dev ~]# uname -a
FreeBSD dev.sylvaingarrigues.com 12.0-CURRENT FreeBSD 12.0-CURRENT #0 3673f06(master): Thu Dec 29 11:23:56 CET 2016     ec2-user@clad.sylvaingarrigues.com:/usr/home/ec2-user/freebsd/work-amd64/usr/home/ec2-user/freebsd/src/sys/GENERIC-NODEBUG  amd64
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2016-12-31 17:07:58 UTC
There's a special case in usr.bin/clang/llvm.prog.mk for the pre-world stages:

# Special case for the bootstrap-tools phase.
.if (defined(TOOLS_PREFIX) || ${MACHINE} == "host") && \
    (${PROG_CXX} == "clang-tblgen" || ${PROG_CXX} == "llvm-tblgen")
LIBDEPS+=       llvmminimal
.else
LIBDEPS+=       llvm
.endif

E.g. either TOOLS_PREFIX must be defined (as it normally is during all stages before world), or as Bryan added in r305223, for the host build.

I take it something is going wrong in this second case, e.g. TOOLS_PREFIX is likely not defined, while ${MACHINE} is not "host".
Comment 2 Sylvain Garrigues 2017-01-02 07:52:06 UTC
Thank Dimitry.  Do you think it is a native-xtools bug or a poudriere one?
Comment 3 Sylvain Garrigues 2017-01-02 09:03:50 UTC
Also reproduced with ports-mgmt/poudriere in addition to ports-mgmt/poudriere 

So as of today, it seems it is no longer possible to create an armv6 poudriere jail with "-x" (native-xtools)!
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2017-01-02 17:40:26 UTC
Submitted https://reviews.freebsd.org/D9026 for review.
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-01-02 19:33:41 UTC
A commit references this bug:

Author: dim
Date: Mon Jan  2 19:33:23 UTC 2017
New revision: 311131
URL: https://svnweb.freebsd.org/changeset/base/311131

Log:
  Make native-xtools build correctly after clang/llvm 3.9.0 import

  During the clang/llvm 3.9.0 import, the build structure for it was
  completely revamped.  This broke the native-xtools target.

  It first attempts to build libllvmminimal, then the llvm-tblgen and
  clang-tblgen executables, but these fail to link because they are linked
  to the 'full' libllvm by default, as they normally are during the
  'world' stage.

  To make these link against libllvmminimal instead, define TOOLS_PREFIX,
  similarly as during the bootstrap-tools phase.  The value itself is
  empty, as we don't really want to use a prefix.

  Reviewed by:	imp
  PR:		215684
  MFC after:	3 days
  Differential Revision:	https://reviews.freebsd.org/D9026

Changes:
  head/Makefile.inc1
Comment 6 Sylvain Garrigues 2017-01-04 09:21:33 UTC
Problem solved for me with above commit.
Comment 7 commit-hook freebsd_committer freebsd_triage 2017-01-06 22:09:46 UTC
A commit references this bug:

Author: dim
Date: Fri Jan  6 22:09:00 UTC 2017
New revision: 311558
URL: https://svnweb.freebsd.org/changeset/base/311558

Log:
  MFC r311131:

  Make native-xtools build correctly after clang/llvm 3.9.0 import

  During the clang/llvm 3.9.0 import, the build structure for it was
  completely revamped.  This broke the native-xtools target.

  It first attempts to build libllvmminimal, then the llvm-tblgen and
  clang-tblgen executables, but these fail to link because they are linked
  to the 'full' libllvm by default, as they normally are during the
  'world' stage.

  To make these link against libllvmminimal instead, define TOOLS_PREFIX,
  similarly as during the bootstrap-tools phase.  The value itself is
  empty, as we don't really want to use a prefix.

  Reviewed by:	imp
  PR:		215684
  Differential Revision:	https://reviews.freebsd.org/D9026

Changes:
_U  stable/11/
  stable/11/Makefile.inc1