From owner-svn-ports-head@freebsd.org Fri Mar 30 18:40:41 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30B76F55AF4; Fri, 30 Mar 2018 18:40:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D46C37659B; Fri, 30 Mar 2018 18:40:40 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id A1F8E10A87D; Fri, 30 Mar 2018 14:40:33 -0400 (EDT) From: John Baldwin To: Kyle Evans Cc: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: Re: svn commit: r465416 - in head/devel: aarch64-gcc amd64-gcc mips-gcc mips64-gcc powerpc64-gcc sparc64-gcc Date: Fri, 30 Mar 2018 11:40:21 -0700 Message-ID: <22752830.FZXTHng1bN@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201803232353.w2NNrqnJ028176@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 30 Mar 2018 14:40:33 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Mar 2018 18:40:41 -0000 On Friday, March 30, 2018 11:12:28 AM Kyle Evans wrote: > On Fri, Mar 23, 2018 at 6:53 PM, John Baldwin wrote: > > Author: jhb (src,doc committer) > > Date: Fri Mar 23 23:53:52 2018 > > New Revision: 465416 > > URL: https://svnweb.freebsd.org/changeset/ports/465416 > > > > Log: > > Fix --sysroot for cross-toolchain GCC packages > > > > By default, GCC assumes that a cross compiler should not have any valid > > initial include or library paths aside from /usr/local/lib/gcc//. > > This means that one cannot use --sysroot to point to a system root for > > another architecture and have GCC automatically look for headers in > > ${sysroot}/usr/include, etc. Currently we workaround this in FreeBSD's > > build system with explicit -isystem, -B, and -L directives. However, > > this is cumbersome compared to clang (where a bare --sysroot DTRT) > > especially when using the compiler to build other software (such as test > > programs, etc.). > > > > One can override GCC's assumption and force it to assume that it should > > honor --sysroot by setting the '--with-sysroot' option to force GCC to > > assume a specific system root. By setting this to '/', this means that > > the cross-compiler will attempt to use the host's headers by default > > if --sysroot is not specified, but if --sysroot is specified then > > it is fully honored including for include paths and library paths. With > > this change I can now cross-compile both C and C++ binaries simply by > > using --sysroot without the need for -isystem, -B, or -L directives. Note > > that the base/gcc and devel/riscv64-gcc ports both use --with-sysroot='/' > > already. > > > > By default, GCC looks for headers in /usr/local/include (under the > > sysroot) before /usr/include. To disable this and only look for headers > > in /usr/include, patch gcc/Makefile.in to not define LOCAL_INCLUDE_DIR. > > > > Once -nostdinc is no longer required, the headers installed along with the > > compiler are now used for compiling worlds and test programs. The "fixed" > > headers in include-fixed are generally not helpful and are also derived > > from the host's headers which might not match the target --sysroot, so > > just delete them entirely. Even the stub limits.h headers GCC ships when > > using an empty build sysroot are not helpful and need to be removed. > > > > On a related note, I also fixed the name of the C++ include directory > > option to configure. By my reading it is 'with-gxx-include-dir' rather > > than 'with-gcc-include-dir'. > > > > Reviewed by: bapt, brooks, kan > > Sponsored by: DARPA / AFRL > > Differential Revision: https://reviews.freebsd.org/D14627 > > > > Modified: > > head/devel/aarch64-gcc/pkg-plist > > head/devel/amd64-gcc/pkg-plist > > head/devel/mips-gcc/pkg-plist > > head/devel/mips64-gcc/pkg-plist > > head/devel/powerpc64-gcc/Makefile > > head/devel/powerpc64-gcc/pkg-plist > > head/devel/sparc64-gcc/pkg-plist > > > > Hey John, > > Documentation is eluding me here- what was --with-sysroot before? For > other applications, is there a way to force the old behavior while > invoking gcc? > > This appears to have caused arm-none-eabi-newlib to fail to build [1], > I guess because it's pulling in a different (our limits.h?) > without some LONG_LONG_MAX definitions that it needs. I can patch it > to use LLONG_ instead of LONG_LONG_, but I have mixed feelings about > compiling it in this new world order rather than the old world order > that it's been tested in and expects. So it may be that the arm compilers that aren't actually targeting FreeBSD for xtoolchain purposes should keep include-fixed. (I was surprised they are using powerpc64-gcc as a master port actually). That would let you use the old limits.h. I'm currently testing a different fix for amd64-gcc, so I already have a patch to powerpc64-gcc, but I will work on this next. Basically, we need to revert the pkg-plist changes for the two arm ports that kan@ fixed earlier and then change powerpc64-gcc/Makefile to not remove include-fixed for these two ports. devel/binutils already has a similar check based on checking PKGNAMEPREFIX to handle the two arm ports differently here: .if ${PKGNAMEPREFIX:M*-*-} BUTARGET?= ${PKGNAMEPREFIX}${OPSYS:tl}${OSREL} .else BUTARGET?= ${PKGNAMEPREFIX}unknown-${OPSYS:tl}${OSREL} .endif We basically need to invert that condition and then put that around the ${RM} of include-fixed in powerpc64-gcc/Makefile. -- John Baldwin