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

how to handle architecture dependent headers in subdirectories



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. Seen that with python2.7 and python3.3 in experimental,
however I think it is a concern for packages like openssl as well.

Looking at python in experimental (having the architecture independent headers
in /usr/include and the architecture dependent headers in
/usr/include/<multiarch-tuple>) you have some build failures.

For the python case:

 - moving all the headers to the multiarch include path doesn't work,
   because configure tests fail which assume the include directory
   a direct subdirectory of <prefix>.

 - splitting the header installation into /usr/include and
   /usr/include/<multiarch-tuple> doesn't work because packages do use
   sysconfig.get_python_inc() which only returns the former directory.
   (This is the current behaviour of the python packages in experimental).

  - Everything is fine when a package uses pkg-config or python-config,
    because these give the correct include paths. However not every
    packaged upstream does use these.

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. Intending to do that
for python2.7. For python3.x I do intend to get the sysconfig.get_python_inc()
deprecated.

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

  Matthias
#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@>
# elif defined(__alpha__)
#  include <alpha-linux-gnu/@subdir@/@header@>
# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
#  include <arm-linux-gnueabihf/@subdir@/@header@>
# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
#  include <arm-linux-gnueabi/@subdir@/@header@>
# elif defined(__hppa__)
#  include <hppa-linux-gnu/@subdir@/@header@>
# elif defined(__ia64__)
#  include <ia64-linux-gnu/@subdir@/@header@>
# elif defined(__m68k__) && !defined(__mcoldfire__)
#  include <m68k-linux-gnu/@subdir@/@header@>
# elif defined(__mips_hard_float) && defined(_MIPSEL)
#  if defined(_ABIO32)
#   include <mipsel-linux-gnu/@subdir@/@header@>
#  elif defined(_ABIN32)
#   include <mips64el-linux-gnuabin32/@subdir@/@header@>
#  elif defined(_ABI64)
#   include <mips64el-linux-gnuabi64/@subdir@/@header@>
#  else
#   error unknown multiarch location for @header@
#  endif
# elif defined(__mips_hard_float)
#  if defined(_ABIO32)
#   include <mips-linux-gnu/@subdir@/@header@>
#  elif defined(_ABIN32)
#   include <mips64-linux-gnuabin32/@subdir@/@header@>
#  elif defined(_ABI64)
#   include <mips64-linux-gnuabi64/@subdir@/@header@>
#  else
#   error unknown multiarch location for @header@
#  endif
# elif defined(__powerpc__) && defined(__SPE__)
#  include <powerpc-linux-gnuspe/@subdir@/@header@>
# elif defined(__powerpc__)
#  include <powerpc-linux-gnu/@subdir@/@header@>
# elif defined(__powerpc64__)
#  include <powerpc64-linux-gnu/@subdir@/@header@>
# elif defined(__s390x__)
#  include <s390x-linux-gnu/@subdir@/@header@>
# elif defined(__s390__)
#  include <s390-linux-gnu/@subdir@/@header@>
# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
#  include <sh4-linux-gnu/@subdir@/@header@>
# elif defined(__sparc__)
#  include <sparc-linux-gnu/@subdir@/@header@>
# elif defined(__sparc64__)
#  include <sparc64-linux-gnu/@subdir@/@header@>
# else
#   error unknown multiarch location for @header@
# endif
#elif defined(__FreeBSD_kernel__)
# if defined(__LP64__)
#  include <x86_64-kfreebsd-gnu/@subdir@/@header@>
# elif defined(__i386__)
#  include <i386-kfreebsd-gnu/@subdir@/@header@>
# else
#   error unknown multiarch location for @header@
# endif
#elif defined(__gnu_hurd__)
# include <i386-gnu/@subdir@/@header@>
#else
# error unknown multiarch location for @header@
#endif

Reply to: