In cmd.exe
,
> set CABAL="D:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin"
> cd %CABAL%
> cabal install hakyll
cabal: The program ghc version >=6.4 is required but it could not be found.
That didn't make sense as the Haskell Platform on this computer was newly installed:
> set GHC="D:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin"
> cd %GHC%
> ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
To find the reason,
> REM verbose, level=3
> cabal install hakyll -v3
searching for ghc in path.
Cannot find ghc on the path
cabal: The program ghc version >=6.4 is required but it could not be found.
Clearly the path hadn't been properly set.
Being too lazy to add %GHC%
and %CABAL%
to PATH environment variable,
I just made a soft link for cabal.exe
:
> REM in cmd (admin)
> cd %GHC%
> mklink cabal.exe %CABAL%\cabal.exe
cabal.exe <<===>> ...\cabal.exe
> cabal install hakyll
Resolving dependencies...
[1 of 1] Compiling Main ( D:\TEMP\pandoc-1.13.1-380\pandoc-1.13.1\Se
tup.hs, D:\TEMP\pandoc-1.13.1-380\pandoc-1.13.1\dist\setup\Main.o )
Linking D:\TEMP\pandoc-1.13.1-380\pandoc-1.13.1\dist\setup\setup.exe ...
Configuring pandoc-1.13.1...
setup.exe: The program ghc version >=6.4 is required but it could not be
found.
Failed to install pandoc-1.13.1
WTH?
How did I use GHC before? Actually I had
D:\!\Path
added to PATH, and created a dummy batch fileD:\!\Path\ghc.bat
which, whenever being called, would invokeghc.exe
by passing all the parameters around:@echo off "D:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin\ghc.exe" %*
Finally I had to add %GHC%
to PATH. However it still failed to compile:
src/Text/Pandoc/Shared.hs:808:55: Not in scope: ‘toChunks’
cabal: Error: some packages failed to install:
hakyll-4.5.5.0 depends on pandoc-1.13.1 which failed to install.
pandoc-1.13.1 failed during the building phase. The exception was:
ExitFailure 1
pandoc-citeproc-0.4.0.1 depends on pandoc-1.13.1 which failed to install.
A little googling brought me to this page.
So currently the workaround is cabal install hakyll pandoc-1.13.1 -fhttps
.
Aside: %APPDATA%\cabal\
on drive C:\
occupied approxiamtely 500MB disk size -- kind of expensive for my SSD. Hence I moved the whole cabal
folder to HDD and created a soft link:
> REM in cmd (admin)
> pushd `%APPDATA%\cabal\`
> mklink /D cabal D:\Bin\cabal
> pushd D:\Bin\cabal
> echo Moved from "%APPDATA%\cabal\" > README.txt
After compilation, you can find hakyll-init.exe
in %APPDATA%\cabal\bin
.
Yes I really hate adding these craps to PATH:
> REM in cmd (admin)
> mklink hakyll-init.exe %APPDATA%\cabal\bin\hakyll-init.exe
hakyll-init.exe <<===>> ...\hakyll-init.exe
It was able to create the site...
> set NOTES="PATH_TO_THE_FOLDER"
> hakyll-init %NOTES%
Creating ...
...and build the executable:
> ghc --make -threaded site.hs
[1 of 1] Compiling Main ( site.hs, site.o )
Linking site.exe ...
Why linking took several seconds to complete? Because it generated a gigantic executable site.exe
, which was larger than 60MB (significantly outweighted my tiny ./_site
).
> site build
Initialising...
...
Success
> site watch
...
http://127.0.0.1:8000/
Well, done.