Gentoo Archives: gentoo-user

From: YoYo Siska <yoyo@××××××.sk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] crosscompiling...the point of view
Date: Tue, 07 Aug 2012 13:38:15
Message-Id: 20120807133633.GA23822@ksp.sk
In Reply to: Re: [gentoo-user] crosscompiling...the point of view by meino.cramer@gmx.de
1 On Mon, Aug 06, 2012 at 06:37:07PM +0200, meino.cramer@×××.de wrote:
2 > Paul Hartman <paul.hartman+gentoo@×××××.com> [12-08-06 17:36]:
3 > > On Mon, Aug 6, 2012 at 8:01 AM, <meino.cramer@×××.de> wrote:
4 > > > Hi,
5 > > >
6 > > > I am asking, because I found not only one description of somehow
7 > > > complicated setups to compile a distribution (namely gentoo) for a
8 > > > platform "A" (Beaglebone TI OMAP4) on that platform with distcc to
9 > > > speedup things or with emulated chroot environments based on qemu...
10 > > >
11 > > > I thought it would be the easiest to compile the whole stuff on a host
12 > > > system "B" with a crosscompilation toolchain...but may be I have
13 > > > overlooked something important...
14 > >
15 > > Seems the best way to me, too.
16 > >
17 > > > So - is there any logical reason, which prevents the process of the
18 > > > compilation of a complete distribution/rootfs/boot-mechanism for
19 > > > a platform "A" on a hostsystem of the platform "B" if the cross
20 > > > compilation toolchain is already installed on "B" and no emulated
21 > > > environment is wanted?
22 > >
23 > > So you want to "install" the packages into a virtual filesystem image
24 > > on the compiler machine to create a whole disk image for the target,
25 > > basically? Hmmm. Maybe something like Scratchbox can help with this.
26 > >
27 > Hi Paul,
28 >
29 > ...yes, exactly. But theproblem remains...is there a logical reason,
30 > which renders this attempt useless ?
31
32 Crosscompilation is the preffered way, but there can be a lot of
33 problems with it . The cross-toolchain isn't a problem, gennto has a
34 nice tool called crossdev that will generate it for you and with a bit
35 of env. variables and make.conf tweaks, you can easily do cross-compile
36 emerges into a specific sysroot (gentoo has nice documentation at [1])
37
38 The problem is usually with build systems that don't take
39 croos-compilation into account: things like getting paths wrong
40 (including the path to the root of your croscompiled stuff or using
41 paths in your host system, (older libtool used to generate .la files
42 with paths in your host system)), using information from your life
43 system instead of the target system, not correctly handling cases where,
44 as part of the installation, tools are compiled that are then directly
45 executed. Most build systems have ways to correctly express these
46 things, but authors often get them wrong etc...
47
48 Then there are cases where some post-installation steps are required to
49 be run in the target system (remeber those "Updating desktop mime
50 database " or "Updating shared mime info database" messages after most
51 desktop apps ?) that usually require executing the installed programs,
52 which means that either a host version has to be compiled (which can
53 correctly work with stuff in the targe root directory) or they have to
54 be somehow started on the first boot of the target system.
55
56 Because of this, doing it in an emulated enviroment or on the actual
57 device makes most of these problems go away. So if somebody doesn't
58 have time to sort out these cross compilation problems but doesn't mind
59 if the installation runs few times longer (but without problems), its
60 better for them...
61
62 I last did a cross compiled install of gentoo about two years ago,
63 mostly it was without any problems, though there were some problematic
64 packages (IIRC python used to be a problematic one, not sure how it is now).
65 Recently I have done a few "emulated root" installs and they went
66 absolutely without any problems (at least as far the 'compile packages
67 and get a rootfs) step is concerned... getting things to run correctly
68 on an embedded device without any display etc has its own challenges ;)
69
70 yoyo
71
72
73
74
75 [1] http://www.gentoo.org/proj/en/base/embedded/cross-development.xml