R M1 builds will not compile packages - r

I have recently installed the arm64 version of R from the Mac nightly builds page. It's working great! Except - for packages that require compilation. For example, if I try and install xfun which is required for blogdown, I get the following error
ld: warning: ignoring file /usr/local/opt/llvm/lib/libc++.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: in '/usr/local/opt/llvm/lib/libunwind.dylib', building for macOS-arm64 but attempting to link with file built for macOS-x86_64
So..... how to fix this in order to keep things trucking?
For reference, here is my sessionInfo()
> sessionInfo()
R version 4.1.0 alpha (2021-04-26 r80229)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.2.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
loaded via a namespace (and not attached):
[1] compiler_4.1.0 tools_4.1.0 parallel_4.1.0

OK. This was due to setting some MAKEVARS from an older R installation.
I feel ashamed.
But, if anyone else is having this problem, look at ~/.R/Makevars
Now to solve gfortran issues.

Related

Problems with XLConnect library - Windows 64 bit

I just started with Rstudio programming and I have some issues with XLConnect.
I was able to install "XLConnect" package, then tried to load the "XLConnect" library and got an error as below.
library(XLConnect)
ERROR: package or namespace load failed for'XLconnect':
.onload failed in loadNamespace() for XLConnect, details:
Call. System2("cat",c("/etc/*-release"), stdout =TRUE, stderr = TRUE) error: ' "cat" not found.
sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=Italian_Switzerland.1252 LC_CTYPE=Italian_Switzerland.1252 LC_MONETARY=Italian_Switzerland.1252 LC_NUMERIC=C
[5] LC_TIME=Italian_Switzerland.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.0 tools_4.1.0 rJava_1.0-4
Any help would be really appreciated!
Thanks
This is a bug in XLConnect 1.0.3, where it requires cat to be installed on Windows. We fixed it in 1.0.4, so upgrading is the easiest way to fix the problem.
If for some reason you can't upgrade, you may try to install cat on Windows, e.g. using MINGW-w64.
See https://github.com/miraisolutions/xlconnect/issues/132 for the discussion.

Difficult installing R package pdftools

I am trying to install R package “pdftools” and encounter the following:
In file included from libqpdf/Pl_DCT.cc:1:
include/qpdf/Pl_DCT.hh:27:10: fatal error: 'jpeglib.h' file not found
#include <jpeglib.h>
^
1 error generated.
make: *** [libqpdf/Pl_DCT.o] Error 1
ERROR: compilation failed for package ‘qpdf’
I am using R version 3.3.3 on a mac with OS X 10.10.5 and can’t update my OS at the moment for a number of reasons.
I verified that the downloaded source packages are in:
/private/var/folders/t3/_mlp_5z15z9_628n5q00pw_s8d_kfs/T/RtmpnJERsz/downloaded_packages
I saw the following post:
'jpeglib.h' file not found
And ran
$ find /usr/local -name \*jpeg\* -print -name \*jpg\* -print
/usr/local/Cellar/boost/1.71.0/include/boost/gil/extension/io/jpeg
/usr/local/Cellar/boost/1.71.0/include/boost/gil/extension/io/jpeg.hpp
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Aliases/libjpeg
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Aliases/libjpeg-turbo
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpeg-archive.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpeg-turbo.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpeg.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpeginfo.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpegoptim.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpegrescan.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mjpegtools.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mozjpeg.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/openjpeg.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/recoverjpeg.rb
find: /usr/local/jamf: Permission denied
The file "jpeglib.h" does not seem to be listed, but I located it in: /anaconda3/pkgs/jpeg-9b-he5867d9_2/include/jpeglib.h
Based on other posts, I tried from terminal:
$ brew install boost. (Lot of installing, no errors)
$ brew doctor (Lot of installing, no errors)
$ xcode-select: error: command line tools are already installed, use "Software Update" to install updates
$ brew install cairo gobject-introspection pixman (Lot of installing, no errors)
Then rebooted and tried installing pdftools again with same result.
Also saw this post but it was completely over my head:
https://www.cocoanetics.com/2012/01/helping-xcode-find-library-headers/
Any solutions in simple steps appreciated.
Here is my session info, I couldn't include it into comments due to restriction.
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] pdftools_2.2
loaded via a namespace (and not attached):
[1] compiler_3.4.3 tools_3.4.3 pillar_1.2.1 tibble_1.4.2
[5] Rcpp_1.0.1 qpdf_1.1 rlang_0.3.0.1 askpass_1.1
I just installed pdftools w/o any problem. Upgrading your R version may solve your problem.

