Commit 4cbd5b47 authored by Sergei Trofimovich's avatar Sergei Trofimovich Committed by Marge Bot make cross-compiler detection stricter

Be more precise at detecting cross-compilation case.

Before the change configuration
  $ ./configure --host=x86_64-pc-linux-gnu --target=x86_64-gentoo-linux-musl
was not considered a cross-target. Even though libcs are different (`glibc` vs. `musl`).

Without this patch build fails as:

"inplace/bin/ghc-cabal" check libraries/integer-gmp
"inplace/bin/ghc-cabal" configure libraries/integer-gmp dist-install \
    --with-ghc="/home/slyfox/dev/git/ghc/inplace/bin/ghc-stage1" \
    --with-ghc-pkg="/home/slyfox/dev/git/ghc/inplace/bin/ghc-pkg" \
    --disable-library-for-ghci --enable-library-vanilla --enable-library-for-ghci \
    --enable-library-profiling --enable-shared --with-hscolour="/usr/bin/HsColour" \
    --configure-option=CFLAGS="-Wall \
    -Werror=unused-but-set-variable -Wno-error=inline \
    -iquote /home/slyfox/dev/git/ghc/libraries/integer-gmp" \
    --configure-option=LDFLAGS="  " --configure-option=CPPFLAGS="   \
    " --gcc-options="-Wall     -Werror=unused-but-set-variable -Wno-error=inline -iquote /home/slyfox/dev/git/ghc/libraries/integer-gmp   \
    " --with-gcc="x86_64-gentoo-linux-musl-gcc" --with-ld="" --with-ar="x86_64-gentoo-linux-musl-ar" \
    --with-alex="/usr/bin/alex" --with-happy="/usr/bin/happy"
Configuring integer-gmp-
configure: WARNING: unrecognized options: --with-compiler
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gcc... /usr/lib/ccache/bin/x86_64-gentoo-linux-musl-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/home/slyfox/dev/git/ghc/libraries/integer-gmp/dist-install/build':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
make[1]: *** [libraries/integer-gmp/ libraries/integer-gmp/dist-install/] Error 1
make: *** [Makefile:126: all] Error 2

Note: here `ghc-stage1` is assumed to target `musl` target but is passed
`glibc` toolchain. It happens because initial ./configure phase did not
detect host/target as different.
Signed-off-by: default avatarSergei Trofimovich <>
parent b1c206fd
Pipeline #13437 failed with stages
in 545 minutes and 25 seconds
......@@ -465,7 +465,7 @@ dnl ** Building a cross compiler?
dnl --------------------------------------------------------------
# If 'host' and 'target' differ, then this means we are building a cross-compiler.
if test "$TargetPlatform" != "$HostPlatform" ; then
if test "$target" != "$host" ; then
cross_compiling=yes # This tells configure that it can accept just 'target',
# otherwise you get
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment