MacOS MPI ld:找不到架构x86_64

时间:2019-06-17 11:39:03

标签: c++ mpi

我正在尝试在MacOS上运行一个mpi程序。每次尝试执行mpicc -o ./main main.cpp时,都会出现此错误:

Undefined symbols for architecture x86_64:
  "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
      std::__1::vector<double, std::__1::allocator<double> >::__vallocate(unsigned long) in main-2821ae.o
  "std::__1::locale::has_facet(std::__1::locale::id&) const", referenced from:
      bool std::__1::has_facet<std::__1::codecvt<char, char, __mbstate_t> >(std::__1::locale const&) in main-2821ae.o
  "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
      std::__1::codecvt<char, char, __mbstate_t> const& std::__1::use_facet<std::__1::codecvt<char, char, __mbstate_t> >(std::__1::locale const&) in main-2821ae.o
      std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in main-2821ae.o
  "std::__1::ios_base::getloc() const", referenced from:
      std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in main-2821ae.o
  "std::logic_error::logic_error(char const*)", referenced from:
      std::length_error::length_error(char const*) in main-2821ae.o
  "std::length_error::~length_error()", referenced from:
      std::__1::__throw_length_error(char const*) in main-2821ae.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(unsigned long, char) in main-2821ae.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in main-2821ae.o
  "std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
      construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_ifstream<char, std::__1::char_traits<char> > in main-2821ae.o
  "std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
      construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_ifstream<char, std::__1::char_traits<char> > in main-2821ae.o
  "std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
      std::__1::basic_ifstream<char, std::__1::char_traits<char> >::basic_ifstream(char const*, unsigned int) in main-2821ae.o
      std::__1::basic_ifstream<char, std::__1::char_traits<char> >::~basic_ifstream() in main-2821ae.o
  "std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(double&)", referenced from:
      readData() in main-2821ae.o
  "std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(int&)", referenced from:
      readData() in main-2821ae.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in main-2821ae.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in main-2821ae.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-2821ae.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-2821ae.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
      construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ofstream<char, std::__1::char_traits<char> > in main-2821ae.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
      construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ofstream<char, std::__1::char_traits<char> > in main-2821ae.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
      std::__1::basic_ofstream<char, std::__1::char_traits<char> >::basic_ofstream(char const*, unsigned int) in main-2821ae.o
      std::__1::basic_ofstream<char, std::__1::char_traits<char> >::~basic_ofstream() in main-2821ae.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(double)", referenced from:
      computeError() in main-2821ae.o
      printMat() in main-2821ae.o
      parseInput(int, char**) in main-2821ae.o
      printOutput() in main-2821ae.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int)", referenced from:
      parseInput(int, char**) in main-2821ae.o
      worker_x1() in main-2821ae.o
      solveSystemWithMPI() in main-2821ae.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(long long)", referenced from:
      _main in main-2821ae.o
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::uflow()", referenced from:
      vtable for std::__1::basic_filebuf<char, std::__1::char_traits<char> > in main-2821ae.o
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::xsgetn(char*, long)", referenced from:
      vtable for std::__1::basic_filebuf<char, std::__1::char_traits<char> > in main-2821ae.o
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::xsputn(char const*, long)", referenced from:
      vtable for std::__1::basic_filebuf<char, std::__1::char_traits<char> > in main-2821ae.o
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::showmanyc()", referenced from:
      vtable for std::__1::basic_filebuf<char, std::__1::char_traits<char> > in main-2821ae.o
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::basic_streambuf()", referenced from:
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in main-2821ae.o
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::~basic_streambuf()", referenced from:
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::~basic_filebuf() in main-2821ae.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in main-2821ae.o
  "std::__1::cout", referenced from:
      generateThomasArrays() in main-2821ae.o
      readData() in main-2821ae.o
      computeError() in main-2821ae.o
      printMat() in main-2821ae.o
      parseInput(int, char**) in main-2821ae.o
      solveParallelX1() in main-2821ae.o
      solveParallelX2() in main-2821ae.o
      ...
  "std::__1::ctype<char>::id", referenced from:
      std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in main-2821ae.o
  "std::__1::chrono::steady_clock::now()", referenced from:
      _main in main-2821ae.o
  "std::__1::locale::locale(std::__1::locale const&)", referenced from:
      std::__1::basic_streambuf<char, std::__1::char_traits<char> >::getloc() const in main-2821ae.o
  "std::__1::locale::~locale()", referenced from:
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in main-2821ae.o
      std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in main-2821ae.o
  "std::__1::codecvt<char, char, __mbstate_t>::id", referenced from:
      std::__1::codecvt<char, char, __mbstate_t> const& std::__1::use_facet<std::__1::codecvt<char, char, __mbstate_t> >(std::__1::locale const&) in main-2821ae.o
      bool std::__1::has_facet<std::__1::codecvt<char, char, __mbstate_t> >(std::__1::locale const&) in main-2821ae.o
  "std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-2821ae.o
  "std::__1::ios_base::init(void*)", referenced from:
      std::__1::basic_ios<char, std::__1::char_traits<char> >::init(std::__1::basic_streambuf<char, std::__1::char_traits<char> >*) in main-2821ae.o
  "std::__1::ios_base::clear(unsigned int)", referenced from:
      std::__1::ios_base::setstate(unsigned int) in main-2821ae.o
  "std::__1::basic_ios<char, std::__1::char_traits<char> >::~basic_ios()", referenced from:
      std::__1::basic_ifstream<char, std::__1::char_traits<char> >::basic_ifstream(char const*, unsigned int) in main-2821ae.o
      std::__1::basic_ifstream<char, std::__1::char_traits<char> >::~basic_ifstream() in main-2821ae.o
      std::__1::basic_ofstream<char, std::__1::char_traits<char> >::basic_ofstream(char const*, unsigned int) in main-2821ae.o
      std::__1::basic_ofstream<char, std::__1::char_traits<char> >::~basic_ofstream() in main-2821ae.o
  "std::bad_cast::bad_cast()", referenced from:
      std::__1::__throw_bad_cast() in main-2821ae.o
  "std::bad_cast::~bad_cast()", referenced from:
      std::__1::__throw_bad_cast() in main-2821ae.o
  "std::terminate()", referenced from:
      ___clang_call_terminate in main-2821ae.o
  "typeinfo for std::__1::basic_istream<char, std::__1::char_traits<char> >", referenced from:
      construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_ifstream<char, std::__1::char_traits<char> > in main-2821ae.o
      typeinfo for std::__1::basic_ifstream<char, std::__1::char_traits<char> > in main-2821ae.o
  "typeinfo for std::__1::basic_ostream<char, std::__1::char_traits<char> >", referenced from:
      construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ofstream<char, std::__1::char_traits<char> > in main-2821ae.o
      typeinfo for std::__1::basic_ofstream<char, std::__1::char_traits<char> > in main-2821ae.o
  "typeinfo for std::__1::basic_streambuf<char, std::__1::char_traits<char> >", referenced from:
      typeinfo for std::__1::basic_filebuf<char, std::__1::char_traits<char> > in main-2821ae.o
  "typeinfo for std::length_error", referenced from:
      std::__1::__throw_length_error(char const*) in main-2821ae.o
  "typeinfo for std::bad_cast", referenced from:
      std::__1::__throw_bad_cast() in main-2821ae.o
  "vtable for __cxxabiv1::__si_class_type_info", referenced from:
      typeinfo for std::__1::basic_ifstream<char, std::__1::char_traits<char> > in main-2821ae.o
      typeinfo for std::__1::basic_filebuf<char, std::__1::char_traits<char> > in main-2821ae.o
      typeinfo for std::__1::basic_ofstream<char, std::__1::char_traits<char> > in main-2821ae.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__1::ios_base", referenced from:
      std::__1::ios_base::ios_base() in main-2821ae.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__1::basic_ios<char, std::__1::char_traits<char> >", referenced from:
      std::__1::basic_ios<char, std::__1::char_traits<char> >::basic_ios() in main-2821ae.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::length_error", referenced from:
      std::length_error::length_error(char const*) in main-2821ae.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "virtual thunk to std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
      construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_ifstream<char, std::__1::char_traits<char> > in main-2821ae.o
  "virtual thunk to std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
      construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_ifstream<char, std::__1::char_traits<char> > in main-2821ae.o
  "virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
      construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ofstream<char, std::__1::char_traits<char> > in main-2821ae.o
  "virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
      construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ofstream<char, std::__1::char_traits<char> > in main-2821ae.o
  "operator delete[](void*)", referenced from:
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::~basic_filebuf() in main-2821ae.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::imbue(std::__1::locale const&) in main-2821ae.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::setbuf(char*, long) in main-2821ae.o
  "operator delete(void*)", referenced from:
      std::__1::basic_ifstream<char, std::__1::char_traits<char> >::~basic_ifstream() in main-2821ae.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::~basic_filebuf() in main-2821ae.o
      std::__1::basic_ofstream<char, std::__1::char_traits<char> >::~basic_ofstream() in main-2821ae.o
      std::__1::__libcpp_deallocate(void*, unsigned long) in main-2821ae.o
  "operator new[](unsigned long)", referenced from:
      generateThomasArrays() in main-2821ae.o
      readData() in main-2821ae.o
      generateData(std::__1::uniform_real_distribution<double>, std::__1::linear_congruential_engine<unsigned int, 48271u, 0u, 2147483647u>) in main-2821ae.o
      solveParallelX1() in main-2821ae.o
      solveParallelX2() in main-2821ae.o
      worker_x1() in main-2821ae.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::imbue(std::__1::locale const&) in main-2821ae.o
      ...
  "operator new(unsigned long)", referenced from:
      std::__1::__libcpp_allocate(unsigned long, unsigned long) in main-2821ae.o
  "___cxa_allocate_exception", referenced from:
      std::__1::__throw_bad_cast() in main-2821ae.o
      std::__1::__throw_length_error(char const*) in main-2821ae.o
  "___cxa_begin_catch", referenced from:
      ___clang_call_terminate in main-2821ae.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::~basic_filebuf() in main-2821ae.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-2821ae.o
  "___cxa_call_unexpected", referenced from:
      std::__1::unique_ptr<__sFILE, int (*)(__sFILE*)>::reset(__sFILE*) in main-2821ae.o
      std::__1::__vector_base<double, std::__1::allocator<double> >::__destruct_at_end(double*) in main-2821ae.o
      std::__1::allocator<double>::deallocate(double*, unsigned long) in main-2821ae.o
      bool std::__1::has_facet<std::__1::codecvt<char, char, __mbstate_t> >(std::__1::locale const&) in main-2821ae.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::__make_mdstring(unsigned int) in main-2821ae.o
      std::__1::vector<double, std::__1::allocator<double> >::max_size() const in main-2821ae.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in main-2821ae.o
      ...
  "___cxa_end_catch", referenced from:
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::~basic_filebuf() in main-2821ae.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-2821ae.o
  "___cxa_free_exception", referenced from:
      std::__1::__throw_length_error(char const*) in main-2821ae.o
  "___cxa_throw", referenced from:
      std::__1::__throw_bad_cast() in main-2821ae.o
      std::__1::__throw_length_error(char const*) in main-2821ae.o
  "___gxx_personality_v0", referenced from:
      std::__1::basic_ifstream<char, std::__1::char_traits<char> >::basic_ifstream(char const*, unsigned int) in main-2821ae.o
      std::__1::basic_ifstream<char, std::__1::char_traits<char> >::~basic_ifstream() in main-2821ae.o
      std::__1::basic_ofstream<char, std::__1::char_traits<char> >::basic_ofstream(char const*, unsigned int) in main-2821ae.o
      std::__1::basic_ofstream<char, std::__1::char_traits<char> >::~basic_ofstream() in main-2821ae.o
      thomas(int, double*, double*, double*, double*, double*) in main-2821ae.o
      std::__1::basic_ifstream<char, std::__1::char_traits<char> >::~basic_ifstream() in main-2821ae.o
      std::__1::basic_ifstream<char, std::__1::char_traits<char> >::~basic_ifstream() in main-2821ae.o
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我找不到错误的确切详细信息,也不知道是什么原因引起的。我确实通过brew安装了open-mpi。我还安装了mpich,以查看是否可以解决问题(不是)。

我也正在使用Clion,但找不到mpi.h文件,因此它充满了红色。

我正在尝试使程序运行,无论是通过Clion还是通过终端运行。

0 个答案:

没有答案