Bug 206484 - powerpc (non-64) -r294201: /usr/src/Makefile.inc1 can try -target on gcc 4.2.1's cpp command lines but it is rejected by cpp
Summary: powerpc (non-64) -r294201: /usr/src/Makefile.inc1 can try -target on gcc 4.2....
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: powerpc Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-22 07:08 UTC by Mark Millard
Modified: 2016-01-22 07:08 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Millard 2016-01-22 07:08:03 UTC
[powerpc (non-64) context, so gcc 4.2.1, not clang]

When attempting to buildworld using WITHOUT_GCC_BOOTRAP= for 11.0-CURRENT -r294201 (a rebuild of what was already running but with debug files turned on) I got:

--- key_prot.h ---
RPCGEN_CPP=cpp\ -target\ powerpc-unknown-freebsd11.0\ --sysroot=/usr/obj/gcc421/powerpc.powerpc/usr/src/tmp\ -B/usr/obj/gcc421/powerpc.powerpc/usr/src/tmp/usr/bin rpcgen -C -h -DWANT_NFS3 /usr/src/inc
lude/rpcsvc/key_prot.x -o key_prot.h
cpp: powerpc-unknown-freebsd11.0: No such file or directory
cpp: warning: '-x c' after last input file has no effect
cpp: unrecognized option '-target'
cpp: No input files specified
--- includes_subdir_gnu ---
--- includes_subdir_libregex ---
--- includes_subdir_include ---
*** [key_prot.h] Error code 1

make[4]: stopped in /usr/src/include/rpcsvc
--- includes_subdir_lib ---
--- includes_subdir_libelf ---
--- includes_subdir_include ---
1 error


This results from 4.2.1 gcc's cpp not accepting -target and the following in /usr/src/Makefile.inc1 :
(XCC, XCXX, and XCPP were initially undefined)

XCOMPILERS=     CC CXX CPP
.for COMPILER in ${XCOMPILERS}
.if defined(CROSS_COMPILER_PREFIX)
X${COMPILER}?=  ${CROSS_COMPILER_PREFIX}${${COMPILER}}
.else
X${COMPILER}?=  ${${COMPILER}}
.endif
.endfor
. . .
CROSSENV+=      CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
                DEPFLAGS="${DEPFLAGS}" \
                CPP="${XCPP} ${XCFLAGS}" \
. . .
.if ${XCC:N${CCACHE_BIN}:M/*}
. . .
.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
. . .
.else
TARGET_ABI?=    unknown
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
XCFLAGS+=       -target ${TARGET_TRIPLE}
.endif
. . .
.else
. . .
.endif # ${XCC:M/*}

The assumption in the CROSSENV+= that ${XCFLAGS} is always valid in its content for use with ${XCPP} is false, unfortunately. Other XCFLAGS material from src.conf or make.conf could create similar problems.

Using WITH_GCC_BOOTSTRAP= instead for the buildworld avoids this issue so long as my src.conf and make.conf do not set XCFLAGS to something that creates another problem.