【问题标题】:compilation error with nvcc and BOOST library编译错误 nvcc 和 BOOST 库
【发布时间】:2012-01-22 03:04:51
【问题描述】:

nvcc 抛出

/usr/include/boost/concept/detail/has_constraints.hpp:29: error: ‘&’ cannot appear in a constant-expression
/usr/include/boost/concept/detail/has_constraints.hpp:29: error: template argument 2 is invalid

has_constraints.hpp 中已经有一些可疑代码:

#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
  // Work around the following bogus error in Sun Studio 11, by
  // turning off the has_constraints function entirely:
  //    Error: complex expression not allowed in dependent template
  //    argument expression
  inline no has_constraints_(...);
#else
  template <class Model>
  inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
  inline no has_constraints_(...);
#endif

问题:这是 nvcc boost 不兼容还是我的代码有问题?

【问题讨论】:

  • 其实这可能是你要找的更多:forums.nvidia.com/index.php?showtopic=150025
  • nvcc: NVIDIA (R) Cuda 编译器驱动程序 版权所有 (c) 2005-2010 NVIDIA Corporation 构建于 Wed_Nov__3_16:16:57_PDT_2010 Cuda 编译工具,版本 3.2,V0.2.1221
  • g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3
  • 我不断遇到同样的建议:forums.nvidia.com/index.php?showtopic=215470“boost 和 nvcc 存在一个已知的兼容性问题。解决方法是拆分源代码,以便您使用 nvcc 和使用主机编译器提升代码。”如果有更新的版本(有 gcc 版本)并且您有机会对其进行测试,我会尝试的。否则,也许坚持建议。

标签: c++ boost cuda nvcc


【解决方案1】:

为什么在“Model::constraints”之前有“&”?我认为这就是问题所在。 (// 显然不是)

编辑:

http://forums.nvidia.com/index.php?showtopic=182890 讨论这个问题并解决一些黑客问题

http://forums.nvidia.com/index.php?showtopic=150025

EDIT2:

好吧,在跑了一段时间之后,这就是我坚持的:

http://forums.nvidia.com/index.php?showtopic=215470 "boost 和 nvcc 存在一个已知的兼容性问题。解决方法是拆分源代码,以便您使用 nvcc 编译 cuda 代码,使用主机编译器编译 boost 代码。"作者:Justin Luitjens 在集团中:NVIDIA 员工

试试看,如果不行,单独编译,然后链接。

【讨论】:

  • @Michael 嗯,我会查一下。
  • @Michael .. 好的,我明白了。 boost.org/doc/libs/1_48_0/boost/concept/detail/… 是否需要任何编译器选项?
  • 有很多编译器选项。你在寻找什么具体的东西吗?
  • 嗯,我去看看链接
【解决方案2】:

我这里有一个补丁http://code.google.com/p/asadchev/source/browse/trunk/projects/boost/boost-1.46.0.nvcc.patch

也许您可以看到更改的内容并同样修复您的代码

请注意,类似 gcc 和类似 egg 的编译器部分都可以看到源代码。

【讨论】:

    【解决方案3】:

    我们最后所做的是关闭 has_constraints_ ,如 Sun Studio 11 问题中引用的示例所示

    【讨论】:

      猜你喜欢
      • 2016-03-24
      • 1970-01-01
      • 2016-02-25
      • 1970-01-01
      • 2012-10-20
      • 1970-01-01
      • 2011-10-01
      • 2018-03-09
      • 2016-03-20
      相关资源
      最近更新 更多