【问题标题】:Install CUDA for Haskell using Autoconf on Win7在 Win7 上使用 Autoconf 安装 CUDA for Haskell
【发布时间】:2012-02-11 23:39:21
【问题描述】:

我正在尝试使用 Cygwin 在 Windows 上安装以下 Haskell 包:HaskellCuda

您可以使用“cabal install cuda”安装该软件包。

这是我得到的输出(您可能必须先“cuda install 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 平台安装在没有空格的路径中,否则您可能会收到不同的错误。到目前为止,这是我唯一想到的。

非常感谢您对此的任何帮助,到目前为止,我已经花了大约一周的时间,但还没有得到任何帮助。

编辑:

$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\;
...

【问题讨论】:

  • 可执行文件“C:\Haskell\2011.4.0.0\mingw\bin\gcc.exe”是否存在?
  • 是的。这也是我成功测试 --version 的 gcc 副本。
  • 如果您在 Windows 上使用 FFI 绑定,您真的想使用正确安装的 MinGW / MSYS(不是 GHC 附带的迷你版本)。仅当您绑定到现有的 DLL(如 SDL)时,您才应该使用 Cygwin。
  • 您指的是我正在使用的实际 gcc.exe 文件吗?就像我说的,Haskell 附带的副本支持 --version 命令。另外,我不知道如何告诉 autoconf 使用不同的 gcc.exe。

标签: haskell cuda autoconf


【解决方案1】:

我设法安装了它,但它并不漂亮,而且我真的不明白为什么它在“autoconf”框中不起作用。

对于初学者,我没有使用“cabal install”(使用本地副本)进行安装,而是使用了顺序

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

这样做的主要原因是使用 Setup.hs 中的参数更改配置脚本中的 $CC 变量很简单。我怀疑 $CC 是给我带来问题的变量。我改变了:

[("CC",       ccProg)

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

在Setup.hs中,这是Cygwin自带的gcc。我最初的怀疑是 autoconf 不喜欢 Windows 样式的 gcc 路径,它基于上面的日志文件使用。我还发现,虽然我的计算机上有多个 gcc 副本(一个在 Haskell/mingw 中,一个在单独安装的 mingw 中,无论 $PATH 指向哪个版本,只有 cygwin gcc 能够成功编译测试文件检查了。使用 cygwin gcc,我可以运行

gcc hello.c

在任何包含的文件上(没有外部包含指令),而对于任何其他 gcc 副本,甚至类似

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

找不到。不知道为什么。

只需将 $CC 更改为 Cygwin gcc 即可修复几乎所有错误。 “检查包含 cudaRuntimeGetVersion/cuGetDriverVersion 的库”时发生下一个错误。

configure 试图编译的文件是

#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 "tmcdonell@cse.unsw.edu.au"
#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-cmets 放入配置文件将要编译的 C 文件中(根据日志文件中的行号,很容易在配置文件中找到这些文件的源代码)。不知道这样修改configure文件的后果。

这让我度过了“构建”阶段。如果我遇到任何其他问题,请添加更多 cmets。

【讨论】:

  • 我正在追随你的脚步,希望之后不再有错误:D
猜你喜欢
  • 2019-08-04
  • 1970-01-01
  • 2014-04-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-13
  • 1970-01-01
相关资源
最近更新 更多