2014-09-30 7 views
6

나는 소프트웨어 인을 작성 중이므로 편집하려면 nvcc이 필요합니다. 저는 CUDA 지원 GPU를 가지고 있지 않지만 사실은 그럴 필요가 없습니다. 친구가 정확히 소프트웨어 인을 리눅스에 설치하고 있다면 그는 CUDA GPU가 없지만 모든 것이 정상입니다.OS X 10.9.5의 nvcc + c2hs

https://developer.nvidia.com/cuda-downloads (cuda_6.5.14_mac_64.pkg)의 최신 CUDA 툴킷을 문제없이 설치했습니다. 그러나 제가 구축 한대로 소프트웨어에 문제가 생겼습니다. 나는 토끼 구멍에 깊이 갈 수 있었다 손에 추적으로

$ mkdir temp; cd temp; cabal sandbox init 


$ cabal get cuda 
Unpacking to cuda-0.6.5.0/ 


$ cd cuda-0.6.5.0/Foreign/CUDA/Analysis 


$ c2hs -d trace --cpp=/Developer/NVIDIA/CUDA-6.5/bin/nvcc --cppopts=-ccbin --cppopts=/usr/bin/clang --cppopts=-Xcompiler --cppopts=--stdlib=libstdc++ Device.chs 
Attempting to read file `Device.chs'... 
...parsing `Device'... 
...successfully loaded `Device'. 
Invoking cpp as `/Developer/NVIDIA/CUDA-6.5/bin/nvcc -E -x c -ccbin /usr/bin/clang -Xcompiler --stdlib=libstdc++ -U__BLOCKS__ -DC2HS_MIN_VERSION(mj,mn,rv)=(mj<=0&&mn<=18&&rv<=2) Device.chs.h'... 
In file included from <built-in>:170: 
<command line>:3:29: error: expected comma in macro parameter list 
#define C2HS_MIN_VERSION(mj 1 
          ^
<command line>:5:11: warning: ISO C99 requires whitespace after the macro name [-Wc99-extensions] 
#define rv) (mj<=0&&mn<=18&&rv<=2) 
     ^
Device.chs.h:1:10: fatal error: 'cbits/stubs.h' file not found 
#include "cbits/stubs.h" 
     ^
1 warning and 2 errors generated. 
c2hs: Error during preprocessing custom header file 

:

나는 작은 규모에 문제를 재현 할 수 있었다

$ /Developer/NVIDIA/CUDA-6.5/bin/nvcc -E -x c -ccbin /usr/bin/clang -Xcompiler --stdlib=libstdc++ -U__BLOCKS__ -DC2HS_MIN_VERSION(mj,mn,rv)=(mj<=0&&mn<=18&&rv<=2) Device.chs.h 
zsh: parse error near `)' 


$ /Developer/NVIDIA/CUDA-6.5/bin/nvcc -E -x c -ccbin /usr/bin/clang -Xcompiler --stdlib=libstdc++ -U__BLOCKS__ -D'C2HS_MIN_VERSION(mj,mn,rv)=(mj<=0&&mn<=18&&rv<=2)' Device.chs.h 
# 1 "Device.chs.h" 
# 1 "<built-in>" 1 
# 1 "<built-in>" 3 
# 170 "<built-in>" 3 
# 1 "<command line>" 1 
In file included from <built-in>:170: 
<command line>:3:29: error: expected comma in macro parameter list 
#define C2HS_MIN_VERSION(mj 1 
          ^
<command line>:5:11: warning: ISO C99 requires whitespace after the macro name [-Wc99-extensions] 
#define rv) (mj<=0&&mn<=18&&rv<=2) 
     ^
# 1 "<built-in>" 2 
# 1 "Device.chs.h" 2 
Device.chs.h:1:10: fatal error: 'cbits/stubs.h' file not found 
#include "cbits/stubs.h" 
     ^

1 warning and 2 errors generated. 


$ Developer/NVIDIA/CUDA-6.5/bin/nvcc -x c -D 'C2HS_MIN_VERSION(mj,mn,rv)=(mj<=0&&mn<=18&&rv<=2)' Device.chs.h 
(same issue) 

나는 어떤이 없습니다 그 문제를 해결하는 방법. 그런데 clanggcc은 모두 매크로를 인수로 사용하여 -D으로 전달할 수 있습니다.

아마 관련 :

$ echo $PATH 
/Users/konrad/bin:/Users/konrad/.ghc-current/bin:/Users/konrad/.cabal/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Developer/NVIDIA/CUDA-6.5/bin 

$ echo $DYLD_LIBRARY_PATH 
/Developer/NVIDIA/CUDA-6.5/lib: 

$ echo $LD_LIBRARY_PATH 
/usr/local/cuda/lib: 

$ ghc --version 
The Glorious Glasgow Haskell Compilation System, version 7.8.3 

$ cabal --version 
cabal-install version 1.20.0.3 
using version 1.20.0.0 of the Cabal library 

$ c2hs --version 
C->Haskell Compiler, version 0.18.2 The shapeless maps, 31 Oct 2014 
    build platform is "x86_64-darwin" <1, True, True, 1> 

$ gcc --version 
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn) 
Target: x86_64-apple-darwin13.4.0 
Thread model: posix 

$ gcc-4.9 --version 
gcc-4.9 (GCC) 4.9.0 20140411 (prerelease) 
Copyright (C) 2014 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

나는 ("2013 년 말 MBP 망막 15) 인텔 아이리스 프로 5100이

+0

전에 zsh를 사용하지 않았습니까? n 예상치 못한 방식으로? 즉,','mn '부분이 사라진 것처럼 보입니다. 어쩌면 명령에'noglob '를 붙이려 고 시도 할까? –

+0

이미'sh'를 사용해 보았습니다. 불행히도 똑같은 결과입니다. – kgadek

답변

2

으로 https://github.com/haskell/c2hs/issues/111 당, 변화가 c2hs HEAD에 밀려 년 11 월 21 일에 해결할 수 있습니다. 이 문제는 nvcc의 업스트림 버킷 때문에 발생 했으므로 최신 c2hs을 사용해야합니다.

+0

감사합니다. 곧 다시 시도하겠습니다! – kgadek