Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] cross-compile attempt
Date: Mon, 01 Aug 2016 13:51:31
Message-Id: 2788057.PL0PvVn3Vb@dell_xps
In Reply to: Re: [gentoo-user] cross-compile attempt by Mick
1 On Sunday 31 Jul 2016 23:31:29 you wrote:
2 > On Sunday 31 Jul 2016 23:18:00 Andrew Savchenko wrote:
3 > > On Sun, 31 Jul 2016 19:40:37 +0100 Mick wrote:
4 > > > Hi All,
5 > > >
6 > > > I am dipping my toe into cross-compile territory, in order to build i686
7 > > > binaries for a 32bit box, which is too old to do its own emerges. I am
8 > > > using an amd64 box which is significantly faster to do all the heavy
9 > > > lifting and started applying this page:
10 > > >
11 > > > https://wiki.gentoo.org/wiki/Embedded_Handbook/General/Creating_a_cross-> > > co
12 > > > mpiler
13 > > >
14 > > > which I followed up with:
15 > > >
16 > > > https://wiki.gentoo.org/wiki/Cross_build_environment
17 > >
18 > > And here comes this misconception again... Please, tell me, why on
19 > > the earth cross-compiling is needed for amd64 to produce i686
20 > > binaries?!
21 >
22 > I thought it did. From what you're saying I got this wrong. When I read
23 > the first use case bullet point, on the 2nd URL above, I thought I had
24 > arrived at the right place. :-/
25 >
26 > > amd64 CPU _natively_ supports x86 instructions, amd64 kernel
27 > > natively supports x86 code (this can be disabled during kernel
28 > > config, but usually it isn't), amd64 gcc *can* produce x86 binaries.
29 >
30 > I thought amd64 can run x86 binaries, but I wasn't aware that it can compile
31 > them too, or what is needed to achieve this. My knowledge on gcc is pretty
32 > much minimal. I did search the Wiki, gentoo.org and Google for it, but all
33 > I could come across was cross-compiling.
34 >
35 > > There are two ways to help older x86 boxes to build packages faster:
36 > >
37 > > 1. Set up distcc to produce x86 code on your amd64 processors. Just
38 > > add -m32 to your *FLAGS.
39 >
40 > I read somewhere in these unsuccessful searches of mine that distcc is
41 > deprecated and it is better to use cross-compiling instead ...
42 >
43 > > 2. Copy old box system to a chroot dir on amd64. Run setarch i686
44 > > and chroot to that directory, and build 32-bit packages as usual!
45 > > There are two ways to deliver them:
46 > >
47 > > 2.a. Generate binary packages on new box and install them on old
48 > > boxes.
49 >
50 > OK, I'll uninstall crossdev and try 2.a in the first instance. Is there a
51 > Wiki page explaining what parts of the x86 system are needed to carry
52 > across to the amd64 guest_root_fs? I wouldn't think I will need the whole
53 > x86 fs? Anything else I need to pay attention to?
54 >
55 > > 2.b. Instead of copying old box's root, mount it over NFS.
56 >
57 > I'll look into this later, after I get 2.a going.
58 >
59 > > I'm currently using 1, but planning to switch to 2.a, because
60 > > distcc can't help with everything (execution of java, python,
61 > > autotools and other stuff can't be helped with distcc).
62 > >
63 > > I used 2.b earlier on very old box (it is dead now).
64 > >
65 > > 3. Well, one can do full cross-compilation as you proposed, but
66 > > this is ridiculous. Cross-compilation is always a pain and if it
67 > > can be avoided, it should be avoided.
68 >
69 > Thanks for this advice. I am not particularly interested to use crossdev if
70 > it is not the best suited tool for the job, but I wasn't aware of the
71 > alternatives you suggested and haven't as yet found any HOWTOs on it.
72
73 Given Andrew's steer I had another look and found this guide:
74
75 https://wiki.gentoo.org/wiki/Project:AMD64/32-bit_Chroot_Guide
76
77 Is this approach still valid, or have things moved on since this article was
78 authored (2012) and different configuration/approach is now recommended?
79
80 --
81 Regards,
82 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] cross-compile attempt Peter Humphrey <peter@××××××××××××.uk>