macOS Catalina 10.15.4下R包simmer安装失败求助
I’ve run into similar compilation headaches with C++-based R packages on Catalina, so I know how frustrating this can be. Here are several actionable approaches to get the simmer package installed successfully:
1. Start with the stable CRAN version
Skip the GitHub development build first and try the pre-tested CRAN release—this often avoids compatibility issues with older macOS versions:
install.packages("simmer")
2. Fix the compilation error for the GitHub version
If you specifically need the latest GitHub code, address the uuid_t type definition errors with these steps:
Update Xcode Command Line Tools
Catalina’s SDK sometimes has header mismatches that cause these types of errors. Reinstall the command line tools to ensure you have the correct system headers:xcode-select --installRestart RStudio after installation, then retry the GitHub install command.
Force include the required uuid header
The error happens because the compiler can’t find the definition ofuuid_t. Tell the C++ compiler to include the necessary header upfront by setting this environment variable in R before installing:Sys.setenv(CXXFLAGS = "-include /usr/include/uuid/uuid.h") devtools::install_github("r-simmer/simmer")Update the BH (Boost Headers) package
Your error trace shows the issue stems from interactions between the BH package’s Boost headers and macOS SDK headers. Update BH to the latest version first:install.packages("BH")Then try installing simmer again.
Use the
pakpackage for more robust installation
Thepakpackage handles dependencies and compilation more smoothly than devtools for GitHub-hosted packages. Installpakfirst, then use it to install simmer:install.packages("pak") pak::pak("r-simmer/simmer")
3. Try a pre-compiled binary
If compilation still fails, check for a pre-built binary for your system. For the CRAN version, you can explicitly request binary installation:
install.packages("simmer", type = "binary")
内容的提问来源于stack exchange,提问作者allfriend

