2012-01-17 29 views
0

哈斯克爾我試圖使用Cygwin在Windows上安裝以下哈斯克爾包安裝CUDA:HaskellCuda使用的Autoconf Win7上

您可以使用「小集團安裝CUDA」安裝軟件包。

這裏的輸出我得到(你可能要「CUDA安裝c2hs」在前):

$ cabal install 
Configuring cuda-0.4.0.2... 
checking for gcc... C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe 
checking for C compiler default output file name... 
configure: error: C compiler cannot create executables 
See `config.log' for more details. 
Resolving dependencies... 
cabal.exe: Error: some packages failed to install: 
cuda-0.4.0.2 failed during the configure step. The exception was: 
ExitFailure 77 

相關部分從日誌文件是:

configure:1758: checking for gcc 
configure:1785: result: C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe 
configure:2022: checking for C compiler version 
configure:2029: C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe --version >&5 
configure: line 2030: C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe: command not found 
configure:2035: $? = 127 
configure:2042: C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe -v >&5 
configure: line 2043: C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe: command not found 
configure:2045: $? = 127 
configure:2052: C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe -V >&5 
configure: line 2053: C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe: command not found 
configure:2055: $? = 127 
configure:2078: checking for C compiler default output file name 
configure:2105: C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe -fno-stack-protector conftest.c >&5 
configure: line 2106: C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe: command not found 
configure:2108: $? = 127 
configure:2146: result: 
configure: failed program was: [source elided] 

如果我去Cygwin和

gcc --version 

我得到一些合理的東西。這個問題似乎更多與我猜想的路徑,但我不知道什麼/如何解決它。我還應該注意到,使用「cabal install cuda-0.2.2」這個軟件包的舊版本,我經歷了這個步驟(但是稍後得到一個不同的錯誤)。

要進行復制,請確保將Haskell Platform安裝在沒有空格的路徑中,否則您可能會得到不同的錯誤。這是我迄今爲止唯一想到的。

任何與此有關的幫助將非常感激,我已經花了大約一個星期到目前爲止,沒有得到任何地方。

編輯:

$PATH = C:\Haskell\2011.4.0.0\mingw\bin; 
C:\Haskell\2011.4.0.0\lib\extralibs\bin; 
C:\Haskell\2011.4.0.0\bin; 
C:\CUDA\v4.0\bin\; 
C:\cygwin\bin\; 
... 
+0

是否存在可執行文件「C:\ Haskell \ 2011.4.0.0 \ mingw \ bin \ gcc.exe」? – 2012-01-17 13:18:26

+0

是的。這也是我成功測試了--version的gcc副本。 – crockeea 2012-01-17 13:56:36

+0

如果您在Windows上使用FFI綁定,您確實需要使用MinGW/MSYS的正確安裝(而不是GHC附帶的迷你版本)。只有當你綁定到現有的DLL(如SDL)時,你才應該使用Cygwin。 – 2012-01-17 21:45:02

回答

0

我設法得到它來安裝,但它不是漂亮,我真的不明白爲什麼它不會出「的autoconf」框的工作。

對於初學者來說,而不是「小集團安裝」(使用本地副本)安裝,我使用的序列

>runhaskell Setup.hs configure 
>runhaskell Setup.hs build 
>runhaskell Setup.hs install 

造成這種情況的主要原因是因爲它是簡單的改變$ CC變量配置腳本使用Setup.hs中的參數。我懷疑$ CC是給我帶來問題的變量。我改變:

[("CC",  ccProg) 

[("CC",  "/cygdrive/c/cygwin/bin/gcc.exe") 

在Setup.hs,這是帶有Cygwin的海灣合作委員會。我最初的懷疑是autoconf不喜歡gcc的Windows風格路徑,它基於上面的日誌文件使用它。我還發現,儘管我的計算機上有多個gcc副本(一個在Haskell/mingw中,一個在單獨的mingw安裝中,無論哪個版本是$ PATH指向的),只有cygwin gcc能夠成功編譯測試文件該檢查。使用cygwin的GCC,我可以運行

gcc hello.c 

上,包括任何文件(無需外接include指令),而用gcc的任何其他副本,甚至像

gcc -I/cygdrive/c/..../include hello.c 

找不到。不知道爲什麼。不知道爲什麼。

只需將$ CC改爲Cygwin gcc就可以修復幾乎所有的錯誤。「檢查包含cudaRuntimeGetVersion/cuGetDriverVersion的庫」時發生了下一個錯誤。

配置該文件試圖編譯爲

#define PACKAGE_NAME "Haskell CUDA bindings" 
#define PACKAGE_TARNAME "cuda" 
#define PACKAGE_VERSION "0.4.0.0" 
#define PACKAGE_STRING "Haskell CUDA bindings 0.4.0.0" 
#define PACKAGE_BUGREPORT "[email protected]" 
#define STDC_HEADERS 1 
#define HAVE_SYS_TYPES_H 1 
#define HAVE_SYS_STAT_H 1 
#define HAVE_STDLIB_H 1 
#define HAVE_STRING_H 1 
#define HAVE_MEMORY_H 1 
#define HAVE_STRINGS_H 1 
#define HAVE_INTTYPES_H 1 
#define HAVE_STDINT_H 1 
#define HAVE_UNISTD_H 1 
#define HAVE_CUDA_H 1 
#define HAVE_CUDA_RUNTIME_API_H 1 
/* end confdefs.h. */ 

/* Override any GCC internal prototype to avoid an error. 
    Use char because int might match the return type of a GCC 
    builtin and then its argument prototype would still apply. */ 
#ifdef __cplusplus 
extern "C" 
#endif 
char cudaRuntimeGetVersion(); 
int main() 
{ 
return cudaRuntimeGetVersion(); 
; 
return 0; 
} 

使用命令:

/cygdrive/c/cygwin/bin/gcc.exe -o conftest.exe -fno-stack-protector 
-I/cygdrive/c/CUDA/v4.0/include -L/cygdrive/c/CUDA/v4.0/lib conftest.c -lcudart 

錯誤(從日誌文件)是

/cygdrive/c/Users/crockeea/AppData/Local/Temp/ccKMQJiq.o:conftest.c:(.text+0xc): 
undefined reference to `_cudaRuntimeGetVersion' 

我是在我的C上生鏽了,但它似乎沒有在這裏包含適當的頭文件。這可能是不對的,因爲在運行configure時,同一文件在基於Unix的系統上工作,但這是我最好的猜測。此外,編輯配置以使該文件包含cuda.h只會導致關於cudaRuntimeGetVersion的多個定義的不同錯誤。所以我的破解是在配置文件中引用cudaRuntimeGetVersion/cuGetDriverVersion的註釋。我將C註釋放入配置文件要編譯的C文件中(根據日誌文件中的行號,可以很容易地在配置文件中找到這些文件的源代碼)。我不知道以這種方式修改配置文件的後果。

這使我能夠超越'構建'階段。如果遇到任何其他問題,請發表更多評論。

+0

我追隨你的腳步,希望之後沒有更多的錯誤:D – 2014-09-25 07:32:02