From owner-svn-ports-all@freebsd.org Fri Mar 23 23:53:53 2018 Return-Path: Delivered-To: svn-ports-all@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 6B02DF57847; Fri, 23 Mar 2018 23:53:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D43B6BE83; Fri, 23 Mar 2018 23:53:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 180E826DC8; Fri, 23 Mar 2018 23:53:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NNrqPg028183; Fri, 23 Mar 2018 23:53:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NNrqnJ028176; Fri, 23 Mar 2018 23:53:52 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803232353.w2NNrqnJ028176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Mar 2018 23:53:52 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r465416 - in head/devel: aarch64-gcc amd64-gcc mips-gcc mips64-gcc powerpc64-gcc sparc64-gcc X-SVN-Group: ports-head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/devel: aarch64-gcc amd64-gcc mips-gcc mips64-gcc powerpc64-gcc sparc64-gcc X-SVN-Commit-Revision: 465416 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 23:53:53 -0000 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 Modified: head/devel/aarch64-gcc/pkg-plist ============================================================================== --- head/devel/aarch64-gcc/pkg-plist Fri Mar 23 23:34:14 2018 (r465415) +++ head/devel/aarch64-gcc/pkg-plist Fri Mar 23 23:53:52 2018 (r465416) @@ -8,9 +8,6 @@ bin/%%GCC_TARGET%%-gcc-nm bin/%%GCC_TARGET%%-gcc-ranlib bin/%%GCC_TARGET%%-gcov bin/%%GCC_TARGET%%-gcov-tool -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/README -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/limits.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/syslimits.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/arm_acle.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/arm_neon.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/float.h Modified: head/devel/amd64-gcc/pkg-plist ============================================================================== --- head/devel/amd64-gcc/pkg-plist Fri Mar 23 23:34:14 2018 (r465415) +++ head/devel/amd64-gcc/pkg-plist Fri Mar 23 23:53:52 2018 (r465416) @@ -8,21 +8,6 @@ bin/%%GCC_TARGET%%-gcc-nm bin/%%GCC_TARGET%%-gcc-ranlib bin/%%GCC_TARGET%%-gcov bin/%%GCC_TARGET%%-gcov-tool -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/README -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/limits.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/netinet/ip_fil.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/netinet/ip_lookup.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/netinet/ip_nat.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/netinet/ip_proxy.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/netinet/ip_scan.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/netinet/ip_state.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/stddef.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/stdio.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/stdlib.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/sys/types.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/syslimits.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/unistd.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/wchar.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/adxintrin.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/ammintrin.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/avx2intrin.h Modified: head/devel/mips-gcc/pkg-plist ============================================================================== --- head/devel/mips-gcc/pkg-plist Fri Mar 23 23:34:14 2018 (r465415) +++ head/devel/mips-gcc/pkg-plist Fri Mar 23 23:53:52 2018 (r465416) @@ -8,9 +8,6 @@ bin/%%GCC_TARGET%%-gcc-nm bin/%%GCC_TARGET%%-gcc-ranlib bin/%%GCC_TARGET%%-gcov bin/%%GCC_TARGET%%-gcov-tool -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/README -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/limits.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/syslimits.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/float.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/iso646.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/loongson.h Modified: head/devel/mips64-gcc/pkg-plist ============================================================================== --- head/devel/mips64-gcc/pkg-plist Fri Mar 23 23:34:14 2018 (r465415) +++ head/devel/mips64-gcc/pkg-plist Fri Mar 23 23:53:52 2018 (r465416) @@ -8,9 +8,6 @@ bin/%%GCC_TARGET%%-gcc-nm bin/%%GCC_TARGET%%-gcc-ranlib bin/%%GCC_TARGET%%-gcov bin/%%GCC_TARGET%%-gcov-tool -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/README -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/limits.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/syslimits.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/float.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/iso646.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/loongson.h Modified: head/devel/powerpc64-gcc/Makefile ============================================================================== --- head/devel/powerpc64-gcc/Makefile Fri Mar 23 23:34:14 2018 (r465415) +++ head/devel/powerpc64-gcc/Makefile Fri Mar 23 23:53:52 2018 (r465416) @@ -2,7 +2,7 @@ PORTNAME= gcc PORTVERSION= 6.3.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= GCC/releases/gcc-${DISTVERSION} PKGNAMEPREFIX?= powerpc64- @@ -48,7 +48,8 @@ CONFIGURE_ARGS+=--target=${GCC_TARGET} --disable-nls - --with-gmp=${LOCALBASE} \ --with-pkgversion="FreeBSD Ports Collection for ${PKGNAMEPREFIX:C/-//g}" \ --with-system-zlib \ - --with-gcc-include-dir=/usr/include/c++/v1/ \ + --with-gxx-include-dir=/usr/include/c++/v1/ \ + --with-sysroot="/" \ --with-as=${LOCALBASE}/bin/${BU_PREFIX}-as \ --with-ld=${LOCALBASE}/bin/${BU_PREFIX}-ld @@ -61,6 +62,8 @@ INSTALL_TARGET?= install-gcc post-patch: @${REINPLACE_CMD} -e '/LIBSTDCXX/ s/stdc\+\+/c\+\+/g ' \ ${WRKSRC}//gcc/cp/g++spec.c + @${REINPLACE_CMD} -e '/LOCAL_INCLUDE_DIR/ d ' \ + ${WRKSRC}//gcc/Makefile.in .if ${TARGETARCH} == "amd64" CONFIGURE_TARGET= x86_64-unknown-${OPSYS:tl}${OSREL} @@ -94,6 +97,7 @@ post-install: .endfor @${RM} ${STAGEDIR}${PREFIX}/info/* @${RM} ${STAGEDIR}${PREFIX}/man/man7/* + @${RM} -r ${STAGEDIR}${PREFIX}/lib/gcc/${GCC_TARGET}/${PORTVERSION}/include-fixed # This port and all its slave ports fail on aarch64 -- but not all # the same way. Provide this definition for the master. Modified: head/devel/powerpc64-gcc/pkg-plist ============================================================================== --- head/devel/powerpc64-gcc/pkg-plist Fri Mar 23 23:34:14 2018 (r465415) +++ head/devel/powerpc64-gcc/pkg-plist Fri Mar 23 23:53:52 2018 (r465416) @@ -8,9 +8,6 @@ bin/%%GCC_TARGET%%-gcc-nm bin/%%GCC_TARGET%%-gcc-ranlib bin/%%GCC_TARGET%%-gcov bin/%%GCC_TARGET%%-gcov-tool -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/README -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/limits.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/syslimits.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/altivec.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/float.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/htmintrin.h Modified: head/devel/sparc64-gcc/pkg-plist ============================================================================== --- head/devel/sparc64-gcc/pkg-plist Fri Mar 23 23:34:14 2018 (r465415) +++ head/devel/sparc64-gcc/pkg-plist Fri Mar 23 23:53:52 2018 (r465416) @@ -8,9 +8,6 @@ bin/%%GCC_TARGET%%-gcc-nm bin/%%GCC_TARGET%%-gcc-ranlib bin/%%GCC_TARGET%%-gcov bin/%%GCC_TARGET%%-gcov-tool -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/README -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/limits.h -lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include-fixed/syslimits.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/float.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/iso646.h lib/gcc/%%GCC_TARGET%%/%%GCC_VERSION%%/include/stdalign.h