夜行録 - 酔歩.net

日暮れて道遠し さらに夜道を行く もって夜行録と名付く

OSX CUDA 問題

OSX でコンパイラが clang になったあたりから、 CUDA のコードで Boost をインクルードすると容赦なくコケるという事態になって、手に負えなくて放置していた件。今調べてみると、やっと解決していた。 MacPorts の Boost も、やっとこの修正を含む 1.57 になった。

https://svn.boost.org/trac/boost/ticket/10694 https://svn.boost.org/trac/boost/ticket/10418

あーでも、 nvcc が clang を -stdlib=libstdc++ で叩いているので libc++ を要求している boost とは相変わらず衝突しているくさいな。

/opt/local/include/boost/type_traits/is_abstract.hpp(72): error: identifier "__is_abstract" is undefined

/opt/local/include/boost/type_traits/is_abstract.hpp(72): error: function call is not allowed in a constant expression

/opt/local/include/boost/type_traits/is_abstract.hpp(72): error: type name is not allowed

/opt/local/include/boost/type_traits/is_enum.hpp(180): error: identifier "__is_enum" is undefined

/opt/local/include/boost/type_traits/is_enum.hpp(180): error: function call is not allowed in a constant expression

/opt/local/include/boost/type_traits/is_enum.hpp(180): error: type name is not allowed

/opt/local/include/boost/type_traits/is_class.hpp(112): error: identifier "__is_class" is undefined

/opt/local/include/boost/type_traits/is_class.hpp(112): error: function call is not allowed in a constant expression

/opt/local/include/boost/type_traits/is_class.hpp(112): error: type name is not allowed

/opt/local/include/boost/type_traits/is_base_and_derived.hpp(228): error: identifier "__is_base_of" is undefined

/opt/local/include/boost/type_traits/is_base_and_derived.hpp(228): error: function call is not allowed in a constant expression

/opt/local/include/boost/type_traits/is_base_and_derived.hpp(228): error: type name is not allowed

/opt/local/include/boost/type_traits/is_base_and_derived.hpp(228): error: type name is not allowed

/opt/local/include/boost/type_traits/is_polymorphic.hpp(111): error: identifier "__is_polymorphic" is undefined

/opt/local/include/boost/type_traits/is_polymorphic.hpp(111): error: function call is not allowed in a constant expression

/opt/local/include/boost/type_traits/is_polymorphic.hpp(111): error: type name is not allowed

/opt/local/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(49): warning: "cc" clobber ignored

/opt/local/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(65): warning: "cc" clobber ignored

/opt/local/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(91): warning: "cc" clobber ignored

/opt/local/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

/opt/local/include/boost/type_traits/has_trivial_constructor.hpp(28): error: identifier "__has_trivial_constructor" is undefined

/opt/local/include/boost/type_traits/has_trivial_constructor.hpp(28): error: function call is not allowed in a constant expression

/opt/local/include/boost/type_traits/has_trivial_constructor.hpp(28): error: type name is not allowed

/opt/local/include/boost/type_traits/has_trivial_destructor.hpp(28): error: identifier "__has_trivial_destructor" is undefined

/opt/local/include/boost/type_traits/has_trivial_destructor.hpp(28): error: function call is not allowed in a constant expression

/opt/local/include/boost/type_traits/has_trivial_destructor.hpp(28): error: type name is not allowed

云々というのが1番目のもの

こっちは未解決

#$ clang++ -stdlib=libstdc++ -m64 -o "test_unit1"  -Xlinker -force_load  -Xlinker "/usr/local/cuda/bin/../lib/libcudart_static.a" "/var/folders/k2/crc7tsdx0yx1bgbrntyr67pw0000gn/T//tmpxft_00004c29_00000000-4_test_unit1_dlink.o" "test_unit1.o" -L"/opt/local/lib" -L"." -lpthread -lcublas -lcudaParticles -lboost_serialization-mt   "-L/usr/local/cuda/bin/../lib" -lcudadevrt  -Xlinker -rpath  -Xlinker /usr/local/cuda/lib  -Xlinker -framework  -Xlinker CoreFoundation 
Undefined symbols for architecture x86_64:
  "boost::archive::basic_binary_iprimitive >::init()", referenced from:
      boost::archive::binary_iarchive_impl >::binary_iarchive_impl(std::istream&, unsigned int) in test_unit1.o
  "boost::archive::basic_binary_iprimitive >::basic_binary_iprimitive(std::basic_streambuf >&, bool)", referenced from:
      boost::archive::binary_iarchive_impl >::binary_iarchive_impl(std::istream&, unsigned int) in test_unit1.o
  "boost::archive::basic_binary_iprimitive >::~basic_binary_iprimitive()", referenced from:
      _main in test_unit1.o
      boost::archive::binary_iarchive::~binary_iarchive() in test_unit1.o
      boost::archive::binary_iarchive_impl >::binary_iarchive_impl(std::istream&, unsigned int) in test_unit1.o
      boost::archive::binary_iarchive::~binary_iarchive() in test_unit1.o
      boost::archive::binary_iarchive_impl >::~binary_iarchive_impl() in test_unit1.o
      boost::archive::binary_iarchive_impl >::~binary_iarchive_impl() in test_unit1.o
  "boost::archive::basic_binary_oprimitive >::init()", referenced from:
      boost::archive::binary_oarchive_impl >::binary_oarchive_impl(std::ostream&, unsigned int) in test_unit1.o
  "boost::archive::basic_binary_oprimitive >::save(std::string const&)", referenced from:
      boost::archive::basic_binary_oarchive::save_override(boost::archive::class_name_type const&, int) in test_unit1.o
  "boost::archive::basic_binary_oprimitive >::basic_binary_oprimitive(std::basic_streambuf >&, bool)", referenced from:
      boost::archive::binary_oarchive_impl >::binary_oarchive_impl(std::ostream&, unsigned int) in test_unit1.o
  "boost::archive::basic_binary_oprimitive >::~basic_binary_oprimitive()", referenced from:
      _main in test_unit1.o
      boost::archive::binary_oarchive::~binary_oarchive() in test_unit1.o
      boost::archive::binary_oarchive_impl >::binary_oarchive_impl(std::ostream&, unsigned int) in test_unit1.o
      boost::archive::binary_oarchive::~binary_oarchive() in test_unit1.o
      boost::archive::binary_oarchive_impl >::~binary_oarchive_impl() in test_unit1.o
      boost::archive::binary_oarchive_impl >::~binary_oarchive_impl() in test_unit1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
2014年12月29日 (Mon) - 23:11:46 - その他雑記 - 3963x - permalink
Karma points: -2. Do you like this article? [yes/no]