Cross-Compiling RPi Ports From amd64 Using Native Toolchain
Tur-Wei Chan
twchan at singnet.com.sg
Sat Jan 3 03:58:21 UTC 2015
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 <chroot_root>/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 <chroot_root>/usr/obj - reason seems to be
that some gcc spec file paths are hardcoded into the utils themselves.
Regards
-T.W.Chan-
More information about the freebsd-arm
mailing list