Am 02.01.2015 um 08:51 schrieb Helmut Grohne:

> When cross building ncurses for multilib enabled architectures (e.g.
> i386, sparc), the build fails. The failure mode depends on the installed
> packages.  If gcc-multilib is not installed[1], the multilib builds
> which are invoked with e.g. CC="gcc -m32" fail. Otherwise, dh_strip
> fails[3] on wrong-arch binaries. Even if the build was succeeding, the
> resulting packages would contain wrong-arch binaries.
>
> The fix is not to use CC="gcc -msomething" in cross builds but rather
> use CC="$triplet-gcc -msomething". The attached patch achieves just
> that. Does it look reasonable to you (after the jessie release)?

In principle, yes.

> [1] Technically, this means that the g++-multilib Build-Dependency is
>     not satisfied. However, this dependency needs translation[2] in
>     order to be useful for cross compilation. So not having gcc-multilib
>     installed is morally valid. Just fixing Build-Depends is not yet
>     feasible as gcc-for-host and friends are still in experimental.

You still need libc(32|64)c-dev though, and the pesky /usr/include/asm
symlink shipped currently in gcc-multilib is also required.  Without it,
I get this error in a native amd64 build:

,----
| In file included from /usr/include/bits/errno.h:24:0,
|                  from /usr/include/errno.h:35,
|                  from /tmp/ncurses-5.9+20140913/ncurses/curses.priv.h:87,
|                  from /tmp/ncurses-5.9+20140913/ncurses/tinfo/access.c:33:
| /usr/include/linux/errno.h:1:23: fatal error: asm/errno.h: No such file or 
directory
|  #include <asm/errno.h>
`----

> diff -Nru ncurses-5.9+20140913/debian/rules ncurses-5.9+20140913/debian/rules
> --- ncurses-5.9+20140913/debian/rules 2014-09-15 20:01:33.000000000 +0200
> +++ ncurses-5.9+20140913/debian/rules 2014-12-29 19:25:50.000000000 +0100
> @@ -7,6 +7,14 @@
>  export CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
>  export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
>  
> +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
> +HOST_CC ?= $(DEB_HOST_GNU_TYPE)-gcc
> +HOST_CXX ?= $(DEB_HOST_GNU_TYPE)-g++
> +else
> +HOST_CC ?= gcc
> +HOST_CXX ?= g++
> +endif
> +
>  # These are important since this is a library package
>  soname=5
>  sodepver = (>= 5.9+20140712)
> @@ -191,8 +199,8 @@
>  
>       cf_cv_type_of_bool='unsigned char'; export cf_cv_type_of_bool; \
>       cf_cv_working_poll=yes; export cf_cv_working_poll; \
> -     cd $(objdir-32) && CFLAGS="$(CFLAGS)" CC="gcc -m32" \
> -             BUILD_CC="gcc" CXX="g++ -m32" \
> +     cd $(objdir-32) && CFLAGS="$(CFLAGS)" CC="$(HOST_CC) -m32" \
> +             BUILD_CC="gcc" CXX="$(HOST_CXX) -m32" \
>               $(srcdir)/configure \
>               $(CONFARGS) \
>               --host=$(build_32_target) \
> @@ -205,8 +213,8 @@
>  
>       cf_cv_type_of_bool='unsigned char'; export cf_cv_type_of_bool; \
>       cf_cv_working_poll=yes; export cf_cv_working_poll; \
> -     cd $(objdir-64) && CFLAGS="$(CFLAGS)" CC="gcc -m64" \
> -             BUILD_CC="gcc" CXX="g++ -m64" \
> +     cd $(objdir-64) && CFLAGS="$(CFLAGS)" CC="$(HOST_CC) -m64" \
> +             BUILD_CC="gcc" CXX="$(HOST_CXX) -m64" \
>               $(srcdir)/configure \
>               $(CONFARGS) \
>               --host=$(build_64_target) \
> @@ -254,8 +262,8 @@
>  
>       cf_cv_type_of_bool='unsigned char'; export cf_cv_type_of_bool; \
>       cf_cv_working_poll=yes; export cf_cv_working_poll; \
> -     cd $(wobjdir-32) && CFLAGS="$(CFLAGS)" CC="gcc -m32" \
> -             BUILD_CC="gcc" BUILD_CPPFLAGS="-D_GNU_SOURCE" CXX="g++ -m32" \
> +     cd $(wobjdir-32) && CFLAGS="$(CFLAGS)" CC="$(HOST_CC) -m32" \
> +             BUILD_CC="gcc" BUILD_CPPFLAGS="-D_GNU_SOURCE" CXX="$(HOST_CXX) 
> -m32" \
>               $(srcdir)/configure \
>               $(CONFARGS) \
>               --host=$(build_32_target) \

Maybe we should also set CC and CXX in the build-{32,64,wide-32}
targets, otherwise those targets will misbuild if somebody uses a custom
compiler (e.g. "debian/rules CC=clang build").

Cheers,
       Sven


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to