Gentoo Archives: gentoo-user

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

Attachments

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

Replies

Subject Author
Re: [gentoo-user] cross-compile attempt Mick <michaelkintzios@×××××.com>