Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
I made cross-compilation work on an arbitrary directory.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
crocket
Guru
Guru


Joined: 29 Apr 2017
Posts: 558

PostPosted: Mon Jul 15, 2019 11:18 pm    Post subject: I made cross-compilation work on an arbitrary directory. Reply with quote

I have make.conf-qemu and make.conf-cross in /mnt/data/Backup/rpi3b-plus/etc/portage. Currently, make.conf is a symlink to make.conf-cross.

Code:
--- make.conf-qemu   2019-07-15 21:00:44.503470701 +0900
+++ make.conf-cross   2019-07-15 22:02:12.196585319 +0900
@@ -10,6 +10,9 @@
 # WARNING: Changing your CHOST is not something that should be done lightly.
 # Please consult https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable before changing.
 CHOST="aarch64-unknown-linux-gnu"
+CBUILD="x86_64-pc-linux-gnu"
+HOSTCC=${CBUILD}-gcc
+ROOT=/mnt/data/Backup/rpi3b-plus/
 
 # NOTE: This stage was built with the bindist Use flag enabled
 PORTDIR="/usr/portage"
@@ -20,9 +23,7 @@
 # Please keep this setting intact when reporting bugs.
 LC_MESSAGES=C
 MAKEOPTS="-j8"
-# -pid-sandbox is to work around an issue between qemu and emerge
-# https://bugs.launchpad.net/qemu/+bug/1829459
-FEATURES="distcc -pid-sandbox"
+FEATURES=""
 EGIT_CLONE_TYPE="shallow"
 USE="alsa jpeg2k mp3 opus vorbis flac jack mms"
 PORTAGE_NICENESS=19


I execute

Code:
time sudo env ROOT=/mnt/data/Backup/rpi3b-plus SYSROOT=/mnt/data/Backup/rpi3b-plus aarch64-unknown-linux-gnu-emerge ...


to cross-compile on /mnt/data/Backup/rpi3b-plus. It somehow works. Can anybody explain how make.conf-cross makes it possible? I just copied a few lines from /usr/aarch64-unknown-linux-gnu/etc/portage/make.conf.
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3999

PostPosted: Tue Jul 16, 2019 1:22 pm    Post subject: Reply with quote

Maybe
Code:
FEATURES="$FEATURES ..."
might improve a bit, as there seems no obvious reason to cancel all other features, but only to change a few.
This syntax being applied here in aliases, e.g.
Code:
alias nodistcc='FEATURES="$FEATURES -distcc -distcc-pump"'
using it as:
Code:
nodistcc emerge <a_package>

My apologizes for not answering to your question.

Thks 4 ur attention.
Back to top
View user's profile Send private message
axl
Veteran
Veteran


Joined: 11 Oct 2002
Posts: 1146
Location: Romania

PostPosted: Tue Jul 16, 2019 7:38 pm    Post subject: i just use stuff like this. Reply with quote

Code:
[root@magdalina:~]# ssh pid
Tue Jul 16 - 22:30:06
[root@pid:~]# head /etc/make.conf
CHOST=armv7a-hardfloat-linux-gnueabi

# CHOST=armv7a-hardfloat-linux-gnueabi CBUILD=x86_64-pc-linux-gnu HOSTCC=${CBUILD}-gcc ROOT=/mnt/armv7a/ SYSROOT=${ROOT} PKG_CONFIG_PATH="${ROOT}/usr/lib/pkgconfig/" PORTAGE_TMPFS="/ramfs"  PORTAGE_TMPDIR="/ramfs" MAKEOPTS="-j16" CCACHE_DIR="/var/lib/ccache/"
# CBUILD=x86_64-pc-linux-gnu
# HOSTCC=${CBUILD}-gcc
# ROOT=/mnt/armv7a/
# SYSROOT=${ROOT}
# PKG_CONFIG_PATH="${ROOT}/usr/lib/pkgconfig/"
# PORTAGE_TMPFS="/ramfs"
# PORTAGE_TMPDIR="/ramfs"



You do not need to stain your /usr/$CHOST. you simply start by running crossdev $CHOST. and then you got the toolchain (gcc+glibc+binutils).

BUT. you can at any moment just mount -t nfs4 $host:/ /usr/$CHOST and with a header like that in make.conf you just copy paste the first line and do (assuming your machine - whatever it is - is mounted in /usr/$CHOST:

Code:
# CHOST=armv7a-hardfloat-linux-gnueabi CBUILD=x86_64-pc-linux-gnu HOSTCC=${CBUILD}-gcc ROOT=/usr/armv7a-hardfloat-linux-gnueabi/ SYSROOT=${ROOT} PKG_CONFIG_PATH="${ROOT}/usr/lib/pkgconfig/" PORTAGE_TMPFS="/ramfs"  PORTAGE_TMPDIR="/ramfs" MAKEOPTS="-j16" cross-emerge whatever


most stuff works. python doesn't work right. chrome ... i was never able to cross compile chrome that way. it's mostly trial and error. most things work this way... and it's way better than the qemu method. the stuff I posted is just an example of how it works. you could use whatever else other than nfs4. it's just what I use.

EDIT: this method works very well with stuff like gcc that raspberry pi simply doesn't do well (because of ram constraints). qt stuff. c++ stuff. stuff like webkit-gtk. but other short small programs like python just crap out. again, it's trial and error. over time you learn. nobody has it all figured out :)

EDIT2: distcc and ccache work absolutely great (although sometimes the eselect tool gets confused on the links) and as long as you have that $CHOST installed, distcc will just work great. and ccache... I assume it works great. it says its saving me 25% compiling... but that's another story. the point is, these tools work great, if you set them right.
Back to top
View user's profile Send private message
crocket
Guru
Guru


Joined: 29 Apr 2017
Posts: 558

PostPosted: Wed Jul 17, 2019 5:47 am    Post subject: Reply with quote

CaptainBlood wrote:
Maybe
Code:
FEATURES="$FEATURES ..."
might improve a bit, as there seems no obvious reason to cancel all other features, but only to change a few.
This syntax being applied here in aliases, e.g.
Code:
alias nodistcc='FEATURES="$FEATURES -distcc -distcc-pump"'
using it as:
Code:
nodistcc emerge <a_package>

My apologizes for not answering to your question.

Thks 4 ur attention.


According to "man make.conf", FEATURES is an incremental variable.
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3999

PostPosted: Wed Jul 17, 2019 5:23 pm    Post subject: Reply with quote

Thanks for pointing out your so relevant source :oops:.
Time for a little cleaning, I guess :lol:.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum