Невозможно скомпилировать пакеты R с кодом c ++ после обновления до macOS Catalina - PullRequest
3 голосов
/ 10 октября 2019

Я только что обновил MacOS Catalina и попытался скомпилировать пакет R Я разрабатываю. Однако сейчас это не работает. Я не уверен, что это из-за ОС или из-за пакета Rcpp. Буду признателен за любую помощь!

> devtools::load_all(".")
Loading phyr
Re-compiling phyr
─  installing *source* package ‘phyr’ ...
   ** using staged installation
   ** libs
   /usr/local/clang4/bin/clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/dli/R/Rcpp/include" -I"/Users/dli/R/RcppArmadillo/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
   In file included from RcppExports.cpp:4:
   In file included from /Users/dli/R/RcppArmadillo/include/RcppArmadillo.h:31:
   In file included from /Users/dli/R/RcppArmadillo/include/RcppArmadilloForward.h:26:
   In file included from /Users/dli/R/Rcpp/include/RcppCommon.h:29:
   In file included from /Users/dli/R/Rcpp/include/Rcpp/r/headers.h:59:
   In file included from /Users/dli/R/Rcpp/include/Rcpp/platform/compiler.h:100:
   /usr/local/clang4/bin/../include/c++/v1/cmath:313:9: error: no member named 'signbit' in the global namespace
   using ::signbit;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:314:9: error: no member named 'fpclassify' in the global namespace
   using ::fpclassify;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:315:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
   using ::isfinite;
         ~~^
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:749:12: note: 'finite' declared here
   extern int finite(double)
              ^
   In file included from RcppExports.cpp:4:
   In file included from /Users/dli/R/RcppArmadillo/include/RcppArmadillo.h:31:
   In file included from /Users/dli/R/RcppArmadillo/include/RcppArmadilloForward.h:26:
   In file included from /Users/dli/R/Rcpp/include/RcppCommon.h:29:
   In file included from /Users/dli/R/Rcpp/include/Rcpp/r/headers.h:59:
   In file included from /Users/dli/R/Rcpp/include/Rcpp/platform/compiler.h:100:
   /usr/local/clang4/bin/../include/c++/v1/cmath:316:9: error: no member named 'isinf' in the global namespace
   using ::isinf;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:317:9: error: no member named 'isnan' in the global namespace
   using ::isnan;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:318:9: error: no member named 'isnormal' in the global namespace
   using ::isnormal;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:319:9: error: no member named 'isgreater' in the global namespace
   using ::isgreater;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:320:9: error: no member named 'isgreaterequal' in the global namespace
   using ::isgreaterequal;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:321:9: error: no member named 'isless' in the global namespace
   using ::isless;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:322:9: error: no member named 'islessequal' in the global namespace
   using ::islessequal;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:323:9: error: no member named 'islessgreater' in the global namespace
   using ::islessgreater;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:324:9: error: no member named 'isunordered' in the global namespace
   using ::isunordered;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:325:9: error: no member named 'isunordered' in the global namespace
   using ::isunordered;
         ~~^
   /usr/local/clang4/bin/../include/c++/v1/cmath:331:9: error: no member named 'abs' in the global namespace; did you mean 'fabs'?
   using ::abs;
         ~~^
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:417:15: note: 'fabs' declared here
   extern double fabs(double);
                 ^
   In file included from RcppExports.cpp:4:
   In file included from /Users/dli/R/RcppArmadillo/include/RcppArmadillo.h:31:
   In file included from /Users/dli/R/RcppArmadillo/include/RcppArmadilloForward.h:26:
   In file included from /Users/dli/R/Rcpp/include/RcppCommon.h:29:
   In file included from /Users/dli/R/Rcpp/include/Rcpp/r/headers.h:59:
   In file included from /Users/dli/R/Rcpp/include/Rcpp/platform/compiler.h:100:
   /usr/local/clang4/bin/../include/c++/v1/cmath:557:28: error: expected a qualified name after 'typename'
   _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
                              ^
   /usr/local/clang4/bin/../include/c++/v1/cmath:557:37: error: expected ';' at end of declaration
   _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
                                       ^
   /usr/local/clang4/bin/../include/c++/v1/cmath:557:37: error: expected unqualified-id
   /usr/local/clang4/bin/../include/c++/v1/cmath:569:39: error: use of undeclared identifier 'is_floating_point'
   _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
                                         ^
   /usr/local/clang4/bin/../include/c++/v1/cmath:569:57: error: '_A1' does not refer to a value
   _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
                                                           ^
   /usr/local/clang4/bin/../include/c++/v1/cmath:567:17: note: declared here
   template <class _A1>
                   ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   20 errors generated.
   make: *** [RcppExports.o] Error 1
   ERROR: compilation failed for package ‘phyr’
─  removing ‘/private/var/folders/b0/zl5p7whd1zg4cwk9q1nc69_h0000gn/T/RtmpE8aUBf/devtools_install_2b457078750/phyr’
Error in (function (command = NULL, args = character(), error_on_status = TRUE,  : 
  System command error

Вот информация о моей сессии.

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

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

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2                compiler_3.6.1            prettyunits_1.0.2        
 [4] remotes_2.1.0             tools_3.6.1               testthat_2.2.1           
 [7] digest_0.6.21             pkgbuild_1.0.6            pkgload_1.0.2            
[10] memoise_1.1.0             nlme_3.1-140              lattice_0.20-38          
[13] mgcv_1.8-28               rlang_0.4.0               Matrix_1.2-17            
[16] cli_1.1.0                 rstudioapi_0.10           parallel_3.6.1           
[19] RcppArmadillo_0.9.700.2.0 withr_2.1.2               cluster_2.1.0            
[22] fs_1.3.1                  desc_1.2.0                devtools_2.2.1           
[25] rprojroot_1.3-2           grid_3.6.1                glue_1.3.1               
[28] R6_2.4.0                  processx_3.4.1            sessioninfo_1.1.1        
[31] callr_3.3.2               magrittr_1.5              backports_1.1.5          
[34] ps_1.3.0                  ellipsis_0.3.0            MASS_7.3-51.4            
[37] splines_3.6.1             usethis_1.5.1             assertthat_0.2.1         
[40] permute_0.9-5             picante_1.8               ape_5.3                  
[43] crayon_1.3.4              vegan_2.5-6              

Спасибо!

Ответы [ 2 ]

8 голосов
/ 10 октября 2019

Пожалуйста, используйте:

https://github.com/coatless/r-macos-rtools/releases/latest

Или выполните шаги вручную:

https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/

Основное изменение, необходимое дляэта версия macOS необходима для установки флагов в местоположениях заголовков, поскольку нет доступных пакетов SDK для переустановки в ожидаемые каталоги для R .

6 голосов
/ 10 октября 2019

Скорее всего, вам необходимо переустановить инструменты командной строки - Apple часто удаляет их после обновления ОС. Попробуйте запустить:

xcode-select --install

в терминале. (Обратите внимание, что даже если вы используете предоставляемый R инструментарий LLVM, ему все равно потребуется доступ к системным заголовкам по умолчанию, которые устанавливаются как часть инструментария инструментов командной строки)

EDIT: @без пальто это место. В частности, с https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/, вам необходимо настроить ~/.R/Makevars для указания на системные заголовки:

mkdir -p ~/.R

# Fill with appropriate flag statements
cat <<- EOF > ~/.R/Makevars
# clang: start
CFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
# clang: end
EOF

Обратите внимание, что исправленный R 3.6.1 делает это по умолчанию - например, Iесть у меня $(R RHOME)/etc/Makeconf:

CPPFLAGS = -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...