Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package Installation Error #392

Open
phoman14 opened this issue Jan 23, 2024 · 1 comment
Open

Package Installation Error #392

phoman14 opened this issue Jan 23, 2024 · 1 comment

Comments

@phoman14
Copy link

phoman14 commented Jan 23, 2024

🐛 Bug

I am having trouble installing immunarch using both
devtools::install_github("immunomind/immunarch")
and
devtools::install_github("immunomind/immunarch", ref="dev")

But I keep getting the same error

Any advice or insight would be appreciated

> devtools::install_github("immunomind/immunarch") Registered S3 methods overwritten by 'htmltools': method from print.html tools:rstudio print.shiny.tag tools:rstudio print.shiny.tag.list tools:rstudio Registered S3 method overwritten by 'htmlwidgets': method from print.htmlwidget tools:rstudio Downloading GitHub repo immunomind/immunarch@HEAD Error: Failed to install 'unknown package' from GitHub: Could not find tools necessary to compile a package Call pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.

pkgbuild::check_build_tools(debug = TRUE)
Trying to compile a simple C file
Running /Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB foo.c
using C compiler: ‘gcc-8 (Homebrew GCC 8.5.0) 8.5.0’
using SDK: ‘’
gcc-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/x86_64/include -fPIC -mtune=native -g -O2 -Wall -pedantic -Wconversion -c foo.c -o foo.o
gcc-8 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/x86_64/lib -o foo.so foo.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
-macosx_version_min has been renamed to -macos_version_min
ld: warning: ignoring duplicate libraries: '-lSystem'
ld: unsupported mach-o filetype (only MH_OBJECT and MH_DYLIB can be linked) in '/usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8/libgcc_ext.10.5.dylib'
collect2: error: ld returned 1 exit status
make: *** [foo.so] Error 1
Error: Could not find tools necessary to compile a package
Call pkgbuild::check_build_tools(debug = TRUE) to diagnose the problem.`

Additional context

R version 4.3.2 (2023-10-31)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.2.1

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0

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

time zone: America/New_York
tzcode source: internal

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

other attached packages:
[1] devtools_2.4.5 usethis_2.2.2

loaded via a namespace (and not attached):
[1] miniUI_0.1.1.1 compiler_4.3.2 promises_1.2.1 Rcpp_1.0.12 stringr_1.5.1 callr_3.7.3
[7] later_1.3.2 fastmap_1.1.1 mime_0.12 R6_2.5.1 curl_5.2.0 knitr_1.45
[13] htmlwidgets_1.6.4 desc_1.4.3 profvis_0.3.8 shiny_1.8.0 rlang_1.1.3 cachem_1.0.8
[19] stringi_1.8.3 httpuv_1.6.13 xfun_0.41 fs_1.6.3 pkgload_1.3.4 memoise_2.0.1
[25] cli_3.6.2 magrittr_2.0.3 ps_1.7.6 processx_3.8.3 digest_0.6.34 rstudioapi_0.15.0
[31] xtable_1.8-4 remotes_2.4.2.1 lifecycle_1.0.4 vctrs_0.6.5 glue_1.7.0 urlchecker_1.0.1
[37] sessioninfo_1.2.2 pkgbuild_1.4.3 purrr_1.0.2 tools_4.3.2 ellipsis_0.3.2 htmltools_0.5.7

@vadimnazarov
Copy link
Contributor

Hi phoman14, this is the first time I see the error you encountered. I searched and even asked ChatGPT about it, this is what it said to me:

The error message you're encountering indicates an issue with the build tools necessary to compile R packages from source, particularly those involving C/C++ code. This is a common issue on macOS, where the necessary compilers and command-line tools might not be properly set up or compatible with your R installation.

Here are some steps to diagnose and potentially resolve the problem:

  1. Check Xcode Command Line Tools:

    • macOS uses Xcode's command-line tools for compiling software. Ensure they are installed and up to date.
    • Open Terminal and run:
      xcode-select --install
    • This command will prompt you to install the command-line tools if they're not already installed. If they are installed, it will tell you so.
  2. Install/Update Homebrew and GCC:

    • Homebrew is a package manager for macOS, and GCC is the GNU Compiler Collection which includes C/C++ compilers.
    • If not already installed, install Homebrew by following instructions on brew.sh.
    • Then, install GCC with Homebrew:
      brew install gcc
  3. Linking the Correct Compiler:

    • The error message shows gcc-8 being used. Depending on your Homebrew installation and the current GCC version, you might have a newer version of GCC.
    • Check the installed GCC version:
      gcc --version
    • Ensure your system is using the correct version of GCC. Sometimes, R might not point to the correct version automatically.
  4. Configure R to Use the Correct Compilers:

    • Create or modify the ~/.R/Makevars file to set the correct paths for the compilers.
    • You can open this file in a text editor and add lines like:
      CC=gcc-x
      CXX=g++-x
      
      Replace x with your installed GCC version number.
  5. Reinstall immunarch:

    • After ensuring that the build tools are correctly set up, try reinstalling immunarch:
      devtools::install_github("immunomind/immunarch")
  6. Check for Other Dependency Issues:

    • Sometimes, specific package dependencies might cause installation issues. Ensure that all dependencies are installed and updated.
  7. Use a Binary Version (if available):

    • If compiling from source continues to be problematic, check if a binary version of immunarch is available for your version of R and macOS. Installing binary packages bypasses the need to compile from source.

Looks legit, I too have some issues with compiling libraries on mac from time to time. Could you try it and get back to me please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants