使用 M1 在 MacO 上安装 GMP

问题描述 投票:0回答:0

我正在尝试在我的带有 M1 芯片的 MacBook Air 上安装 GMP。因为我需要它在项目中使用带有 EigenMPFR 库。

我遵循了GMP文档,还按照

文档
的建议使用了
configure
选项--disable-shared

但是,当我运行

make check
时,50 个测试中有 33 个失败了。

如果我继续安装然后尝试使用此版本的 GMP 安装 MPFR,则 MPFR 库无法正常工作并且出现以下错误:

: && /Library/Developer/CommandLineTools/usr/bin/c++ -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/test_mpfr.dir/main.cpp.o -o test_mpfr   && :
Undefined symbols for architecture arm64:
  "___gmp_randinit_default", referenced from:
      mpfr::random(unsigned int) in main.cpp.o
  "___gmp_randseed_ui", referenced from:
      mpfr::random(unsigned int) in main.cpp.o
  "_mpfr_abs", referenced from:
      mpfr::abs(mpfr::mpreal const&, mpfr_rnd_t) in main.cpp.o
  "_mpfr_add", referenced from:
      mpfr::operator+(mpfr::mpreal const&, mpfr::mpreal const&) in main.cpp.o
      Eigen::internal::gebp_kernel<mpfr::mpreal, mpfr::mpreal, long, Eigen::internal::blas_data_mapper<mpfr::mpreal, long, 0, 0, 1>, 1, 1, false, false>::operator()(Eigen::internal::blas_data_mapper<mpfr::mpreal, long, 0, 0, 1> const&, mpfr::mpreal const*, mpfr::mpreal const*, long, long, long, mpfr::mpreal const&, long, long, long, long) in main.cpp.o
      mpfr::mpreal::operator+=(mpfr::mpreal const&) in main.cpp.o
  "_mpfr_asprintf", referenced from:
      mpfr::mpreal::output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in main.cpp.o
  "_mpfr_clear", referenced from:
      mpfr::mpreal::clear(__mpfr_struct*) in main.cpp.o
  "_mpfr_div", referenced from:
      mpfr::operator/(mpfr::mpreal const&, mpfr::mpreal const&) in main.cpp.o
      mpfr::mpreal::operator/=(mpfr::mpreal const&) in main.cpp.o
  "_mpfr_equal_p", referenced from:
      mpfr::operator==(mpfr::mpreal const&, mpfr::mpreal const&) in main.cpp.o
  "_mpfr_free_str", referenced from:
      mpfr::mpreal::output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in main.cpp.o
  "_mpfr_get_default_prec", referenced from:
      mpfr::mpreal::get_default_prec() in main.cpp.o
  "_mpfr_get_default_rounding_mode", referenced from:
      mpfr::mpreal::get_default_rnd() in main.cpp.o
  "_mpfr_get_prec", referenced from:
      mpfr::operator/(mpfr::mpreal const&, mpfr::mpreal const&) in main.cpp.o
      mpfr::mpreal::operator=(mpfr::mpreal const&) in main.cpp.o
      mpfr::abs(mpfr::mpreal const&, mpfr_rnd_t) in main.cpp.o
      mpfr::operator+(mpfr::mpreal const&, mpfr::mpreal const&) in main.cpp.o
      mpfr::mpreal::mpreal(mpfr::mpreal const&) in main.cpp.o
      mpfr::operator*(mpfr::mpreal const&, mpfr::mpreal const&) in main.cpp.o
      Eigen::internal::gebp_kernel<mpfr::mpreal, mpfr::mpreal, long, Eigen::internal::blas_data_mapper<mpfr::mpreal, long, 0, 0, 1>, 1, 1, false, false>::operator()(Eigen::internal::blas_data_mapper<mpfr::mpreal, long, 0, 0, 1> const&, mpfr::mpreal const*, mpfr::mpreal const*, long, long, long, mpfr::mpreal const&, long, long, long, long) in main.cpp.o
      ...
  "_mpfr_greater_p", referenced from:
      mpfr::operator>(mpfr::mpreal const&, mpfr::mpreal const&) in main.cpp.o
  "_mpfr_init2", referenced from:
      mpfr::mpreal::mpreal(int, long, mpfr_rnd_t) in main.cpp.o
      mpfr::mpreal::mpreal() in main.cpp.o
      mpfr::mpreal::operator=(mpfr::mpreal const&) in main.cpp.o
      mpfr::mpreal::mpreal(mpfr::mpreal const&) in main.cpp.o
  "_mpfr_less_p", referenced from:
      mpfr::operator<(mpfr::mpreal const&, mpfr::mpreal const&) in main.cpp.o
  "_mpfr_mul", referenced from:
      mpfr::operator*(mpfr::mpreal const&, mpfr::mpreal const&) in main.cpp.o
      mpfr::mpreal::operator*=(mpfr::mpreal const&) in main.cpp.o
      Eigen::internal::gebp_kernel<mpfr::mpreal, mpfr::mpreal, long, Eigen::internal::blas_data_mapper<mpfr::mpreal, long, 0, 0, 1>, 1, 1, false, false>::operator()(Eigen::internal::blas_data_mapper<mpfr::mpreal, long, 0, 0, 1> const&, mpfr::mpreal const*, mpfr::mpreal const*, long, long, long, mpfr::mpreal const&, long, long, long, long) in main.cpp.o
  "_mpfr_set", referenced from:
      mpfr::mpreal::operator=(mpfr::mpreal const&) in main.cpp.o
      mpfr::mpreal::mpreal(mpfr::mpreal const&) in main.cpp.o
  "_mpfr_set_default_prec", referenced from:
      mpfr::mpreal::set_default_prec(long) in main.cpp.o
  "_mpfr_set_si", referenced from:
      mpfr::mpreal::mpreal(int, long, mpfr_rnd_t) in main.cpp.o
      mpfr::mpreal::operator=(int) in main.cpp.o
  "_mpfr_sqrt", referenced from:
      mpfr::sqrt(mpfr::mpreal const&, mpfr_rnd_t) in main.cpp.o
  "_mpfr_sub", referenced from:
      mpfr::mpreal::operator-=(mpfr::mpreal const&) in main.cpp.o
      mpfr::operator-(mpfr::mpreal const&, mpfr::mpreal const&) in main.cpp.o
  "_mpfr_swap", referenced from:
      mpfr::mpreal::operator=(mpfr::mpreal&&) in main.cpp.o
      mpfr::swap(mpfr::mpreal&, mpfr::mpreal&) in main.cpp.o
  "_mpfr_urandom", referenced from:
      mpfr::urandom(__gmp_randstate_struct (&) [1], mpfr_rnd_t) in main.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
c++ apple-m1 gmp mpfr
© www.soinside.com 2019 - 2024. All rights reserved.