Dnia 2013-08-22, o godz. 10:56:10
Nikos Chantziaras <rea...@gmail.com> napisał(a):

> Now that Gentoo is much better in handling multilib libraries, but 
> Gentoo is source-based, there's the question of which header files are 
> used between different ABI builds.
> 
> As I understand it, only the headers from the default ABI are installed. 
>   That means that building for abi_x86_32 on a amd64 system will use the 
> headers installed by the abi_x86_64 build of the used library.

The build process installs alls headers by default and compares
if they're the same. The ebuild can also specify that some headers need
to be wrapped -- in that case they are installed with an ABI-detecting
wrapper on top.

>  From a developer's point of view, does that mean that we now have to 
> keep Gentoo in mind when writing header files, or does Gentoo apply any 
> kind of magic here to fix differences between header files for different 
> archs?  For example, if I need to provide a PTR_SIZE macro in a header 
> that contains the size of void pointers on this particular system, I 
> would detect this with autoconf and then just use that, so the header 
> file would end up simply containing:
> 
>      #define PTR_SIZE 8
> 
> on x86-64, and:
> 
>      #define PTR_SIZE 4
> 
> on x86.  The x86-64 header won't work properly when building on Gentoo 
> for abi_x86_32.  As a developer, this is a no-no for me:
> 
>      #ifdef THIS_ARCH
>          #define PTR_SIZE 8
>      #elif defined THAT_ARCH
>          #define PTR_SIZE 4
>      ...
> 
> because detection should be done in autoconf, not in the header file.

As a developer, you should learn not to put anything system- or machine-
-specific in public headers. This is simply wrong, and will break more
ways than you could imagine.

We're hacking it over but it's far from perfect, and is not an excuse
to write more screwed up software. Anything you detect about the host
should be used *only* inside C files, and header files that are only
used during build-time and not installed.

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: PGP signature

Reply via email to