Source: ghc
Version: 8.6.5+dfsg1-2
Severity: normal
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

Hello!

Trying to cross-build ghc currently fails with:

GHC build  : x86_64-unknown-linux
GHC host   : powerpc-unknown-linux
GHC target : powerpc-unknown-linux
LLVM target: powerpc-unknown-linux
checking for path to top of build tree... /<<PKGBUILDDIR>>
checking for powerpc-linux-gnu-windres... no
checking for powerpc-linux-gnu-dllwrap... no
checking for powerpc-linux-gnu-objdump... powerpc-linux-gnu-objdump
configure: error: 
You've selected:

  BUILD:  x86_64-unknown-linux   (the architecture we're building on)
  HOST:   powerpc-unknown-linux    (the architecture the compiler we're 
building will execute on)
  TARGET: powerpc-unknown-linux  (the architecture the compiler we're building 
will produce code for)

BUILD must equal HOST; that is, we do not support building GHC itself
with a cross-compiler.  To cross-compile GHC itself, set TARGET: stage
1 will be a cross-compiler, and stage 2 will be the cross-compiled
GHC.

This can be reproduced when building ghc with:

     sbuild -d sid --host=powerpc --profile=cross --no-arch-all

I was able to fix this problem with the following trivial change:

--- debian/rules~       2019-07-28 18:31:28.000000000 +0200
+++ debian/rules        2019-07-29 01:39:31.863510243 +0200
@@ -23,7 +23,7 @@
 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 export DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
 
-EXTRA_CONFIGURE_FLAGS += --target $(DEB_HOST_GNU_TYPE)
+EXTRA_CONFIGURE_FLAGS += --host $(DEB_BUILD_GNU_TYPE) --build 
$(DEB_BUILD_GNU_TYPE) --target $(DEB_HOST_GNU_TYPE)
 # We're cross-building if DEB_BUILD_GNU_TYPE != DEB_HOST_GNU_TYPE
 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
   EXTRA_CONFIGURE_FLAGS += --enable-unregisterised

Would be great if something like that could be done for the next upload,
so it's easier to cross-bootstrap ghc again for powerpc and sh4.

Thanks,
Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

Reply via email to