[PATCH] base: use --target as target, not uname

From: Sergei Trofimovich

From: Sergei Trofimovich

On 2/13/13, Sergei Trofimovich
From: Sergei Trofimovich
Fixed bootstrap failure on linux for --target=mingw32
Signed-off-by: Sergei Trofimovich
--- configure.ac | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b679520..7553a7a 100644 --- a/configure.ac +++ b/configure.ac @@ -5,17 +5,23 @@ AC_CONFIG_SRCDIR([include/HsBase.h])
AC_CONFIG_HEADERS([include/HsBaseConfig.h include/EventConfig.h])
+AC_CANONICAL_BUILD +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + AC_ARG_WITH([cc], [C compiler], [CC=$withval]) AC_PROG_CC()
-case `uname -s` in - MINGW*|CYGWIN*) +AC_MSG_CHECKING(for WINDOWS platform) +case $host in
Hi Sergei, I see some host <-> target confusion here. It is probably caused by https://github.com/ghc/ghc/blob/master/rules/build-package-data.mk#L74 I have always built my cross-ghc with this patch: ifeq "$$(CrossCompiling)" "YES" $1_$2_CONFIGURE_OPTS += --configure-option=--host=$(HOSTPLATFORM) $1_$2_CONFIGURE_OPTS += --configure-option=--target=$(TARGETPLATFORM) endif instead, and have not seen problems so far. Maybe we should specify how the packages should be configured for different stages of the compiler once and for all, so we do not perpetuate the current confusion. Cheers, Gabor
+ *mingw32*|*cygwin*) WINDOWS=YES;; *) WINDOWS=NO;; esac +AC_MSG_RESULT($WINDOWS)
# do we have long longs? AC_CHECK_TYPES([long long]) -- 1.8.1.2
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

On Wed, 13 Feb 2013 22:47:40 +0100
Gabor Greif
On 2/13/13, Sergei Trofimovich
wrote: From: Sergei Trofimovich
Fixed bootstrap failure on linux for --target=mingw32
Signed-off-by: Sergei Trofimovich
--- configure.ac | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b679520..7553a7a 100644 --- a/configure.ac +++ b/configure.ac @@ -5,17 +5,23 @@ AC_CONFIG_SRCDIR([include/HsBase.h])
AC_CONFIG_HEADERS([include/HsBaseConfig.h include/EventConfig.h])
+AC_CANONICAL_BUILD +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + AC_ARG_WITH([cc], [C compiler], [CC=$withval]) AC_PROG_CC()
-case `uname -s` in - MINGW*|CYGWIN*) +AC_MSG_CHECKING(for WINDOWS platform) +case $host in
Hi Sergei,
I see some host <-> target confusion here. It is probably caused by
https://github.com/ghc/ghc/blob/master/rules/build-package-data.mk#L74
I have always built my cross-ghc with this patch:
ifeq "$$(CrossCompiling)" "YES" $1_$2_CONFIGURE_OPTS += --configure-option=--host=$(HOSTPLATFORM) $1_$2_CONFIGURE_OPTS += --configure-option=--target=$(TARGETPLATFORM) endif
instead, and have not seen problems so far. Maybe we should specify how the packages should be configured for different stages of the compiler once and for all, so we do not perpetuate the current confusion.
Well, yeah, your patch makes perfect sense for things like hsc2hs, where buld/host/target can be 3 different things. But for simple haskell libraries (like base) it's only a matter of not calling uname on linux. If you try to use --target=x86_64-w64-mingw32 (ghc's configure) on linux you will see the base breakage at once. It will pass correct --host flag to base but it will fail to configure (and this patch is expected to fix it).
Cheers,
Gabor
+ *mingw32*|*cygwin*) WINDOWS=YES;; *) WINDOWS=NO;; esac +AC_MSG_RESULT($WINDOWS)
# do we have long longs? AC_CHECK_TYPES([long long]) -- 1.8.1.2
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
-- Sergei

On 13/02/13 21:47, Gabor Greif wrote:
On 2/13/13, Sergei Trofimovich
wrote: From: Sergei Trofimovich
Fixed bootstrap failure on linux for --target=mingw32
Signed-off-by: Sergei Trofimovich
--- configure.ac | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b679520..7553a7a 100644 --- a/configure.ac +++ b/configure.ac @@ -5,17 +5,23 @@ AC_CONFIG_SRCDIR([include/HsBase.h])
AC_CONFIG_HEADERS([include/HsBaseConfig.h include/EventConfig.h])
+AC_CANONICAL_BUILD +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + AC_ARG_WITH([cc], [C compiler], [CC=$withval]) AC_PROG_CC()
-case `uname -s` in - MINGW*|CYGWIN*) +AC_MSG_CHECKING(for WINDOWS platform) +case $host in
Hi Sergei,
I see some host <-> target confusion here. It is probably caused by
https://github.com/ghc/ghc/blob/master/rules/build-package-data.mk#L74
I have always built my cross-ghc with this patch:
ifeq "$$(CrossCompiling)" "YES" $1_$2_CONFIGURE_OPTS += --configure-option=--host=$(HOSTPLATFORM) $1_$2_CONFIGURE_OPTS += --configure-option=--target=$(TARGETPLATFORM) endif
Setting --host is correct (and is already done by the build system), but passing --target to the configure script for a library would be wrong. Cheers, Simon
participants (3)
-
Gabor Greif
-
Sergei Trofimovich
-
Simon Marlow