how to fix the error: Error in importIntoEnv(pkgenv, exports, nsenv, exports),cannot add bindings to a locked environment devtools-roxygen2?

After updating Rstudio and macOS, my package is no more loadable with devtools:
devtools::load_all(".")
Loading mgwrsar
Error in importIntoEnv(pkgenv, exports, nsenv, exports) :
cannot add bindings to a locked environment
I update the following packages: devtools, roxygen2 and rstudioapi, but it doesn't resolve this issue
I try to switch to hadley devtools version : install_github("hadley/devtools")
same issue.
My session info :
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.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/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
loaded via a namespace (and not attached):
[1] compiler_3.4.4 tools_3.4.4 yaml_2.1.19
You can also get this error from calling library(package) from within the package itself.
Duckmayr's response helped me solve my issue for this same problem:
Do you assign anything to the global environment in your package?
I had saved a new R script in my package project as mypackage/R/myscript.R instead of mypackage/separate_testing_folder/myscript.R. Of course, nothing but actual code pertaining to definition of functions etc should be saved in any scripts within the R/ directory.
In my case, I was accidentally referencing the name of my package INSIDE of my DESCRIPTION. Woops, something like this - I fixed it like so.
Package: utilities
Depends:
dplyr, # and comma here
utilities # remove this

Synchronizing R system settings from Terminal, GUI and RStudio

My problem on my MacOS is that I can use R from GUI (aka console, downloaded from CRAN), Terminal or from RStudio but I cannot have them function in the same way.
Specific example is I can use rJava on Terminal and RStudio but not on GUI. Similar stuff happens for Rmarkdown pdf outputs. I usually get errors from GUI but everything is fine on Terminal or RStudio. How do I update R GUI settings to the same as Terminal's?
ps. For instance R CMD javareconf command handled the Terminal R but not R GUI.
edit: It is not actually something that requires a minimal working example but let's try library(rJava) after installing it.
R Called from Terminal (same with RStudio)
No problems.
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] C/UTF-8/C/C/C/C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0
R GUI
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0
Some differences between Sys.getenv() are GUI has the following extra
LD_LIBRARY_PATH :#JAVA_LD#
DYLD_LIBRARY_PATH /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/server
Brief update: I was able to correct Rmarkdown situation by using this link and reading help by writing ?Startup on R console. Changed the Renviron file on my R.home()/etc/. But still no rJava.
For R Markdown problem, I managed to handle it by adding a ~/.Renviron file and defining PATH parameter with the value I got from Terminal's Sys.getenv() parameters.
The only thing that worked for rJava for High Sierra is the following answer (changed the version to 3.5 though)
https://stackoverflow.com/a/47685001/3608936

Re-initialize with packrat::init()

I have no idea how to make this problem reproducible, but here is a description of the problem nevertheless. I upgraded to R v 3.4.0 yesterday (sessionInfo() is below) and one of my RStudio projects couldn't update packages in packrat. After messing around with various "fixes" without success, I decided to delete packrat (packrat directory, project dir's .RStudio file) in the end. Unfortunately, I can't seem to re-initialize packrat in this project now. The following is the R output from
> packrat::init()
Initializing packrat project in directory:
- "~/my-project-path"
Error in isNamespaceLoaded(pkg) :
attempt to use zero-length variable name
In addition: Warning message:
In FUN(X[[i]], ...) : Package '' not available in repository or locally
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.0 magrittr_1.5 tools_3.4.0 yaml_2.1.14 stringi_1.1.5
[6] knitr_1.15.1 stringr_1.2.0 packrat_0.4.8-1 evaluate_0.10
Any help is very much appreciated. I thought about re-cloning the repo from github, but that would involve copy a large amount of files over from various directories that aren't under revision control currently.
Thanks!

Resources