Haskell platform cabal mallocPlainForeignPtrBytes issue

Posted on September 16, 2015

mallocPlainForeignPtrBytes: size must be >= 0 on Windows

The issue happens on Windows 8 and later when you run cabal install. The simplest solution is to set environment HTTP_PROXY and HTTPS_PROXY to a working proxy. For example in PowerShell you can run:

$env:HTTP_PROXY="http://yourproxy1"
$env:HTTPS_PROXY="http://yourproxy"

The root cause seems to be that on Windows 8 or later http library of Haskell cannot detect system proxy configuration anymore. See this issue for details.