Closed mbac closed 1 year ago
That looks like a mis-configured system to me, I don't think R should call /usr/local/gfortran/bin/gcc
. This is how this looks like on my system:
❯ pkgbuild::check_build_tools(debug = TRUE)
Trying to compile a simple C file
Running /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/bin/R \
CMD SHLIB foo.c
clang -arch arm64 -I"/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c foo.c -o foo.o
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib -L/opt/R/arm64/lib -o foo.so foo.o -F/Library/Frameworks/R.framework/Versions/4.2-arm64 -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: -undefined dynamic_lookup may not work with chained fixups
and for intel:
❯ pkgbuild::check_build_tools(debug = TRUE)
Trying to compile a simple C file
Running /Library/Frameworks/R.framework/Versions/4.2/Resources/bin/R CMD \
SHLIB foo.c
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c foo.c -o foo.o
clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Versions/4.2/Resources/lib -L/usr/local/lib -o foo.so foo.o -F/Library/Frameworks/R.framework/Versions/4.2 -framework R -Wl,-framework -Wl,CoreFoundation
Check if you set PATH to /usr/local/gfortran/bin
, or if you change the compiler paths in .Renviron
, etc.
Hi,
I just re-installed everything and deleted .Renviron and .Rprofile where they could be found. Something is still telling R to call gcc
in that directory but if I run which gcc
I get /usr/bin/gcc
, which is not a link to that other version.
The "gfortran" version was installed by homebrew
when I used that compiler to work around some other error I was having. I have uninstalled /usr/local/gfortran/bin/gcc
but R is still calling that file when I run check_build_tools(debug = TRUE)
. The error message stays the same.
I would be grateful if you could suggest where else to check as to why R keeps wanting to use that version of gcc.
PS: /usr/local/gfortran/bin
is not in PATH
How did you install R? What does R CMD config CC
say? What does system("R CMD config CC")
say from R?
They both report:
/usr/local/gfortran/bin/gcc -fopenmp
… but I just reinstalled R from the latest CRAN binary, after uninstalling it with their suggested command
sudo rm -Rf /Library/Frameworks/R.framework /Applications/R.app \
/usr/local/bin/R /usr/local/bin/Rscript
Do you have something in ~/.R/Makevars
?
I guess you found it:
FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin19/10.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
CXX1X=/usr/local/gfortran/bin/g++
CXX98=/usr/local/gfortran/bin/g++
CXX11=/usr/local/gfortran/bin/g++
CXX14=/usr/local/gfortran/bin/g++
CXX17=/usr/local/gfortran/bin/g++
LLVM_LOC = /usr/local/opt/llvm
CC=/usr/local/gfortran/bin/gcc -fopenmp
CXX=/usr/local/gfortran/bin/g++ -fopenmp
CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
LDFLAGS=-L/usr/local/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib,-L/usr/local/lib
CPPFLAGS=-I/usr/local/opt/gettext/include -I$(LLVM_LOC)/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/include
I guess this was added when I had to resort to the Homebrew compiler. If I delete it will R just revert to defaults?
Thanks again…
If I delete it will R just revert to defaults?
Yes.
Worked fine. Thanks a lot, and sorry for barking up the wrong tree 🙂
Hi,
I just updated both macOS and Xcode and I'm getting the following:
Not sure this is an issue with the package or my system, but I noticed
error: unknown value ‘13.1.0’ of ‘-mmacosx-version-min’
.pkgbuild
version is 1.4.0 running in R 4.2.2. Command line tools have been installed viabrew
in/Library/Developer/CommandLineTools
.Running the above also triggers Rstudio's Xcode command line tools installation GUI, but even if I click Ok nothing happens.
Thanks, —M