2016-07-25 68 views
0

我剛剛安裝了一個新的Haskell版本:HaskellPlatform-8.0.1-minimal-x86_64-setup-a, 我需要包MissingH,它需要包網絡。 但是CABAL安裝網絡收益率:未通過cabal安裝MissingH和Windows上的網絡

$ cabal install network 
Resolving dependencies... 
cabal: Entering directory 'C:\cygwin64\tmp\cabal-tmp-6136\network-2.6.2.1' 
Configuring network-2.6.2.1... 
configure: WARNING: unrecognized options: --with-compiler 
checking build system type... x86_64-unknown-cygwin 
checking host system type... x86_64-unknown-cygwin 
checking for gcc... C:\PROGRA~1\HASKEL~1\802E01~1.1\mingw\bin\gcc.exe 
checking whether the C compiler works... no 
configure: error: in `/tmp/cabal-tmp-6136/network-2.6.2.1': 
configure: error: C compiler cannot create executables 
See `config.log' for more details 
cabal: Leaving directory 'C:\cygwin64\tmp\cabal-tmp-6136\network-2.6.2.1' 
Failed to install network-2.6.2.1 
cabal.exe: Error: some packages failed to install: 
network-2.6.2.1 failed during the configure step. The exception was: 
ExitFailure 77 

首先,我試圖啓動Cygwin的命令窗口以管理員身份,但這並沒有解決問題。 於是,我跟着stack cannot build network - where's config.log?

在使用堆棧產量的成功, 雖然要運行堆棧設置

$ stack build 
Compiler version mismatched, found ghc-8.0.1 (x86_64), but expected minor version match with ghc-7.10.3 (x86_64) (based on resolver setting in C:\tmp\network-2.6.2.1\stack.yaml). 
Try running "stack setup" to install the correct GHC into C:\Users\<username>\AppData\Local\Programs\stack\x86_64-windows\ 
堆棧設置,組構造後

安裝,我得到:

$ stack test 
network-2.6.2.1: test (suite: regression) 

testGetAddrInfo: [OK] 

     Test Cases Total 
Passed 1   1 
Failed 0   0 
Total 1   1 

network-2.6.2.1: test (suite: simple) 

Basic socket operations: 
    testSend: [OK] 
    testSendAll: [OK] 
    testSendTo: [OK] 
    testSendAllTo: [OK] 
    testSendMany: [OK] 
    testSendManyTo: [OK] 
    testRecv: [OK] 
    testOverFlowRecv: [OK] 
    testRecvFrom: [OK] 
    testOverFlowRecvFrom: [OK] 
    testUserTimeout: [OK] 

     Test Cases Total 
Passed 11   11 
Failed 0   0 
Total 11   11 

然而,我仍然不能繼續MissingH。實際上,它仍然試圖安裝網絡!

$ cabal install MissingH 
Resolving dependencies... 
cabal: Entering directory 'C:\cygwin64\tmp\cabal-tmp-5596\network-2.6.2.1' 
Configuring network-2.6.2.1... 
configure: WARNING: unrecognized options: --with-compiler 
checking build system type... x86_64-unknown-cygwin 
checking host system type... x86_64-unknown-cygwin 
checking for gcc... C:\PROGRA~1\HASKEL~1\802E01~1.1\mingw\bin\gcc.exe 
checking whether the C compiler works... no 
configure: error: in `/tmp/cabal-tmp-5596/network-2.6.2.1': 
configure: error: C compiler cannot create executables 
See `config.log' for more details 
cabal: Leaving directory 'C:\cygwin64\tmp\cabal-tmp-5596\network-2.6.2.1' 
Failed to install network-2.6.2.1 

我也試過:http://neilmitchell.blogspot.nl/2010/12/installing-haskell-network-library-on.html這是在GHC 6.12.3和7.0.1測試(而不是在新的8.0.1版本)。 不幸的是,我得到的錯誤:

getEnv: invalid argument (The operation completed successfully.) 

只是爲了保持完整性,我的陰謀版本:

$ cabal -V 
cabal-install version 1.24.0.0 
compiled using version 1.24.0.0 of the Cabal library 

我缺少的是安裝網絡和MissingH?

+0

堆棧將組件安裝到〜/ .stack/snapshots/...這不是cabal尋找東西的地方。也許你最好爲你的工作創建一個.cabal文件並使用堆棧來構建它。教程可用[這裏](https://github.com/commercialhaskell/stack/blob/master/doc/GUIDE.md#hello-world-example) – ErikR

回答

0

堆棧做了一些假設你的設置,noteably:

  • ...它的系統
  • 上唯一的一個管理包......它的系統
  • 上唯一一個管理GHC
  • ...,它是唯一一個系統
  • 上管理的陰謀......每一個項目是沙箱
  • ...,你寧願有穩定性和可預見性比的每一個最新版本東西

你可以放棄與「普通」工具一起使用堆棧 - 但只能在不同的項目中,如果你真的很小心。諸如不同版本的cabal-install之類的東西仍然可能會導致故障。同時它保持自己的數據分離,所以通過堆棧安裝任何東西都是不可見的。因此,您有兩種選擇:要麼將您的項目完全買入堆棧,要麼完全拋棄。

如果你想使用它,只需添加MissingH到你的.cabal文件並重建,一切都應該沒問題。如果錯誤彈出,最簡單的解決方法是清除本地cabal版本庫並重試。如果這不起作用,請清除整個平臺並讓堆棧自行重新安裝,然後重試。 Stack是一個挑剔的女歌手,但是一旦她登臺,她就會運行它。提示:如果您喜歡cabal界面,但選擇使用堆棧,則可以始終運行諸如stack exec -- cabal install MissingH之類的內容。

另一種選擇是完全排列堆棧。卸載它並單獨使用cabal,可能還有沙箱。這仍然會讓您看到原始問題 - 這看起來像是本地庫,您不得不單獨安裝。我不知道在這個特定情況下哪一個,但我可以給你一些提示在哪裏看。如果您找不到關於它的文檔,可以查看堆棧文件。 (畢竟他們是成功的)但最簡單的方法是查看cygwin安裝的網絡庫,並安裝它們的-dev版本。他們幾乎總是正確的。

0

的問題似乎是這樣的

configure: error: in `/tmp/cabal-tmp-6136/network-2.6.2.1':

configure: error: C compiler cannot create executables

要麼你沒有安裝C編譯器或它太舊。 我們實際上並不支持Cygwin,請嘗試安裝msys2(實際上現在沒有平臺與此相配?)並通過它進行編譯。

你將不得不安裝一個C編譯器以及pacman -S mingw-w64-$(uname -m)-gcc應該做的。我認爲./configure腳本將無法檢測到GHC的就地GCC。不確定,因爲我有一段時間沒有使用過平臺。