View previous topic :: View next topic |
Author |
Message |
crocket Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 29 Apr 2017 Posts: 558
|
Posted: Mon Jul 15, 2019 11:18 pm Post subject: I made cross-compilation work on an arbitrary directory. |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
CaptainBlood Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/1795298829674c652a4ed66.gif)
Joined: 24 Jan 2010 Posts: 3999
|
Posted: Tue Jul 16, 2019 1:22 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
axl Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/2076647575b5d030da3f94.png)
Joined: 11 Oct 2002 Posts: 1146 Location: Romania
|
Posted: Tue Jul 16, 2019 7:38 pm Post subject: i just use stuff like this. |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
crocket Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 29 Apr 2017 Posts: 558
|
Posted: Wed Jul 17, 2019 5:47 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
CaptainBlood Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/1795298829674c652a4ed66.gif)
Joined: 24 Jan 2010 Posts: 3999
|
Posted: Wed Jul 17, 2019 5:23 pm Post subject: |
|
|
Thanks for pointing out your so relevant source .
Time for a little cleaning, I guess . |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|