From owner-freebsd-questions@freebsd.org Sat Nov 18 22:52:52 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 094EDDDE934 for ; Sat, 18 Nov 2017 22:52:52 +0000 (UTC) (envelope-from guyyur@gmail.com) Received: from mail-wr0-x22b.google.com (mail-wr0-x22b.google.com [IPv6:2a00:1450:400c:c0c::22b]) (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 9336C80A31; Sat, 18 Nov 2017 22:52:51 +0000 (UTC) (envelope-from guyyur@gmail.com) Received: by mail-wr0-x22b.google.com with SMTP id u98so4978443wrb.13; Sat, 18 Nov 2017 14:52:51 -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=hdJT8+kerTukxZSr5S6vKwFjnQGRzwCr1EXgSPh7JIw=; b=hUiqGDKhPFA1NGfxX4MjQqOFhPe0BMs+UAVdv+z1uGyADH5SD3WgjyzAnjeBOwfIMP WH3YhpB3C4DUxMjQlXFUwkKTTf5dGvs6FK9LzVjpVxnZlKkeMm3s0r3BARmmv4YV4lmK BQZ3I6MHW5w5IP+jUjHu7NnX/jS17Y3vMxEZMaXY8j3zChPEsyaLJDch2JKHkVftWLcL x81+dztub/5scQtVn3it8J44n2/DbgQlgiNDD3AK/5EILbm0+JrXhgTkIA6vnqNDScs0 BC/sL4a71ho/6f/yS5ZmdiO1A6nuNTNdn4lOcz/QGF3KFWQFIXDLjmkax5Nk58Wf0pCC a9BQ== 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=hdJT8+kerTukxZSr5S6vKwFjnQGRzwCr1EXgSPh7JIw=; b=kB9HPCx/34X0wFu+2CmAgnZF2ri7YhxT4V9GRWGy7/yULUs3Yo/mGgPu5voSB9rRTo vz62wK/zZv5ef71Plw8AAbNJ49j/8mDyvTMDqSmOOcrJtjFOMkuU35/zkyfIldcTRgNC y70aeRX3p2IrdtYjeV4usSqw8fmLIL8dvnyuBtlBEyam9x2q6LrcVChqI/BYVuAoug8m Pxy+bHJ0nGj++TWdX8Etd+oPqZPdInr8xoJBiLZDGd7gcMMn3cx9QWOTdPXJgwRZaHSs NoRZ/bB1D2iV7RtVF37HZk9o27SE1B7n0ctbxqLoLmUPIwqsyYVqlRYFZ6Bx0s3dN/Yo SWeQ== X-Gm-Message-State: AJaThX6LirRZ+jbnMLVrl1hLdbZ/aUeowWHts4AMVtJT/pIQfMcyT16W UYn3VW45Q5sRazYTlbicqsaCZGwPY7VzOE87ASTRVQ== X-Google-Smtp-Source: AGs4zMYpl6HbvoGgQ4TZ0xp5hSdiIIljMyPdd55DVdNX3k+YqBFuXv5fwPSLubqp8ZC1gK2VX0YitmlULq3j0ICOWj8= X-Received: by 10.223.176.8 with SMTP id f8mr8199562wra.80.1511045569389; Sat, 18 Nov 2017 14:52:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.197.67 with HTTP; Sat, 18 Nov 2017 14:52:48 -0800 (PST) In-Reply-To: <9961305b-1b1e-8de0-8df8-94bc427cbbee@FreeBSD.org> References: <9961305b-1b1e-8de0-8df8-94bc427cbbee@FreeBSD.org> From: Guy Yur Date: Sun, 19 Nov 2017 00:52:48 +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: Sat, 18 Nov 2017 22:52:52 -0000 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? 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. Thanks, Guy > > -- > Regards, > Bryan Drewery >