Network-2.4.2.2 error cabal install on Windows

2019-02-19 09:30发布

问题:

When attempting to install the network package (cabal install network) on Windows Server 2008 inside of a cabal sandbox (1.18.*) I get the following error:

C:\Users\user\Project>cabal install network --prefix=C:\Users\user\Project
Resolving dependencies...
Configuring network-2.4.2.2...
configure: error: invalid package name: 0
Failed to install network-2.4.2.2
cabal: Error: some packages failed to install:
network-2.4.2.2 failed during the configure step. The exception was:
ExitFailure 1

Important to note that network is installed globally via the haskell platform, but won't install in the sandbox for a strange reason. The exact error looks like configure: error: invalid package name: 0

What could be prompting the package name to be 0?

回答1:

Use MinGHC, which provides binary installers for Windows with enough utilities that a standard cabal install can successfully install the network package.



回答2:

The problem is you are installing from the Windows command prompt, you should instead use a Mingw or Cygwin shell. I find it easiest to install using Cygwin, then running:

WHICHGHC=`which ghc` && PATH=`dirname $WHICHGHC`/../mingw/bin:$PATH && cabal install network --configure-option --host=i386-unknown-mingw32 --global --enable-library-profiling 

The full instructions, including alternative forms and feedback, are available on this blog post.