无法在OS X下编译CUDA驱动程序API示例

Can't compile CUDA driver api sample under OS X

本文关键字:CUDA 驱动程序 API 示例 编译 OS      更新时间:2023-10-16

我正在尝试编译使用 nvidia cuda 驱动程序 API 的代码,但编译返回以下错误:

g++ -fPIC -o exec helloWorldDriverAPI.cpp.o -lcuda
ld: library not found for -lcuda
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [exec] Error 1

这是我遇到问题的示例代码:https://github.com/mciancia/CUDA-Driver-api

尝试手动指向库文件夹,但它对我不起作用。

另外,我在 Linux 下编译此代码没有任何问题。我在OS x 750和最新驱动程序(6.5)下使用带有nvidia 10.10m的Macbook

这在其他地方得到了回答,复制了这里的答案以将其从未回答列表中删除:

您需要添加库的位置。生成文件中的LIB_CUDA变量应为:

LIB_CUDA := -L/usr/local/cuda/lib -lcuda