MPIDR / rsocsim

Socsim Microsimulation R Package
https://mpidr.github.io/rsocsim/
GNU General Public License v3.0
20 stars 7 forks source link

Troubles installing rsocsim on Mac (compilation) #12

Closed huentelb closed 4 months ago

huentelb commented 10 months ago

Hi Tom, I tried installing rsocsim for the first time, but received error messages (see console output below) and couldn't complete the installation. I use MacOS Ventura 13.4, RStudio Version 2023.06.0+421, and R 4.3.1. Also, I checked that I have devtools as well as Xcode (Version 14.3.1) installed and updated. Your help is very much appreciated! Thanks, Bettina

> library(devtools)
Loading required package: usethis
> devtools::install_github("MPIDR/rsocsim")
Downloading GitHub repo MPIDR/rsocsim@HEAD
Error: Failed to install 'rsocsim' 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: ‘clang version 7.0.0 (tags/RELEASE_700/final)’
using SDK: ‘’
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include    -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c foo.c -o foo.o
warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o foo.so foo.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: building for iOS 5.0.0 is deprecated
ld: framework not found CoreFoundation
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
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.
tomthe commented 10 months ago

This is tricky. You seem to have installed all prerequisites, but R still can't "find the necessary tools to compile a package".

Can you try to run pkgbuild::check_build_tools(debug = TRUE) and post the output of that command here?

huentelb commented 10 months ago

Hi Tom, thanks for your message. Here is the output you requested:

> library(devtools)
Loading required package: usethis
> 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: ‘clang version 7.0.0 (tags/RELEASE_700/final)’
using SDK: ‘’
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include    -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c foo.c -o foo.o
warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o foo.so foo.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: building for iOS 5.0.0 is deprecated
ld: framework not found CoreFoundation
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
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.

Thanks for your help!

huentelb commented 4 months ago

Running /Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB foo.c using C compiler: ‘clang version 7.0.0 (tags/RELEASE_700/final)’ using SDK: ‘’ clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c foo.c -o foo.o clang-7: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot] clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o foo.so foo.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation -iphoneos_version_min has been renamed to -ios_version_min ld: warning: -single_module is obsolete ld: warning: -multiply_defined is obsolete ld: warning: -undefined dynamic_lookup is deprecated on iOS -iphoneos_version_min has been renamed to -ios_version_min ld: warning: -single_module is obsolete ld: warning: -multiply_defined is obsolete ld: warning: -undefined dynamic_lookup is deprecated on iOS dyld[10649]: missing symbol called clang-7: error: unable to execute command: Abort trap: 6 clang-7: error: linker command failed due to signal (use -v to see invocation) make: *** [foo.so] Error 254

tomthe commented 4 months ago

R finds a compiler (I guess), but it is maybe wrongly configured...

After some googling these are the steps I would try next:

huentelb commented 4 months ago

Hi Tom, the problem was solved with the code from the first link! Thanks so much -- first simulation is already up and running now :))

tomthe commented 4 months ago

That is great to hear!