1 |
Dnia 2013-08-22, o godz. 10:56:10 |
2 |
Nikos Chantziaras <realnc@×××××.com> napisał(a): |
3 |
|
4 |
> Now that Gentoo is much better in handling multilib libraries, but |
5 |
> Gentoo is source-based, there's the question of which header files are |
6 |
> used between different ABI builds. |
7 |
> |
8 |
> As I understand it, only the headers from the default ABI are installed. |
9 |
> That means that building for abi_x86_32 on a amd64 system will use the |
10 |
> headers installed by the abi_x86_64 build of the used library. |
11 |
|
12 |
The build process installs alls headers by default and compares |
13 |
if they're the same. The ebuild can also specify that some headers need |
14 |
to be wrapped -- in that case they are installed with an ABI-detecting |
15 |
wrapper on top. |
16 |
|
17 |
> From a developer's point of view, does that mean that we now have to |
18 |
> keep Gentoo in mind when writing header files, or does Gentoo apply any |
19 |
> kind of magic here to fix differences between header files for different |
20 |
> archs? For example, if I need to provide a PTR_SIZE macro in a header |
21 |
> that contains the size of void pointers on this particular system, I |
22 |
> would detect this with autoconf and then just use that, so the header |
23 |
> file would end up simply containing: |
24 |
> |
25 |
> #define PTR_SIZE 8 |
26 |
> |
27 |
> on x86-64, and: |
28 |
> |
29 |
> #define PTR_SIZE 4 |
30 |
> |
31 |
> on x86. The x86-64 header won't work properly when building on Gentoo |
32 |
> for abi_x86_32. As a developer, this is a no-no for me: |
33 |
> |
34 |
> #ifdef THIS_ARCH |
35 |
> #define PTR_SIZE 8 |
36 |
> #elif defined THAT_ARCH |
37 |
> #define PTR_SIZE 4 |
38 |
> ... |
39 |
> |
40 |
> because detection should be done in autoconf, not in the header file. |
41 |
|
42 |
As a developer, you should learn not to put anything system- or machine- |
43 |
-specific in public headers. This is simply wrong, and will break more |
44 |
ways than you could imagine. |
45 |
|
46 |
We're hacking it over but it's far from perfect, and is not an excuse |
47 |
to write more screwed up software. Anything you detect about the host |
48 |
should be used *only* inside C files, and header files that are only |
49 |
used during build-time and not installed. |
50 |
|
51 |
-- |
52 |
Best regards, |
53 |
Michał Górny |