【问题标题】:MacOS Big Sur x86_64 complier error during R devtool installR devtools 安装期间的 MacOS Big Sur x86_64 编译器错误
【发布时间】:2021-09-19 17:31:22
【问题描述】:

我正在尝试使用以下命令安装 R 包:

devtools::install_github('ococrook/bandle)

但是,我一直遇到编译器问题。当我运行命令时,我得到了很多很多错误。例如这个与 BH 相关的错误:

clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include    -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c Bessel2ndKind.cpp -o Bessel2ndKind.o
   In file included from Bessel2ndKind.cpp:1:
   In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:34:
   In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp.h:59:
   In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp/exceptions_impl.h:38:
   In file included from /usr/local/include/execinfo.h:28:
   /usr/local/include/os/base.h:274:37: warning: type nullability specifier '_Nullable' is a Clang extension [-Wnullability-extension]
   typedef void (*os_function_t)(void *_Nullable);
                                       ^
   Bessel2ndKind.cpp:621:55: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
                                              nk, tau, D = D, j + 1, nu).t();
                                                       ~ ^ ~
   Bessel2ndKind.cpp:774:49: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
                                        nk, tau, D = D, j + 1).t();
                                                 ~ ^ ~
   In file included from Bessel2ndKind.cpp:2:
   In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include/boost/math/special_functions/bessel.hpp:24:
   /Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include/boost/math/special_functions/detail/bessel_ik.hpp:97:18: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
       BOOST_ASSERT(abs(x) <= 2);
                    ^
   /Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include/boost/math/special_functions/detail/bessel_ik.hpp:366:9: note: in instantiation of function template specialization 'boost::math::detail::temme_ik<long double, boost::math::policies::policy<detail::forwarding_arg1, detail::forwarding_arg2>>' requested here
           temme_ik(u, x, &Ku, &Ku1, pol);             // Temme series
           ^
   /Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include/boost/math/special_functions/bessel.hpp:246:4: note: in instantiation of function template specialization 'boost::math::detail::bessel_ik<long double, boost::math::policies::policy<detail::forwarding_arg1, detail::forwarding_arg2>>' requested here
      bessel_ik(v, x, &I, &K, need_k, pol);
      ^
   /Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include/boost/math/special_functions/bessel.hpp:258:11: note: in instantiation of function template specialization 'boost::math::detail::cyl_bessel_k_imp<long double, boost::math::policies::policy<detail::forwarding_arg1, detail::forwarding_arg2>>' requested here
      return cyl_bessel_k_imp(v, x, bessel_no_int_tag(), pol);
             ^

或者这个与 RcppArmadillo 相关的错误:

clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include    -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c leapfrogGPcpp.cpp -o leapfrogGPcpp.o
   In file included from leapfrogGPcpp.cpp:1:
   In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:34:
   In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp.h:59:
   In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp/exceptions_impl.h:38:
   In file included from /usr/local/include/execinfo.h:28:
   /usr/local/include/os/base.h:274:37: warning: type nullability specifier '_Nullable' is a Clang extension [-Wnullability-extension]
   typedef void (*os_function_t)(void *_Nullable);
                                       ^
   In file included from leapfrogGPcpp.cpp:1:
   In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:31:
   In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:49:
   In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/armadillo:646:
   /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppArmadillo/include/armadillo_bits/op_inv_meat.hpp:200:28: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
       const  T abs_det_val = std::abs(det_val);

到目前为止,我已经尝试过thisthisthisthis。然而,到目前为止,这些解决方案都没有奏效,我对如何解决这个问题没有任何想法。

任何帮助将不胜感激, 谢谢!

【问题讨论】:

  • 我不是 macOS 用户,除了提到标准资源the mac.R-Project.org pagepage by @coatless、r-sig-mac 邮件列表和 rcpp-devel 邮件列表之外,我无能为力。
  • 请区分警告和错误。它们是不相同的。您通常可以忽略某些警告。事实上,您的 sn-ps 中没有显示任何错误。请显示编译实际停止的位置。查找实际的单词 "error"
  • 有一个活动的issue on github。以防你还没有注意到。也许你可以在那里做出贡献。
  • 另外说明:我也在用big sur,可以复制问题

标签: c++ r macos rcpp


【解决方案1】:

尝试按照here 的说明更改默认超时时间,以确保完整下载相对较大的“pRolocdata”包,即

options(timeout = 600)
devtools::install_github('ococrook/bandle')

使用这种方法,Bandle 安装了一堆警告,但在我的系统上没有错误。

sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

loaded via a namespace (and not attached):
[1] compiler_4.1.1 tools_4.1.1  

我的 ~/.R/Makevars 文件:

LOC = /usr/local/gfortran
CC=$(LOC)/bin/gcc -fopenmp
CXX=$(LOC)/bin/g++ -fopenmp
CXX11 = $(LOC)/bin/g++ -fopenmp

CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
LDFLAGS=-L$(LOC)/lib -Wl,-rpath,$(LOC)/lib
CPPFLAGS=-I$(LOC)/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include

FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin19/10.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
CXX1X=/usr/local/gfortran/bin/g++
CXX98=/usr/local/gfortran/bin/g++
CXX11=/usr/local/gfortran/bin/g++
CXX14=/usr/local/gfortran/bin/g++
CXX17=/usr/local/gfortran/bin/g++

【讨论】:

    猜你喜欢
    • 2021-09-11
    • 1970-01-01
    • 2022-01-31
    • 2021-06-19
    • 2021-08-04
    • 2021-05-31
    • 2021-06-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多