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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Sergei Trofimovich
From: Sergei Trofimovich <slyfox at gentoo.org>

Fixed bootstrap failure on linux for --target=mingw32

Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
---
 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
+    *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



Reply | Threaded
Open this post in threaded view
|

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

Sergei Trofimovich
From: Sergei Trofimovich <slyfox at gentoo.org>

Fixed bootstrap failure on linux for --target=mingw32

Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
---
 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
+    *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



Reply | Threaded
Open this post in threaded view
|

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

Gabor Greif-2
On 2/13/13, Sergei Trofimovich <slyich at gmail.com> wrote:

> From: Sergei Trofimovich <slyfox at gentoo.org>
>
> Fixed bootstrap failure on linux for --target=mingw32
>
> Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
> ---
>  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 at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
>


Reply | Threaded
Open this post in threaded view
|

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

Sergei Trofimovich
On Wed, 13 Feb 2013 22:47:40 +0100
Gabor Greif <ggreif at gmail.com> wrote:

> On 2/13/13, Sergei Trofimovich <slyich at gmail.com> wrote:
> > From: Sergei Trofimovich <slyfox at gentoo.org>
> >
> > Fixed bootstrap failure on linux for --target=mingw32
> >
> > Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
> > ---
> >  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 at haskell.org
> > http://www.haskell.org/mailman/listinfo/ghc-devs
> >


--

  Sergei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130214/336be731/attachment.pgp>

Reply | Threaded
Open this post in threaded view
|

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

Simon Marlow-7
In reply to this post by Gabor Greif-2
On 13/02/13 21:47, Gabor Greif wrote:

> On 2/13/13, Sergei Trofimovich <slyich at gmail.com> wrote:
>> From: Sergei Trofimovich <slyfox at gentoo.org>
>>
>> Fixed bootstrap failure on linux for --target=mingw32
>>
>> Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
>> ---
>>   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