Resurrecting clang external toolchain support in Makefile.inc

Peter Grehan grehan at freebsd.org
Wed Feb 11 02:32:40 UTC 2015


Hi toolchain folk,

  I've recently tried using the base system clang as an external 
toolchain i.e.

    make CROSS_COMPILER_PREFIX=/usr/bin/ buildworld

  .. and found that this no longer works after r273755 which split 
XFLAGS into XC/XCXXFLAGS. This appears to be because the XFLAGS 
definitions that define --sysroot and -B options aren't being passed 
through to clang, resulting in using header files from the host system.

  My quick hack was

--- Makefile.inc1	(revision 278542)
+++ Makefile.inc1	(working copy)
@@ -374,6 +374,8 @@
  TARGET_ABI?=	unknown
  TARGET_TRIPLE?=	${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
  XCFLAGS+=	-target ${TARGET_TRIPLE}
+XCFLAGS+=	${XFLAGS}
+XCXXFLAGS+=	${XFLAGS}
  .endif
  .endif

  However, this doesn't look to be the right way to fix this.

  Any opinions on a proper fix ?

later,

Peter.


More information about the freebsd-toolchain mailing list