[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to handle architecture dependent headers in subdirectories

On Wed, Jan 16, 2013 at 11:32:45PM +0100, Matthias Klose wrote:
> There are some issues when you do have an architecture dependent header file
> which needs to be in the multiarch specific include directory.  If the header
> file is directly located in /usr/include, then moving it to
> /usr/include/<multiarch-tuple> usually is not a problem (except for quoting
> issues as found in the packaging for libreoffice).  The compilers (checked here
> GCC and clang) do include the multiarch include path as a path for system
> includes too.
> However there are some issues when you do need to split the header files into
> different locations.

> So I'm proposing to use a header which can be installed into /usr/include and
> does include the header file included in a subdirectory installed into
> /usr/include/<multiarch-tuple> and works around the issue.

> Attaching the proposed header file, intending to include it into the gcc package
> as /usr/lib/gcc/multiarch.h.in

> #if defined(__linux__)
> # if defined(__x86_64__) && defined(__LP64__)
> #  include <x86_64-linux-gnu/@subdir@/@header@>
> # elif defined(__x86_64__) && defined(__ILP32__)
> #  include <x86_64-linux-gnux32/@subdir@/@header@>
> # elif defined(__i386__)
> #  include <i386-linux-gnu/@subdir@/@header@>

This looks just like the solution ultimately chosen for #682183, except for
the include being monstrous.  Let's instead add a file to libc6-dev with
the following:

#define DEB_HOST_MULTIARCH "x86_64-linux-gnu"

(for different values of "x86_64-linux-gnu").  It might be either a new file
on its own, or an addition to one of existing headers.  This is currently
/usr/include/x86_64-linux-gnu/lua5.1-deb-multiarch.h except that it'd be a
pain to do this for every single package.

Having a #define that says "amd64" could be good, too.

Doing it this way would remove a yet another place that has to be changed
when adding a new arch.  Also, having it as a string allows other uses than
a static #include.

How to squander your resources: those silly Swedes have a sauce named
"hovmästarsås", the best thing ever to put on cheese, yet they waste it
solely on mere salmon.

Reply to: