<div>Thanks for your quick response, Ben,</div><div> </div><div>15.11.2016, 19:06, "Ben Gamari" <ben@well-typed.com>:</div><blockquote type="cite"><p>Bernard de la Paz <<a href="mailto:bernard.delapaz@yandex.ru">bernard.delapaz@yandex.ru</a>> writes:<br /> </p><blockquote> I try to cross-compile GHC 8.0.1 with x86_64-mingw toolchain (gcc 6.2.1) and native GHC 8.0.1. Sources are from <a href="http://downloads.haskell.org/~ghc/8.0.1/ghc-8.0.1-src.tar.xz">http://downloads.haskell.org/~ghc/8.0.1/ghc-8.0.1-src.tar.xz</a><br /><br />  cp mk/build.mk.example mk/build.mk<br /><br />  sed -i '1iBuildFlavour = perf' mk/build.mk<br />  sed -i '1iStage1Only = YES' mk/build.mk<br />  sed -i '1iHADDOCK_DOCS = NO' mk/build.mk<br />  ./configure --prefix=~/x86_64-mingw \<br />  --target=x86_64-unknown-mingw32 \<br />  --with-gcc=/usr/bin/x86_64-w64-mingw32-gcc \<br />  --with-ld=/usr/bin/x86_64-w64-mingw32-ld \<br />  --with-nm=/usr/bin/x86_64-w64-mingw32-nm \<br />  --with-ar=/usr/bin/x86_64-w64-mingw32-ar \<br />  --with-ranlib=/usr/bin/x86_64-w64-mingw32-ranlib<br />  make -j8 install<br /><br /> First encountered error is in Types.hsc:<br /><br />  Types.hsc: In function ‘_hsc2hs_test44’:<br />  Types.hsc:219:20: error: storage size of ‘test_array’ isn’t constant<br /> </blockquote><p>In general it is helpful if you include a bit more context on where in<br />the build these errors ocurred. Is this during the stage1 build or<br />stage2? Just a few lines of the surrounding build output would be helpful.</p></blockquote><div><br />Stage2, I guess.</div><div><blockquote><div>===--- building final phase</div><div>make --no-print-directory -f ghc.mk phase=final all</div><div>"rm" -f iserv/stage2_p/build/.depend.c_asm.tmp</div><div>...</div><div><div>checking dependency style of /usr/bin/x86_64-w64-mingw32-gcc... patching file ChangeLog</div><div>patching file configure</div><div>Hunk #8 succeeded at 29902 (offset 3 lines).</div><div>Hunk #9 succeeded at 29974 (offset 3 lines).</div><div>patching file gmp-h.in</div><div>...</div><div><div>chmod +x libraries/integer-gmp/gmp/ln</div><div>...</div><div><div>"inplace/bin/hsc2hs" '--cc=/usr/bin/x86_64-w64-mingw32-gcc' '--ld=/usr/bin/x86_64-w64-mingw32-gcc'  --cross-safe  --cflag=-Wall --cflag=-fno-stack-protector   --cross-compile --cflag=-Dx86_64_HOST_ARCH=1 --cflag=-Dmingw32_HOST_OS=1 --cflag=-D__GLASGOW_HASKELL__=800 '--cflag=-fno-stack-protector' '--cflag=-Wall' '--cflag=-Ilibraries/Win32/dist-install/build/autogen' '--cflag=-Ilibraries/Win32/include' '--cflag=-fno-strict-aliasing' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/libraries/bytestring/include' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/libraries/base/include' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/libraries/integer-gmp/include' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/rts/dist/build' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/includes' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/includes/dist-derivedconstants/header' '--cflag=-Werror=unused-but-set-variable' '--cflag=-Wno-error=inline' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/bytestring/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/deepseq/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/array/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/base/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/integer-gmp/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/ghc-prim/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/rts/dist/build' '--lflag=-lwsock32' '--lflag=-luser32' '--lflag=-lshell32' '--lflag=-lmsvcrt' '--lflag=-lmingw32' '--lflag=-lmingwex' '--lflag=-luser32' '--lflag=-lmingw32' '--lflag=-lmingwex' '--lflag=-lm' '--lflag=-ldl' '--lflag=-lwsock32' '--lflag=-lgdi32' '--lflag=-lwinmm' '--lflag=-lmingwex' --cflag=-Ilibraries/Win32/dist-install/build/autogen --cflag=-include --cflag=libraries/Win32/dist-install/build/autogen/cabal_macros.h   libraries/Win32/./Graphics/Win32/GDI/Types.hsc -o libraries/Win32/dist-install/build/Graphics/Win32/GDI/Types.hs</div></div></div></div></blockquote></div><blockquote><div>Types.hsc: In function ‘_hsc2hs_test44’:<br />Types.hsc:219:20: error: storage size of ‘test_array’ isn’t constant<br />...</div></blockquote><div> </div><div>15.11.2016, 19:06, "Ben Gamari" <ben@well-typed.com>:</div><blockquote type="cite"><blockquote> Second error:<br /><br />  rts/posix/GetTime.c:25:2: error: #error No implementation for getProcessCPUTime() available.<br />  #error No implementation for getProcessCPUTime() available.<br /><br /> In file there are such strings:<br /><br />  #if ! ((defined(HAVE_GETRUSAGE) && !irix_HOST_OS) || defined(HAVE_TIMES))<br />  #error No implementation for getProcessCPUTime() available.<br />  #endif<br /><br /> Linux definitely hasn't such function, it's a part of Windows API.</blockquote><p><br />getProcessCPUTime is a function provided by GHC's runtime system.<br /><br />I believe the issue here is that the build system (rts/ghc.mk) chooses<br />which implementation to use based upon the host operating system. This<br />seems wrong. Then again, if this is wrong I don't see how<br />cross-compilation ever actually worked. Surely I'm missing something<br />here.<br /><br />Cheers,<br /><br />- Ben</p></blockquote><div><br />It occures in phinal phase too, build command:</div><div><blockquote><div>/usr/bin/x86_64-w64-mingw32-gcc -E  -DPROFILING -DTHREADED_RTS -DDEBUG  -fno-stack-protector -Wall  -Wall -Wextra -Wstrict-prototypes  -Wmissing-prototypes  -Wmissing-declarations -Winline -Waggregate-return -Wpointer-arith -Wmissing-noreturn -Wnested-externs -Wredundant-decls  -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS -fno-strict-aliasing -fno-common -Irts/dist/build/autogen        -Werror=unused-but-set-variable -Wno-error=inline -O2 -fomit-frame-pointer -g -DRtsWay=\"rts_v\" -DWINVER=0x06000100     -MM -x c rts/posix/GetTime.c -MF rts/dist/build/.depend-v-p-l-debug-thr-thr_debug-thr_l-thr_p.c_asm.bit</div><div>rts/posix/GetTime.c:25:2: error: #error No implementation for getProcessCPUTime() available.</div><div> #error No implementation for getProcessCPUTime() available.</div></blockquote><div> </div><div>Moreover, when I tried to compile without -j8, I've got third error. It's strange, because make in multithreaded mode should wait for other tasks finish their work.</div><div><blockquote><div>"inplace/bin/hsc2hs" '--cc=/usr/bin/x86_64-w64-mingw32-gcc' '--ld=/usr/bin/x86_64-w64-mingw32-gcc'  --cross-safe  --cflag=-Wall --cflag=-fno-stack-protector   --cross-compile --cflag=-Dx86_64_HOST_ARCH=1 --cflag=-Dmingw32_HOST_OS=1 --cflag=-D__GLASGOW_HASKELL__=800 '--cflag=-fno-stack-protector' '--cflag=-Wall' '--cflag=-Ilibraries/Win32/dist-install/build/autogen' '--cflag=-Ilibraries/Win32/include' '--cflag=-fno-strict-aliasing' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/libraries/bytestring/include' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/libraries/base/include' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/libraries/integer-gmp/include' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/rts/dist/build' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/includes' '--cflag=-I/home/spirit/ghc/src/ghc-8.0.1/includes/dist-derivedconstants/header' '--cflag=-Werror=unused-but-set-variable' '--cflag=-Wno-error=inline' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/bytestring/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/deepseq/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/array/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/base/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/integer-gmp/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/libraries/ghc-prim/dist-install/build' '--lflag=-L/home/spirit/ghc/src/ghc-8.0.1/rts/dist/build' '--lflag=-lwsock32' '--lflag=-luser32' '--lflag=-lshell32' '--lflag=-lmsvcrt' '--lflag=-lmingw32' '--lflag=-lmingwex' '--lflag=-luser32' '--lflag=-lmingw32' '--lflag=-lmingwex' '--lflag=-lm' '--lflag=-ldl' '--lflag=-lwsock32' '--lflag=-lgdi32' '--lflag=-lwinmm' '--lflag=-lmingwex' --cflag=-Ilibraries/Win32/dist-install/build/autogen --cflag=-include --cflag=libraries/Win32/dist-install/build/autogen/cabal_macros.h   libraries/Win32/./System/Win32/SimpleMAPI.hsc -o libraries/Win32/dist-install/build/System/Win32/SimpleMAPI.hs</div><div>libraries/Win32/System/Win32/SimpleMAPI.hsc:52  MAPI_FORCE_DOWNLOAD</div><div>#ifdef MAPI_LOGOFF_SHARED</div><div>     is not an integer</div><div>libraries/Win32/ghc.mk:4: libraries/Win32/dist-install/build/.depend-v-p.haskell: No such file or directory</div></blockquote></div><div> </div></div><div> </div>