Jump to content
funtoo forums
  • 0
fralalonde

Raspberry 3 64bit Crossdev?

Question

I'm trying to setup crossdev for Aarch64 Raspberry Pi3 cross-compilation on my x64 Funtoo PC as described here.

While crossdev itself emerged ok, entering

sudo crossdev --stable -t aarch64-unknown-linux-gnu

fails after a few seconds with a rather laconic

 * error: binutils failed :(

I looked into filing a bug, as it seems this should be stable now, the closest entry dating back from 2015 but I wanted to check first if anybody had this working currently.

I've attached the files I have, as recommended by the full command output:

 * crossdev version:      20180410
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   arm64
 * Target System:         aarch64-unknown-linux-gnu
 * Stage:                 4 (C/C++ compiler)
 * USE=multilib:          no
 * ABIs:                  arm64

 * binutils:              binutils-[stable]
 * gcc:                   gcc-[stable]
 * headers:               linux-headers-[stable]
 * libc:                  glibc-[stable]

 * CROSSDEV_OVERLAY:      /usr/local/portage-crossdev
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:    /
 * Portage flags:         
                                                                                                                                                               
 * leaving sys-devel/binutils in /usr/local/portage-crossdev
 * leaving sys-devel/gcc in /usr/local/portage-crossdev
 * leaving sys-kernel/linux-headers in /usr/local/portage-crossdev
 * leaving sys-libs/glibc in /usr/local/portage-crossdev
 * leaving sys-devel/gdb in /usr/local/portage-crossdev
 * leaving metadata/layout.conf alone in /usr/local/portage-crossdev
                                                                                                                                                               
 * Log: /var/log/portage/cross-aarch64-unknown-linux-gnu-binutils.log
 * Emerging cross-binutils ...

 * error: binutils failed :(
 *
 * If you file a bug, please attach the following logfiles:
 * /var/log/portage/cross-aarch64-unknown-linux-gnu-info.log
 * /var/log/portage/cross-aarch64-unknown-linux-gnu-binutils.log.xz
 * /var/tmp/portage/cross-aarch64-unknown-linux-gnu/binutils*/temp/binutils-config.logs.tar.xz

 

cross-aarch64-unknown-linux-gnu-binutils.log.xz

cross-aarch64-unknown-linux-gnu-info.log

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 1

I've been using crossdev for various devices on Funtoo very successfully for years now.  There are differences from gentoo, only general gentoo instructions apply.

1st, a must read is this: https://www.funtoo.org/Cross-compiling_with_Crossdev.  Then you will understand that the Funtoo gcc ebuilds do not work out of the box with crossdev at all.  I have created ebuilds that seamlessly replace the official tree gcc ebuilds and at the same time also work with crossdev, see this: https://bugs.funtoo.org/browse/FL-3787 .   I recommend using these ebuilds in your local PORTDIR, removing the _rc1 part of the name, allowing them to supersede the official ebuilds.  This will cause you to have to rebuild the native gcc because I have additional use flags for arm support (in a crossdev gcc implementation) that don't exist on the official tree ebuild.  Alternately you can just leave the _rc1 in the name and just call it directly on the crossdev command line, I found it too confusing to have all those versions floating around when it works just fine as a replacement.  Your choice...

In addition to the informational links above, I must tell you that I have had no success with any crossdev version beyond 20151026-r1, due to growing portage differences between gentoo and funtoo.  Hmm, probably something from around that time here will do: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/crossdev/

I would be leery about using --stable also, I prefer to specifically call out the versions I want to match exactly the device I am building for, rather than counting on crossdev to make the right decisions for me.  It didn't work well for me in the past, although I haven't tried it in a long time.

When you successfully create your shiny new toolchain there is very pertinent info here also: https://wiki.gentoo.org/wiki/Distcc/Cross-Compiling

Share this post


Link to post
Share on other sites
  • 0

Ha, thanks!  This answers many of my questions. To be honest, using an overlay and custom ebuild is more involved than I wanted to go, specially knowing that  I will be stuck with an older crossdev anyway. Before going that route, I will try using a Gentoo docker image dedicated to distcc and / or usermode QEMU chroot env (https://github.com/sakaki-/gentoo-on-rpi3-64bit/wiki/Build-aarch64-Packages-on-your-PC%2C-with-User-Mode-QEMU-and-binfmt_misc ).

I will report my findings here so that if others follow the same route they can benefit from our shared experience.

Share this post


Link to post
Share on other sites
  • 0

The version of crossdev is of no consequence as long as it works, it's just a shell script.

While qemu has value, it's _much too slow for general use.

The docker idea sounds good, except it might be a hassle if you are using it for distcc, I don't know, never do docker.

Setting up a local overlay is quite simple and almost surely you are going to do it sooner or later anyhow.  I believe crossdev itself requires it, I don't know what it would use for an overlay (and it does need an overlay) without it..  The "custom ebuilds" are already done so I don't see an issue there.

5 or 10 minutes to set up your local overlay, drop the gcc build you want in there, then:

crossdev <OPTIONS> --init-target 

Then change the gcc link in the crossdev overlay as shown in my 1st link.  Pretty quick and painless.

Then:

crossdev <OPTIONS>

again.  Come back in a couple of hours.

If you run this cool bash script on your $TARGET machine, it will even create the crossdev line for you:

#! /bin/bash
A="binutils" ; B=`eselect $A show` ; BINUTILS_VER=`echo $B | cut -d- -f5-` 
A=`/usr/bin/gcc-config -c` ; B=`echo $A | cut -d- -f5` ; GCC_VER=`equery l sys-devel/gcc | grep $B | cut -d- -f3-`
A="sys-kernel/linux-headers" ; B=`equery l $A` ; KERNEL_VER=`echo $B | cut -d- -f4-`
A="sys-libs/glibc" ; B=`equery l $A` ; LIBC_VER=`echo $B | cut -d- -f3-`
echo "crossdev --b =$BINUTILS_VER --g =$GCC_VER --k =$KERNEL_VER --l =$LIBC_VER -t $(portageq envvar CHOST)"

Source: https://wiki.gentoo.org/wiki/Distcc/Cross-Compiling

Here is crossdev-20151026-r1.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...