err0r500/realworld-app-simple-haskell

Build fails on Windows

thma opened this issue · 3 comments

thma commented

while trying to build on windows I get the following error:

$ stack test
WARNING: Ignoring regex-posix's bounds on base (<0 && >=4.3 && <4.14); using base-4.13.0.0.
Reason: trusting snapshot over cabal file dependency information.
postgresql-libpq > configure
postgresql-libpq > [1 of 2] Compiling Main ( C:\Users\mahlerth\AppData\Local\Temp\stack-1f0b208227f3692c\postgresql-libpq-0.9.4.2\Setup.hs, C:\Users\mahlerth\AppData\Local\Temp\stack-1f0b208227f3692c\postgresql-libpq-0.9.4.2.stack-work\dist\29cc6475\setup\Main.o )
postgresql-libpq > [2 of 2] Compiling StackSetupShim ( C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\Users\mahlerth\AppData\Local\Temp\stack-1f0b208227f3692c\postgresql-libpq-0.9.4.2.stack-work\dist\29cc6475\setup\StackSetupShim.o )
postgresql-libpq > Linking C:\Users\mahlerth\AppData\Local\Temp\stack-1f0b208227f3692c\postgresql-libpq-0.9.4.2\.stack-work\dist\29cc6475\setup\setup.exe ...
postgresql-libpq > Configuring postgresql-libpq-0.9.4.2...
postgresql-libpq > setup.exe: The program 'pg_config' is required but it could not be found.
postgresql-libpq >
regex-posix > configure
regex-posix > Configuring regex-posix-0.96.0.0...
regex-posix > build
regex-posix > Preprocessing library for regex-posix-0.96.0.0..
regex-posix > C:\Users\mahlerth\AppData\Local\Temp\stack-1f0b208227f3692c\regex-posix-0.96.0.0\Wrap.hsc:96:10: fatal error: regex.h: No such file or directory
regex-posix > compilation terminated.
regex-posix > compiling .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.c failed (exit code 1)
regex-posix > command was: C:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2\lib../mingw/bin\gcc.exe -c .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.c -o .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.o -D__GLASGOW_HASKELL__=808 -Dmingw32_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dmingw32_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Icbits -IC:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -I.stack-work\dist\29cc6475\build\cbits -IC:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -I.stack-work\dist\29cc6475\build\autogen -I.stack-work\dist\29cc6475\build\global-autogen -include .stack-work\dist\29cc6475\build\autogen\cabal_macros.h -IC:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2\lib\bytestring-0.10.10.0\include -IC:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2\lib\base-4.13.0.0\include -IC:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2\lib\integer-gmp-1.0.2.0\include -IC:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2\lib/include -IC:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2/lib/include/

-- While building package regex-posix-0.96.0.0 using:
C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.2.exe --builddir=.stack-work\dist\29cc6475 build --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1

-- While building package postgresql-libpq-0.9.4.2 using:
C:\Users\mahlerth\AppData\Local\Temp\stack-1f0b208227f3692c\postgresql-libpq-0.9.4.2.stack-work\dist\29cc6475\setup\setup --builddir=.stack-work\dist\29cc6475 configure --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\10ebef16\pkgdb --libdir=C:\sr\snapshots\10ebef16\lib --bindir=C:\sr\snapshots\10ebef16\bin --datadir=C:\sr\snapshots\10ebef16\share --libexecdir=C:\sr\snapshots\10ebef16\libexec --sysconfdir=C:\sr\snapshots\10ebef16\etc --docdir=C:\sr\snapshots\10ebef16\doc\postgresql-libpq-0.9.4.2 --htmldir=C:\sr\snapshots\10ebef16\doc\postgresql-libpq-0.9.4.2 --haddockdir=C:\sr\snapshots\10ebef16\doc\postgresql-libpq-0.9.4.2 --dependency=Cabal=Cabal-3.0.1.0 --dependency=Win32=Win32-2.6.1.0 --dependency=base=base-4.13.0.0 --dependency=bytestring=bytestring-0.10.10.0 -f-use-pkg-config --extra-include-dirs=C:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include --extra-lib-dirs=C:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\lib --extra-lib-dirs=C:\Users\mahlerth\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\bin --exact-configuration --ghc-option=-fhide-source-paths
Process exited with code: ExitFailure 1
Progress 2/8

Hi,
Yes, sorry, I didn't list system dependencies.

In my Dockerfile (not committed), I have to add these libs :

RUN dnf install ghc-pcre-light pcre-devel -y
RUN dnf install libpq-devel -y

I don't know how to get that on windows, a Dockerfile would be OK for you ?

thma commented

Yes, dockerfile is OK.
But I prefer to work natively under windows...

It has been a long wait, but dockerized version is now available ;)
I'll close this issue, feel free to reopen it if you still have problems