From owner-freebsd-questions@freebsd.org Sat Nov 18 22:56:31 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B78C2DDEBA2 for ; Sat, 18 Nov 2017 22:56:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 79DC880D8D; Sat, 18 Nov 2017 22:56:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 8CEC8CA82; Sat, 18 Nov 2017 22:56:30 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 5EAF89F5D; Sat, 18 Nov 2017 22:56:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id jTJV5dF5Mx36; Sat, 18 Nov 2017 22:56:25 +0000 (UTC) Subject: Re: using native-xtools's make and MACHINE, MACHINE_ARCH values DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 43C9B9F58 To: Guy Yur Cc: freebsd-questions@freebsd.org References: <9961305b-1b1e-8de0-8df8-94bc427cbbee@FreeBSD.org> From: Bryan Drewery Organization: FreeBSD Message-ID: <04a972e9-16b7-7751-dbee-4af0a598d84b@FreeBSD.org> Date: Sat, 18 Nov 2017 14:56:15 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KTjQ9dpunS9e5KXEsDPfPo8qsBLv6xOvR" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Nov 2017 22:56:31 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KTjQ9dpunS9e5KXEsDPfPo8qsBLv6xOvR Content-Type: multipart/mixed; boundary="GwlVgmTma4PLoxVqof5FjSG7hWAI0wXFQ"; protected-headers="v1" From: Bryan Drewery To: Guy Yur Cc: freebsd-questions@freebsd.org Message-ID: <04a972e9-16b7-7751-dbee-4af0a598d84b@FreeBSD.org> Subject: Re: using native-xtools's make and MACHINE, MACHINE_ARCH values References: <9961305b-1b1e-8de0-8df8-94bc427cbbee@FreeBSD.org> In-Reply-To: --GwlVgmTma4PLoxVqof5FjSG7hWAI0wXFQ Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 11/18/17 2:52 PM, Guy Yur wrote: > Hi, >=20 > On 18 November 2017 at 23:44, Bryan Drewery wrot= e: >> On 11/18/17 7:26 AM, Guy Yur wrote: >>> Hi, >>> >>> I am trying to use native-xtools's make (amd64 targeting armv7) >>> on an amd64 host in an armv7 chroot. >> >> My guess is that it's because you're using a chroot rather than a jail= =2E >> When poudriere creates the jail with 'jail -c' it does not do things >> like setup the make.conf or even setup nxb-bin hardlinks. It only doe= s >> this stuff at Jail Startup time (bulk/testport/jail -s). >> Checkout jail -s and jail -k rather than using a chroot. >> >> >>> (qemu-arm-static and binmiscctl used for the arm binaries.) >>> Running /nxb-bin/usr/bin/make -V MACHINE and -V MACHINE_ARCH it >>> reports amd64, amd64 not arm, armv7. >>> (12.0-CURRENT r325963) >>> >>> Do I need to override MACHINE and MACHINE_ARCH explicitly when >>> running nxb's make or should it report the target values? >>> >>> bmake is compiled with -DMAKE_NATIVE in usr.bin/bmake/Makefile >>> so it uses uname, sysctl to get the values. >>> If I add -UMAKE_NATIVE -DMAKE_MACHINE=3D\"${MACHINE}\" >>> -DMACHINE_ARCH=3D\"${MACHINE_ARCH}\" to the nxb's make >>> compilation it reports arm and armv7. >>> Turning off MAKE_NATIVE also affects other things so it is >>> probably not be the correct change to make. >>> >> >> >> Poudriere sets MACHINE and MACHINE_ARCH in /etc/make.conf. It seems o= k >> to me in a Jail. >> >>> # grep MACHINE /etc/make.conf >>> MACHINE=3Darm64 >>> MACHINE_ARCH=3Daarch64 >>> # /nxb-bin/usr/bin/make -V MACHINE -V MACHINE_ARCH >>> arm64 >>> aarch64 >> >> If I change it to something else it takes the value. >> >>> # grep MACHINE /etc/make.conf >>> MACHINE=3Dmachine >>> MACHINE_ARCH=3Dmachine_arch >>> # /nxb-bin/usr/bin/make -V MACHINE -V MACHINE_ARCH >>> machine >>> machine_arch >> >> As for chroot it's wrong: >> >>> # /nxb-bin/usr/bin/make -V MACHINE -V MACHINE_ARCH >>> amd64 >>> amd64 >> >=20 > If I set them in /etc/make.conf it works in a chroot as well. >=20 > But shouldn't a crosstool make have the MACHINE and MACHINE_ARCH > of the target regardless of where it is running? Not expected to, no. Perhaps it makes sense but there's no reason for it right now. > clang built by native-xtools has Target set to the target arch. >=20 > I can try to prepare and try to upstream a patch for an option > to compile bmake for cross-compilation of same os version but > different archs if it will be useful. >=20 >> >> It's not using uname as far as I can tell. The /etc/make.conf is setu= p >> at Jail Startup time but the jail's /etc/login.conf is setup at 'jail >> -c' time currently, which sets UNAME_m and UNAME_p so uname should be >> fine anyway: >> >> >>> # grep arm /etc/login.conf >>> :setenv=3DMAIL=3D/var/mail/$,BLOCKSIZE=3DK,UNAME_r=3D12.0-CUR= RENT,UNAME_v=3DFreeBSD 12.0-CURRENT 1200051,OSVERSION=3D1200051,ABI_FILE=3D= /usr/lib/crt1.o,UNAME_m=3Darm64,UNAME_p=3Daarch64:\ >> >=20 > make uses uname(3) for MACHINE and I see UNAME_m affects it. > For MACHINE_ARCH it uses HW_MACHINE_ARCH sysctl(3) > which isn't effected by UNAME_p. > Of course, MACHINE/MACHINE_ARCH can be overriden in > /etc/make.conf after the initial value is set by uname/sysctl. > > So I guess I will have to set MACHINE and MACHINE_ARCH > explicitly in make.conf like Poudriere. Sorry I missed that you were not using Poudriere. What's the use case her= e? >=20 > Thanks, > Guy >=20 >> >> -- >> Regards, >> Bryan Drewery >> --=20 Regards, Bryan Drewery --GwlVgmTma4PLoxVqof5FjSG7hWAI0wXFQ-- --KTjQ9dpunS9e5KXEsDPfPo8qsBLv6xOvR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEzBAEBCgAdFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAloQupEACgkQNddxu25G l8/aaAf+KA6W9ENLaqZIiCN5LsOE+BTHXiENKAutlNx3cN6Ivhcq+mNtLZWgIt3y NjPKyLISOgQH0470XMSHvGMhZNc+V7hsUYFr5JN87HyzfTCYiXlvj19rJeVvmiza pd0+UtjRDkOEQKW/+WjctW80L6gD1fG8TUv9kJaqzESG4XeZP5YcTKGhyGkqNUcu 9UM/IPnfIv8cjq0nXMnJEjArDZyYQ+XArCD0yvTEElnjhBlWM/lxkAaWu9i8GieV UrwLQy5haatAC1pt6+BG6PD0C3JnpO868evP4UZPiicRK11JE0YX1Lmt0Xiov6aZ XetUILiMWlyTGmdZ7zvgVk4ZCZi4Wg== =cXmN -----END PGP SIGNATURE----- --KTjQ9dpunS9e5KXEsDPfPo8qsBLv6xOvR--