我尝试在我的Mac OSX 10.8.3上使用CMake编译一个简单的CUDA“Hello World”。CUDA 5.0,CMake和Make在OSX上失败10.8.3
调用cmake .
似乎成功。这里是我的CMakeList.txt
:
project(HelloWorld)
cmake_minimum_required(VERSION 2.8)
FIND_PACKAGE(CUDA)
CUDA_INCLUDE_DIRECTORIES(/Developer/NVIDIA/CUDA-5.0/samples/common/inc)
CUDA_ADD_EXECUTABLE(helloWorld helloWorld.cu)
...和输出:
-- The C compiler identification is Clang 4.2.0
-- The CXX compiler identification is Clang 4.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found CUDA: /Developer/NVIDIA/CUDA-5.0 (found version "5.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mennny/Documents/UNI/6_Semester/0_PMPP/1_exercises/cuda-hello-world
但调用make
后失败,出现以下错误(S):
[100%] Building NVCC (Device) object CMakeFiles/helloWorld.dir//./helloWorld_generated_helloWorld.cu.o
clang: error: unsupported option '-dumpspecs'
clang: error: no input files
CMake Error at helloWorld_generated_helloWorld.cu.o.cmake:206 (message): Error generating /Users/mennny/Documents/UNI/6_Semester/0_PMPP/1_exercises/cuda-hello-world/CMakeFiles/helloWorld.dir//./helloWorld_generated_helloWorld.cu.o
make[2]: *** [CMakeFiles/helloWorld.dir/./helloWorld_generated_helloWorld.cu.o] Error 1
make[1]: *** [CMakeFiles/helloWorld.dir/all] Error 2
make: *** [all] Error 2
我GOOGLE所示错误,但找不到任何足够的答案。 任何想法为什么make
失败,但cmake
成功。
感谢您的帮助。
您的代码不适用于我。但是从技术上说''CUDA_HOST_COMPILER'设置为'/ usr/bin/gcc'是正确的答案。调用'cmake。 -DCUDA_HOST_COMPILER:FILEPATH =/usr/bin/gcc'与我显示的'CMakeList.txt'起作用。谢谢! – Mennny 2013-04-30 08:41:48