未定义符号在Mac OS X编译具有升压,GMP,和OpenMP [英] Undefined symbols compiling in Mac OS X with Boost, GMP, and OpenMP

查看:310
本文介绍了未定义符号在Mac OS X编译具有升压,GMP,和OpenMP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编译一个名为SDPB程序按照这些说明问题。总之,我安装需要升压,GMP,和OpenMP在Mac OS X优山美地的程序。 code编译所有的各个部分,但是当它的时间链接,我得到适用于建筑x86_64的未定义符号
 我的问题是基本相同<一个href=\"http://stackoverflow.com/questions/28889744/undefined-symbols-error-related-to-mpf-struct-for-os-x-10-10-2\">this问题
。但是,我不能得到的答案有没有为我工作。我仍然得到同样的错误。

I'm having problems compiling a program called SDPB by following these instructions. To summarize, I'm installing a program that requires Boost, GMP, and OpenMP on Mac OS X Yosemite. All the individual pieces of code compile but when its time to link, I get Undefined symbols for architecture x86_64. My question is basically identical to this question. However, I can't get the answers there to work for me. I still get the same error.

更多的搜索后,我看到人们用类似的问题都拿到指向铛和gcc之间的冲突的答案。更具体地,存在与混合的库的libstdc ++和的libc ++问题。

After more searching, I saw that people with similar questions were getting answers pointing to a conflict between clang and gcc. More specifically, there are issues with mixing the libraries libstdc++ and libc++.

因此​​,我确信重新编译这两者升压和GMP与海湾合作委员会,使一切都将使用的libstdc ++来构建。这并没有帮助。然后我下载了铿锵的实现,这是使用OpenMP兼容,并尝试使用刚刚的libc ++构建一切。这也没有工作。然后,我试过各种排列组合的使用与 -stdlib = ++的libstdc 标志铛等。似乎没有任何工作。错误的细节似乎变位的各种permuations。下面我将发表一些片段。当然,我总是用更新的makefile编译SDPB,我总是配置了 GMP - 因为答案链接这个上面说的做使-CXX 标志

Therefore, I made sure to recompile both Boost and GMP with gcc so that everything would be built using libstdc++. That didn't help. I then downloaded an implementation of clang that was compatible with OpenMP and tried to build everything using just libc++. That also didn't work. I then tried all sorts of permutations using clang with the -stdlib=libstdc++ flag and so on. Nothing seems to work. The details of the errors seemed to change a bit with the various permuations. I'll post a few snippets below. Of course, I always used the updated makefile to compile SDPB and I always configured GMP with the --enable-cxx flag as the answers linked above said to do.

下面是同时用gcc编译SDPB我编译GMP和用gcc提升以及后,我收到了错误的片段。

Here, is a snippet of the error I received while compiling SDPB with gcc after I compiled GMP and Boost with gcc as well.

Undefined symbols for architecture x86_64:
  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned long, unsigned long) const", referenced from:
      boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::time_duration const&) const in SDPSolverIO.o
      boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::ptime const&) const in main.o
  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_get_insert_unique_pos(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_insert_unique_(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> const&) in SDPSolverIO.o
      std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::timer::cpu_timer, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::program_options::variable_value>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::program_options::variable_value> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::program_options::variable_value> > >::find(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const in main.o
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_unique_pos(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in main.o
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in main.o
      ... 

下面,我编译GMP和使用与 -stdlib = ++的libstdc 标志铛升压和我SDPB编译使用gcc。

Here, I compiled GMP and Boost using clang with the -stdlib=libstdc++ flag and I compiled SDPB with gcc.

Undefined symbols for architecture x86_64:
  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned long, unsigned long) const", referenced from:
      boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::time_duration const&) const in SDPSolverIO.o
      boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::ptime const&) const in main.o
  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_get_insert_unique_pos(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_insert_unique_(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> const&) in SDPSolverIO.o
      std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::timer::cpu_timer, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::program_options::variable_value>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::program_options::variable_value> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::program_options::variable_value> > >::find(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const in main.o
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_unique_pos(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in main.o
      std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in main.o
      ...

下面我整理加速,GMP和SDPB使用与 -stdlib = ++的libstdc 标志铛。

Here I compiled Boost, GMP, and SDPB using clang with the -stdlib=libstdc++ flag.

Undefined symbols for architecture x86_64:
  "std::string::find(char const*, unsigned long, unsigned long) const", referenced from:
      boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::time_duration const&) const in SDPSolverIO.o
      boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::ptime const&) const in main.o
  "std::logic_error::what() const", referenced from:
      vtable for boost::gregorian::bad_day_of_year in main.o
      vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_year> > in main.o
      vtable for boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_year> in main.o
      vtable for std::out_of_range in main.o
      vtable for boost::gregorian::bad_day_of_month in main.o
      vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month> > in main.o
      vtable for boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month> in main.o
      ...

在这里,我用铿锵,但只能用 -stdlib = ++的libstdc 标志SDPB编译一切。

Here, I compiled everything using clang but only SDPB with the -stdlib=libstdc++ flag.

Undefined symbols for architecture x86_64:
  "bootstrapSDP(std::vector<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, std::allocator<__gmp_expr<__mpf_struct [1], __mpf_struct [1]> > > const&, std::vector<PolynomialVectorMatrix, std::allocator<PolynomialVectorMatrix> > const&)", referenced from:
      parseBootstrapSDP(tinyxml2::XMLElement*) in parse.o
  "RpotrfStabilized(char const*, int, __gmp_expr<__mpf_struct [1], __mpf_struct [1]>*, int, int*, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, std::__1::allocator<__gmp_expr<__mpf_struct [1], __mpf_struct [1]> > >&, double)", referenced from:
      choleskyDecompositionStabilized(Matrix&, Matrix&, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, std::__1::allocator<__gmp_expr<__mpf_struct [1], __mpf_struct [1]> > >&, double) in Matrix.o
  "boost::program_options::to_internal(std::string const&)", referenced from:
      std::vector<std::string, std::allocator<std::string> > boost::program_options::to_internal<std::string>(std::vector<std::string, std::allocator<std::string> > const&) in main.o
  "boost::program_options::basic_parsed_options<char> boost::program_options::parse_config_file<char>(std::basic_istream<char, std::char_traits<char> >&, boost::program_options::options_description const&, bool)", referenced from:
      _main in main.o
  "boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)", referenced from:
      _main in main.o

每当我尝试使用使用OpenMP支持铛的修改版本编译SDPB没有 -stdlib = ++的libstdc ,我一直运行到许多

error: 'value_type' is a private member of '__gmp_expr<mpf_t, mpf_t>'
    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
                                                          ^
src/serialize.h:48:10: note: while substituting deduced template arguments into function template 'operator<<' [with _Expr = __gmp_expr<mpf_t, mpf_t>]
      os << f;

如果任何人能帮助这将是更AP preciated。

If anyone can help it would be much appreciated.

推荐答案

Mac OS X安装说明已经更新,现在一切正常,如果我只是一味地跟着他们的信。

The Mac OS X Installation instructions have been updated and everything works now if I just blindly follow them to the letter.

这篇关于未定义符号在Mac OS X编译具有升压,GMP,和OpenMP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