[commit: ghc] ghc-8.2: rts: tweak cross-compilation to mingw32 (d8d810e)

git at git.haskell.org git at git.haskell.org
Thu Apr 27 20:09:59 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/d8d810e281b94e387e541bcd0747e2d0474de908/ghc

>---------------------------------------------------------------

commit d8d810e281b94e387e541bcd0747e2d0474de908
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Sun Apr 23 11:44:45 2017 +0100

    rts: tweak cross-compilation to mingw32
    
    Found the problem on x86_64-linux host where
    I tried to cross-compile GHC to windows as:
    
        $ ./configure --target=i686-w64-mingw32 \
                      Windres=i686-w64-mingw32-windres \
                      DllWrap=i686-w64-mingw32-dllwrap
    
    As a result build failed as POSIX bits of RTS.
    For example 'rts/posix/OSMem.c' contains unix-specific
    mmap() syscalls and constants and thus can't be compiled
    by i686-w64-mingw32 toolchain.
    
    It's caused by the following part of 'rts/ghc.mk':
    
      ifeq "$(HostOS_CPP)" "mingw32"
      ALL_DIRS += win32
      else
      ALL_DIRS += posix
      endif
    
    In our case _CPP variables are defined this way (project.mk):
      BuildOS_CPP                = linux
      HostOS_CPP                 = linux
      TargetOS_CPP               = mingw32
    
    RTS should never be built for 'BuildOS' or 'HostOS' as it's
    always built by ghc-stage1 (targeted at TargetOS).
    
    The change is to flip 'HostOS_CPP' to 'TargetOS_CPP' in 'rts/ghc.mk'.
    
    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
    (cherry picked from commit 745032dd02da511067c2939259ed212852187e0f)


>---------------------------------------------------------------

d8d810e281b94e387e541bcd0747e2d0474de908
 rts/ghc.mk | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/rts/ghc.mk b/rts/ghc.mk
index b756d94..4842c34 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -39,7 +39,7 @@ $(eval $(call all-target,rts,$(ALL_RTS_LIBS)))
 
 ALL_DIRS = hooks sm eventlog linker
 
-ifeq "$(HostOS_CPP)" "mingw32"
+ifeq "$(TargetOS_CPP)" "mingw32"
 ALL_DIRS += win32
 else
 ALL_DIRS += posix
@@ -92,7 +92,7 @@ rts/dist/libs.depend : $$(ghc-pkg_INPLACE) | $$(dir $$@)/.
 # 	These are made from rts/win32/libHS*.def which contain lists of
 # 	all the symbols in those libraries used by the RTS.
 #
-ifeq "$(HostOS_CPP)" "mingw32" 
+ifeq "$(TargetOS_CPP)" "mingw32"
 
 ALL_RTS_DEF_LIBNAMES 	= base ghc-prim
 ALL_RTS_DEF_LIBS	= \
@@ -116,7 +116,7 @@ endif
 
 ifneq "$(BINDIST)" "YES"
 ifneq "$(UseSystemLibFFI)" "YES"
-ifeq "$(HostOS_CPP)" "mingw32" 
+ifeq "$(TargetOS_CPP)" "mingw32"
 rts/dist/build/$(LIBFFI_DLL): libffi/build/inst/bin/$(LIBFFI_DLL)
 	cp $< $@
 else
@@ -147,7 +147,7 @@ rts_dist_$1_CC_OPTS += -fno-omit-frame-pointer -g -O0
 endif
 
 ifneq "$$(findstring dyn, $1)" ""
-ifeq "$$(HostOS_CPP)" "mingw32" 
+ifeq "$$(TargetOS_CPP)" "mingw32"
 rts_dist_$1_CC_OPTS += -DCOMPILING_WINDOWS_DLL
 endif
 rts_dist_$1_CC_OPTS += -DDYNAMIC
@@ -197,7 +197,7 @@ endif
 
 # Making a shared library for the RTS.
 ifneq "$$(findstring dyn, $1)" ""
-ifeq "$$(HostOS_CPP)" "mingw32" 
+ifeq "$$(TargetOS_CPP)" "mingw32"
 $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/dist/libs.depend rts/dist/build/$$(LIBFFI_DLL)
 	"$$(RM)" $$(RM_OPTS) $$@
 	"$$(rts_dist_HC)" -this-unit-id rts -shared -dynamic -dynload deploy \



More information about the ghc-commits mailing list