From owner-freebsd-questions@freebsd.org Sun Nov 19 19:35:59 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 BAC29DBBDEA for ; Sun, 19 Nov 2017 19:35:59 +0000 (UTC) (envelope-from guyyur@gmail.com) Received: from mail-wr0-x22d.google.com (mail-wr0-x22d.google.com [IPv6:2a00:1450:400c:c0c::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4EF892910; Sun, 19 Nov 2017 19:35:59 +0000 (UTC) (envelope-from guyyur@gmail.com) Received: by mail-wr0-x22d.google.com with SMTP id w95so6270643wrc.2; Sun, 19 Nov 2017 11:35:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=k4dl9LK4pzR2pQLHqexmxQQUzUggpwACO1LqDUyO6h0=; b=Gihn0mqmO+cm6fyOIt0ceDsk+HjQOSYS8Q+sNzJHcvKE3tPGkXKihlqbkHJLN2GOa1 S9/2DYzMbq0BCbVXha9kDtE0UsTZKCeEmHk97Xk7coKiUNtf1hNzTX8cTOKwz1PbfAnb RClT7aaqXV3Mb6UOFrRUZWw1gE21cGmp0r2nuIFxx7J+BD1jw6rCyvUe3pvoJ4Om/k2K PpZu+XqhFEBht7HjA8Rj1eb39LGGzJLWefI0zmFF725ezVTjNr+BbhB0pJ/T5k3r10vN b6/BPwHWM0eZWT7RpoU5LQ5Vwg329RQ1OaQ8ICvSD6Eu5Esp0h01g2SNAFpzAYeix2oU qyYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=k4dl9LK4pzR2pQLHqexmxQQUzUggpwACO1LqDUyO6h0=; b=i7eYdgzhC67cf0MV0rBqnnt21SD3k37msXOR1xng9TDuyuqUXsFlU0cPtx6OUjUcLr Duei5Ki7wCrgPjO8jJo6gA1aPpg7Z5jq6BgQxulOTzsSppoQDg5wKvcDEO7pFbE8ynnb bo924WBxjOrREqzD6HmCnIjW1W36+4YKxbdwDnDEngZJN+64/PhoJZ7Zl/Kdv6M2jcT+ xrph+0pb3ye4rFPopMSNlbGSoR4/Hi23RiIyutrL1LJzAK1eeWnWtxj3GvgSRRtUybWW 2np/n0CtWSArf1kr1O4o0qPg3SXkpztQgNZFPpQjfckQiXNH7L4DyaUGPQmQCk1EEB9v 21tw== X-Gm-Message-State: AJaThX6Boo/jwGHx2zmYOdkCUICeSAXxOLs8L34fd1STMv3yxzmoVLaN jhtViev8epG0zllethIJZdi2qS92Wk9l/4iP8yE= X-Google-Smtp-Source: AGs4zMb0Y4wFv/oB1KMwWuLcVWw58rZLSrIQzs2EmltDwE1MYMhXnMEm/xAdkUT93gN2z1Ks884u97N8Qtl7WZRgPjs= X-Received: by 10.223.178.232 with SMTP id g95mr9117375wrd.53.1511120156811; Sun, 19 Nov 2017 11:35:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.197.67 with HTTP; Sun, 19 Nov 2017 11:35:56 -0800 (PST) In-Reply-To: <04a972e9-16b7-7751-dbee-4af0a598d84b@FreeBSD.org> References: <9961305b-1b1e-8de0-8df8-94bc427cbbee@FreeBSD.org> <04a972e9-16b7-7751-dbee-4af0a598d84b@FreeBSD.org> From: Guy Yur Date: Sun, 19 Nov 2017 21:35:56 +0200 Message-ID: Subject: Re: using native-xtools's make and MACHINE, MACHINE_ARCH values To: Bryan Drewery Cc: freebsd-questions@freebsd.org Content-Type: text/plain; charset="UTF-8" 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: Sun, 19 Nov 2017 19:35:59 -0000 Hi, On 19 November 2017 at 00:56, Bryan Drewery wrote: > On 11/18/17 2:52 PM, Guy Yur wrote: >> Hi, >> >> On 18 November 2017 at 23:44, Bryan Drewery wrote: >>> 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. >>> 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 does >>> 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=\"${MACHINE}\" >>>> -DMACHINE_ARCH=\"${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 ok >>> to me in a Jail. >>> >>>> # grep MACHINE /etc/make.conf >>>> MACHINE=arm64 >>>> MACHINE_ARCH=aarch64 >>>> # /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=machine >>>> MACHINE_ARCH=machine_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 >>> >> >> If I set them in /etc/make.conf it works in a chroot as well. >> >> 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. Ok. Setting them in /etc/make.conf is simple enough. > >> clang built by native-xtools has Target set to the target arch. >> >> 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. >> >>> >>> It's not using uname as far as I can tell. The /etc/make.conf is setup >>> 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=MAIL=/var/mail/$,BLOCKSIZE=K,UNAME_r=12.0-CURRENT,UNAME_v=FreeBSD 12.0-CURRENT 1200051,OSVERSION=1200051,ABI_FILE=/usr/lib/crt1.o,UNAME_m=arm64,UNAME_p=aarch64:\ >>> >> >> 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 here? Building ports. It is just simpler for me right now to use a chroot and build the ports manually and update using portmaster. I keep the chroot and host os version in sync so I am less worried about the host environment affecting the chroot. When flavors hit the tree I will have to reevaluate. Thanks, Guy > >> >> Thanks, >> Guy >> >>> >>> -- >>> Regards, >>> Bryan Drewery >>> > > > -- > Regards, > Bryan Drewery >