From owner-freebsd-arm@FreeBSD.ORG Sat Jan 3 03:58:21 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2769D41C for ; Sat, 3 Jan 2015 03:58:21 +0000 (UTC) Received: from r01.singnet.com.sg (r01.singnet.com.sg [202.40.249.101]) by mx1.freebsd.org (Postfix) with ESMTP id D097224A0 for ; Sat, 3 Jan 2015 03:58:20 +0000 (UTC) Received: from cp-prod-rg-out-1.fuse.kc2.sg.local (172.63.64.222) by r01.singnet.com.sg (8.6.060.30) id 540C6D59008CEE43 for freebsd-arm@freebsd.org; Sat, 3 Jan 2015 11:42:04 +0800 X-CTCH-RefID: str=0001.0A150206.54A7651A.01E5, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown Received: from zaapth.zeepster.org (121.6.2.234) by cp-prod-rg-out-1.fuse.kc2.sg.local (8.6.122.03) id 5432B48308ADDCCC for freebsd-arm@freebsd.org; Sat, 3 Jan 2015 03:42:18 +0000 Received: from zaapedy.zeepster.org ([172.16.38.42]) by zaapth.zeepster.org with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.83 (FreeBSD)) (envelope-from ) id 1Y7FbW-000A42-P9 for freebsd-arm@freebsd.org; Sat, 03 Jan 2015 11:42:18 +0800 Message-ID: <54A7651C.5020701@singnet.com.sg> Date: Sat, 03 Jan 2015 11:42:20 +0800 From: Tur-Wei Chan User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: freebsd-arm@freebsd.org Subject: Re: Cross-Compiling RPi Ports From amd64 Using Native Toolchain References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jan 2015 03:58:21 -0000 Hi, On 3/1/2015 7:06 AM, Jeremy Brown wrote: > I followed the steps crochet made me do, so my setup is a bit > different than what is shown on that page - I used make xdev instead > of make toolchain assuming the commands were equivalent, but if not > please let me know. > > I was left with tools in two places - /usr/armv6-freebsd and > /usr/obj/armv6-freebsd. It seems most of the important elements such > as the compilation tools are in the former location, with only > sourcefiles in the latter. > > I have to copy the tools over into /usr/armv6-freebsd in the chroot > and not /usr/obj because my version of gcc doesn't pick up on other > directories to search, should I just copy > /usr/obj/armv6-freebsd/usr/src/tmp to /usr/armv6-freebsd in the > chroot? > > When I would try to set the environment variables make would never > pick them up - I would try either modifying /root/.profile and use sh > as my shell or modifying /root/.cshrc and using csh as my shell. > Thankfully, the host's PATH would overwrite the PATH in the chroot, so > I could add /usr/armv6-freebsd to my path and make would pick up the > new tools. > > Also, since building the ports is to be scripted, I'm using make from > the host using DESTDIR to set up a chroot, is there some superior way > to do this? > > -Jeremy > >> * I managed to use crochet and the QemuUserModeHowTo to build some > *>* ports for the RPi. What bit me in the process was that the "Cross > *>* Building Using The Host Cross Compiler" section had to be followed > *>* to a T - in particular, the built cross toolchain in > *>* /usr/obj/usr/src/tmp must be moved to /usr/obj > *>* wholesale, the local headers symlink made, and the cross-CC > *>* environment variables set up. The error in #2 above seems to > *>* indicate that the cross tool is not statically linked, so maybe the > *> > * wrong toolchain is in use.* > That was what I tried to do at first, i.e. to use the cross-compiler from the crochet build to run in the chroot. However I found that it didn't work because apparently the armv6-freebsd toolchain is not fully statically linked -- ldd -av /usr/armv6-freebsd/usr/bin/* shows that the utils want /lib/libc.so.7. In the chroot, those libraries are ARM and not native x86/x64 so cpp would fail. I ended up with 2 toolchains - the one at /usr/armv6-freebsd from the initial crochet, and the second xdev-built one at /usr/obj/arm.armv6 which must be copied over to /usr/obj - reason seems to be that some gcc spec file paths are hardcoded into the utils themselves. Regards -T.W.Chan-