Homebrew 解决CUDA 与 OpenCV的 C++不一样的问题


5

I have a solution! I am on a 2013 Macbook Pro with Nvidia 750m. Here are the simple steps I used to get everything to work properly:

  1. Install Homebrew if you haven't already
  2. Install the CUDA toolkit
  3. In your terminal, type brew edit opencv
  4. Change option '32-bit' to option '64-bit' if on a 64-bit machine (I'm not sure if this really helps anything)
  5. In the list of arguments (args = std_cmake_args + %W[ ... ]) add the following argument:
    -DCMAKE_CXX_FLAGS:STRING='-stdlib=libstdc++'
  6. Run brew install opencv
  7. When compiling the homework's, don't forget to add the -stdlib=libstdc++ flag to clang (g++ is just an alias for clang on os x 10.9) to link the old stdlib.

This is necessary because os x 10.9 includes two versions of the stdlib. libc++ is a new implementation of the C++ standard library targeting c++11, whereas libstdc++ is the old implementation that the cuda goodies are compiled with. If you don't compile opencv with the old library, you'll have some issues.

I've had no trouble compiling the homework's using nsight by creating makefile projects. Just don't forget to add cuda's bin folder's path to your path in nsight.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值