首页 > 解决方案 > 如何在 R 中安装包 simmer?(在 Mac OS X 上)

问题描述

操作系统版本:macOS Catalina 10.15.4

我试图安装 simmer 包,但我从 r studio 得到错误消息。

'''

> devtools::install_github("r-simmer/simmer")
Downloading GitHub repo r-simmer/simmer@master
✔  checking for file ‘/private/var/folders/pz/35d87wwn2_19t3h08hkv42m00000gn/T/RtmpaX72mc/remotes196b67508c78/r-simmer-simmer-e10a7dc/DESCRIPTION’ ...
─  preparing ‘simmer’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  installing the package to process help pages
         -----------------------------------
─  installing *source* package ‘simmer’ ...
   ** using staged installation
   ** libs
   clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include -DBOOST_NO_LONG_LONG -DBOOST_NO_AUTO_PTR -DRCPP_USE_UNWIND_PROTECT -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/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 ./../inst/include/simmer.h:21:
   In file included from ../inst/include/simmer/common.h:32:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/container/set.hpp:15:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config.hpp:57:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/platform/macos.hpp:28:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18:
   In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:655:
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:17: error: C++ requires a type specifier for all declarations
   int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
                   ^
   In file included from RcppExports.cpp:4:
   In file included from ./../inst/include/simmer.h:21:
   In file included from ../inst/include/simmer/common.h:32:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/container/set.hpp:15:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config.hpp:57:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/platform/macos.hpp:28:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18:
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:662:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
   int      getsgroups_np(int *, uuid_t);
                                 ^
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
   typedef __darwin_uid_t        uid_t;
                                 ^
   In file included from RcppExports.cpp:4:
   In file included from ./../inst/include/simmer.h:21:
   In file included from ../inst/include/simmer/common.h:32:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/container/set.hpp:15:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config.hpp:57:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/platform/macos.hpp:28:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18:
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:664:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
   int      getwgroups_np(int *, uuid_t);
                                 ^
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
   typedef __darwin_uid_t        uid_t;
                                 ^
   In file included from RcppExports.cpp:4:
   In file included from ./../inst/include/simmer.h:21:
   In file included from ../inst/include/simmer/common.h:32:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/container/set.hpp:15:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config.hpp:57:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/platform/macos.hpp:28:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18:
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:727:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
   int      setsgroups_np(int, const uuid_t);
                                     ^
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
   typedef __darwin_uid_t        uid_t;
                                 ^
   In file included from RcppExports.cpp:4:
   In file included from ./../inst/include/simmer.h:21:
   In file included from ../inst/include/simmer/common.h:32:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/container/set.hpp:15:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config.hpp:57:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/platform/macos.hpp:28:
   In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18:
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:729:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
   int      setwgroups_np(int, const uuid_t);
                                     ^
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
   typedef __darwin_uid_t        uid_t;
                                 ^
   5 errors generated.
   make: *** [RcppExports.o] Error 1
   ERROR: compilation failed for package ‘simmer’
─  removing ‘/private/var/folders/pz/35d87wwn2_19t3h08hkv42m00000gn/T/Rtmp5agreT/Rinst19c0507f76cd/simmer’
         -----------------------------------
   ERROR: package installation failed
Error: Failed to install 'simmer' from GitHub:
  System command error, exit status: 1, stdout + stderr (last 10 lines):
E>                                   ^
E> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
E> typedef __darwin_uid_t        uid_t;
E>                               ^
E> 5 errors generated.
E> make: *** [RcppExports.o] Error 1
E> ERROR: compilation failed for package ‘simmer’
E> * removing ‘/private/var/folders/pz/35d87wwn2_19t3h08hkv42m00000gn/T/Rtmp5agreT/Rinst19c0507f76cd/simmer’
E>       -----------------------------------
E> ERROR: package installation failed

'''

我从谷歌找到了一些信息。他们说这个问题是因为 macOS 而出现的,但我找不到任何解决方案。有没有其他安装包的途径?或者我该如何解决这个问题?

标签: rmacos

解决方案


试一试

install.packages("simmer")

推荐阅读