Bernard de la Paz <bernard.delapaz@yandex.ru> writes:
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 http://downloads.haskell.org/~ghc/8.0.1/ghc-8.0.1-src.tar.xz
cp mk/build.mk.example mk/build.mk
sed -i '1iBuildFlavour = perf' mk/build.mk
sed -i '1iStage1Only = YES' mk/build.mk
sed -i '1iHADDOCK_DOCS = NO' mk/build.mk
./configure --prefix=~/x86_64-mingw \
--target=x86_64-unknown-mingw32 \
--with-gcc=/usr/bin/x86_64-w64-mingw32-gcc \
--with-ld=/usr/bin/x86_64-w64-mingw32-ld \
--with-nm=/usr/bin/x86_64-w64-mingw32-nm \
--with-ar=/usr/bin/x86_64-w64-mingw32-ar \
--with-ranlib=/usr/bin/x86_64-w64-mingw32-ranlib
make -j8 install
First encountered error is in Types.hsc:
Types.hsc: In function ‘_hsc2hs_test44’:
Types.hsc:219:20: error: storage size of ‘test_array’ isn’t constant
In general it is helpful if you include a bit more context on where in
the build these errors ocurred. Is this during the stage1 build or
stage2? Just a few lines of the surrounding build output would be helpful.
===--- building final phasemake --no-print-directory -f ghc.mk phase=final all"rm" -f iserv/stage2_p/build/.depend.c_asm.tmp...checking dependency style of /usr/bin/x86_64-w64-mingw32-gcc... patching file ChangeLogpatching file configureHunk #8 succeeded at 29902 (offset 3 lines).Hunk #9 succeeded at 29974 (offset 3 lines).patching file gmp-h.in...chmod +x libraries/integer-gmp/gmp/ln..."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
Types.hsc: In function ‘_hsc2hs_test44’:
Types.hsc:219:20: error: storage size of ‘test_array’ isn’t constant
...
Second error:
rts/posix/GetTime.c:25:2: error: #error No implementation for getProcessCPUTime() available.
#error No implementation for getProcessCPUTime() available.
In file there are such strings:
#if ! ((defined(HAVE_GETRUSAGE) && !irix_HOST_OS) || defined(HAVE_TIMES))
#error No implementation for getProcessCPUTime() available.
#endif
Linux definitely hasn't such function, it's a part of Windows API.
getProcessCPUTime is a function provided by GHC's runtime system.
I believe the issue here is that the build system (rts/ghc.mk) chooses
which implementation to use based upon the host operating system. This
seems wrong. Then again, if this is wrong I don't see how
cross-compilation ever actually worked. Surely I'm missing something
here.
Cheers,
- Ben
/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.bitrts/posix/GetTime.c:25:2: error: #error No implementation for getProcessCPUTime() available.#error No implementation for getProcessCPUTime() available.
"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.hslibraries/Win32/System/Win32/SimpleMAPI.hsc:52 MAPI_FORCE_DOWNLOAD#ifdef MAPI_LOGOFF_SHAREDis not an integerlibraries/Win32/ghc.mk:4: libraries/Win32/dist-install/build/.depend-v-p.haskell: No such file or directory