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

Cross build fails for multiarch=no



Hello,

because I falling into multiple problems while cross compiling, I send my questions here, instead to single developer of every package or build tool.

I'm trying to create a native Debian arch i586. I know, this arch is not new. It's old, and not official supported by Debian. I need this, because all x86 architectures are mapped to i686 compiler output. This would fail on CPU, that only supports code up to i586.

I used "helmutg/rebootstrap" to automate the Debian boot strapping.
I patched some files, to not map Debian arch i586 into GNU arch i686.
My build script exist here: https://salsa.debian.org/hne-ssv/rebootstrap

The first error:
gcc:
    CONFARGS += \
        --includedir=/$(PFL)/include

    is set in debian/rules2.
    PFL is /usr/<triplet>. So, only /usr/<triplet>/include was set as includedir.

    This ends with a missing stdio.h for multiarch=yes and multilib=no.
    I Think, for multiarch=yes this should use to
       --includedir=/$(PF)/include/$(DEB_TARGET_GNU_TYPE) 

Because problems inside GCC or GLIBC with default settings of this script, I changed options to

    ENABLE_MULTILIB=no
    ENABLE_MULTIARCH_GCC=no  (default was yes)

Building GCC was done.
In output "i586-linux-gnu-gcc -v" can see "--includedir=/usr/i586-linux-gnu/include".
I assume, this is correct for cross building multiarch=no.

I found some debian rules, there was a detection on ENABLE_MULTIARCH_GCC=yes
and use /usr/include/<triplet>, or use /usr/<triplet>/include for "no".

In complete build with rebootstrap found some packages, where ENABLE_MULTIARCH_GCC=no was not respected and hard coded includedir to /usr/include/<triplet>. They are:

apt:
    find_path(ICONV_INCLUDE_DIR NAMES iconv.h)

    CMake should find_path() iconv.h in <prefix>/include/<arch>, but does not.
    /usr/include/i586-linux-gnu/iconv.h exist.

    For "iconv.h" this package uses the Cmake default paths. The default path is only <prefix>/include.
    Cmake would use <prefix>/include/<arch>, but for that CMAKE_LIBRARY_ARCHITECTURE must set. This is not here.
    I fixed it by setting -DCMAKE_LIBRARY_ARCHITECTURE=$(DEB_HOST_MULTIARCH).

libssh:
    cmake: Could NOT find ZLIB (missing: ZLIB_LIBRARY)

    To fix it for for multiarch=no, needs to set
    -DCMAKE_LIBRARY_ARCHITECTURE=$(DEB_HOST_MULTIARCH)

Follow packages uses /usr/include/<arch> without option and no options for multiarch=no.
It's simple to find such packets. I grepped for an existing 'usr/include/$(DEB_HOST_MULTIARCH)' and non existing 'usr/$(DEB_HOST_MULTIARCH)/include'.

curl:
     --includedir=/usr/include/$(DEB_HOST_MULTIARCH)

libffi:
    mv debian/libffi-dev/usr/include/*.h \
        debian/libffi-dev/usr/include/$(DEB_HOST_MULTIARCH)/

    The build glib2.0 fails with "ffi.h: No such file or directory" later.

gmp:
    $(MAKE) DESTDIR=`pwd`/debian/tmp includeexecdir=/usr/include/$(DEB_HOST_MULTIARCH) -C build install

libgpg-error:
    usr/include/* usr/include/${DEB_HOST_MULTIARCH}/
    in debian/libgpg-error-dev.install

    gnupg2,libgcrypt20,libksba will fail later with "checking for GPG Error".

expat:
    mv debian/tmp/usr/include/expat_config.h debian/tmp/usr/include/$(DEB_HOST_MULTIARCH)/.

gcc-defaults:
    dh_link -pgcc-multilib \
      /usr/include/$(DEB_HOST_MULTIARCH)/asm /usr/include/asm

libxcrypt:
    CONFFLAGS_deb2 = $(subst api=glibc,api=no,$(CONFFLAGS_deb1)) \
      --includedir=/usr/include/$(DEB_HOST_MULTIARCH)

openssl:
    mv debian/tmp/usr/include/openssl/configuration.h debian/tmp/usr/include/$(DEB_HOST_MULTIARCH)/openssl/

-- Henry N.


Reply to: