Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Apr 2016 22:22:36 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        Warner Losh <imp@bsdimp.com>
Cc:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: 11.0: head/lib/libsysdecode/Makefile for . . ./libsoft/usr/include uses CPP when XCPP needed?
Message-ID:  <B222BAE7-FD73-4F54-8C31-E982B6FCA718@dsl-only.net>
In-Reply-To: <CANCZdfo3Gdf0QF64hfn_WJzxhPOwJk6yMB3qEkDi8tfEpRRveg@mail.gmail.com>
References:  <D8803949-18C1-4B17-981F-DAD5A2DEDCE8@dsl-only.net> <CANCZdfo3Gdf0QF64hfn_WJzxhPOwJk6yMB3qEkDi8tfEpRRveg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2016-Apr-3, at 9:48 PM, Warner Losh <imp bsdimp.com> wrote:
>=20
> On Sun, Apr 3, 2016 at 10:25 PM, Mark Millard <markmi dsl-only.net> =
wrote:
> For an amd64 -> armv7a (rpi2 targeting) cross-compile the code
>=20
> > # $FreeBSD: head/lib/libsysdecode/Makefile 295931 2016-02-23 =
20:00:55Z jhb $
> >
> > . . .
> > ioctl.c: mkioctls
> >         env MACHINE=3D${MACHINE} CPP=3D"${CPP}" \
> >                 /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} =
> ${.TARGET}
>=20
> (with its use of CPP instead of the XCPP) got:
>=20
> > --- all_subdir_lib/libsysdecode ---
> > --- ioctl.c ---
> > env MACHINE=3Darm CPP=3D"/usr/bin/clang-cpp"  /bin/sh =
/usr/src/lib/libsysdecode/mkioctls =
/usr/obj/clang/arm.armv6/usr/src/libsoft/usr/include > ioctl.c
> > . . .
> > --- all_subdir_lib/libsysdecode ---
> > In file included from <stdin>:17:
> > In file included from =
/usr/obj/clang/arm.armv6/usr/src/libsoft/usr/include/dev/nvme/nvme.h:36:
> > In file included from =
/usr/obj/clang/arm.armv6/usr/src/libsoft/usr/include/sys/param.h:135:
> > In file included from =
/usr/obj/clang/arm.armv6/usr/src/libsoft/usr/include/machine/param.h:49:
> > =
/usr/obj/clang/arm.armv6/usr/src/libsoft/usr/include/machine/acle-compat.h=
:182:4: error: Unable to determine architecture version.
> > #  error Unable to determine architecture version.
> >    ^
>=20
> In my case I had the following in the in-use src.conf in order to =
control the cross compile specifics:
>=20
> > XCC=3D/usr/bin/clang -target ${TO_TYPE}--freebsd11.0-gnueabi =
-march=3Darmv7a -mcpu=3Dcortex-a7 -mno-unaligned-access
> > XCXX=3D/usr/bin/clang++ -target ${TO_TYPE}--freebsd11.0-gnueabi =
-march=3Darmv7a -mcpu=3Dcortex-a7 -mno-unaligned-access
> > XCPP=3D/usr/bin/clang-cpp -target ${TO_TYPE}--freebsd11.0-gnueabi =
-march=3Darmv7a -mcpu=3Dcortex-a7 -mno-unaligned-access
>=20
>=20
> (I've been doing such for a long time but only just progressed to a =
11.0 source vintage with libsoft involved.)
>=20
> Even if I'm out of bounds for technique in some way I expect that
>=20
> > ioctl.c: mkioctls
> >         env MACHINE=3D${MACHINE} CPP=3D"${CPP}" \
> >                 /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} =
> ${.TARGET}
>=20
> is not doing everything it should to have the full context needed for =
. . ./machine/acle-compat.h .
>=20
> It's gotta be upstream. XCPP XCC and XCXX are all exclusive to =
Makefile.inc1. It's up to it to sort out the
> rest...  And none of the X{AR,AS,LD,etc} are defined, so there's bound =
to be an impedance mismatch. :)
> In the past when I've seen this it's been due to some kind of variable =
contamination, perhaps one that's
> not otherwise known...
>=20
> Warner

For reference the src.conf used for amd64 -> arm is:

> KERNCONF=3DRPI2-NODBG
> TARGET=3Darm
> .if ${.MAKE.LEVEL} =3D=3D 0
> TARGET_ARCH=3Darmv6
> .export TARGET_ARCH
> .endif
> #
> WITH_LIBSOFT=3D
> WITH_FAST_DEPEND=3D
> WITH_LIBCPLUSPLUS=3D
> WITH_BINUTILS_BOOTSTRAP=3D
> WITH_CLANG=3D
> WITH_CLANG_IS_CC=3D
> WITH_CLANG_FULL=3D
> WITH_LLDB=3D
> WITH_CLANG_EXTRAS=3D
> WITH_BOOT=3D
> #
> WITHOUT_LIB32=3D
> WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=3D
> WITHOUT_CLANG_BOOTSTRAP=3D
> WITHOUT_GCC_BOOTSTRAP=3D
> WITHOUT_GCC=3D
> WITHOUT_GNUCXX=3D
> #
> NO_WERROR=3D
> MALLOC_PRODUCTION=3D
> #
> WITH_DEBUG_FILES=3D
> #
> .if ${.MAKE.LEVEL} =3D=3D 0
> XCC=3D/usr/bin/clang -target ${TARGET_ARCH}--freebsd11.0-gnueabi =
-march=3Darmv7a -mcpu=3Dcortex-a7 -mno-unaligned-access
> XCXX=3D/usr/bin/clang++ -target ${TARGET_ARCH}--freebsd11.0-gnueabi =
-march=3Darmv7a -mcpu=3Dcortex-a7 -mno-unaligned-access
> XCPP=3D/usr/bin/clang-cpp -target ${TARGET_ARCH}--freebsd11.0-gnueabi =
-march=3Darmv7a -mcpu=3Dcortex-a7 -mno-unaligned-access
> .export XCC
> .export XCXX
> .export XCPP
> .endif
> #
> .if ${.MAKE.LEVEL} =3D=3D 0
> CC=3D/usr/bin/clang
> CXX=3D/usr/bin/clang++
> CPP=3D/usr/bin/clang-cpp
> .export CC
> .export CXX
> .export CPP
> .endif


=3D=3D=3D
Mark Millard
markmi at dsl-only.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B222BAE7-FD73-4F54-8C31-E982B6FCA718>