Sto costruendo un software che richiede nvcc
per la compilazione. Non ho una GPU compatibile con CUDA, ma in realtà non ne ho bisogno - un amico sta costruendo esattamente lo stesso software su Linux, non ha la GPU CUDA, ma va tutto bene.nvcc + c2hs su OS X 10.9.5
Ho installato il più recente toolkit CUDA da https://developer.nvidia.com/cuda-downloads (cuda_6.5.14_mac_64.pkg
) senza problemi. Ma mentre stavo costruendo il il software ho avuto problemi.
sono stato in grado di riprodurre il problema su scala più piccola:
$ 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
con la traccia in mano, sono stato in grado di andare più in profondità nella tana del coniglio:
$ /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)
non ho idea di come risolvere il problema. A proposito, sia clang
e gcc
vanno bene con macro passanti con argomenti via -D
.
Probabilmente rilevanti:
$ 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.
ho Intel Iris Pro 5100 (MBP retina 15" alla fine del 2013)
Mai usato zsh prima, potrebbe essere che in qualche modo sta espandendo (?) la linea di comando in un In modo inaspettato? Vale a dire che la parte ', mn,' sembra essere sparita. Forse provi con la preparazione di 'noglob' al tuo comando? –
Provato già, usato 'sh', purtroppo esattamente gli stessi risultati. – kgadek