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

RStudio 1.2.1578 fails to start on Mac #5432

Closed
ivanek opened this issue Sep 19, 2019 · 12 comments
Closed

RStudio 1.2.1578 fails to start on Mac #5432

ivanek opened this issue Sep 19, 2019 · 12 comments
Labels
info needed Additional information requested—reprex, steps, open question, etc.

Comments

@ivanek
Copy link

ivanek commented Sep 19, 2019

System details

RStudio Edition : Desktop
RStudio Version : 1.2.1578
OS Version      :  macOS 10.14.6
R Version       :   3.6.1 Patched (2019-09-14 r77193)

Steps to reproduce the problem

Install RStusio 1.2.1578 (dmg downloaded from the website)
Started Rstudio with /Applications/RStudio.app/Contents/MacOS/RStudio

Describe the problem in detail

There is an error message in the terminal: "Uncaught TypeError: Cannot read property 'notifyRCrashed' of undefined"
And the RStudio fails to start, showing only white window with text:

This site can’t be reached
127.0.0.1 refused to connect.
Try:

Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED 

Describe the behavior you expected

Should simply start (the version 1.2.1335 starts normally).

  1. The output of sessionInfo()
R version 3.6.1 Patched (2019-09-14 r77193)
Platform: x86_64-apple-darwin18.7.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /usr/local/lib/R/lib/libRblas.dylib
LAPACK: /usr/local/lib/R/lib/libRlapack.dylib

locale:
[1] C/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.6.1
  1. The R code in question <none>

  2. A diagnostics report from affected version is not created.

Command: /Applications/RStudio.app/Contents/MacOS/RStudio --run-diagnostics shows only following:

Using R script: /usr/local/bin/R

Attempting to launch R session...
  R_HOME=/usr/local/lib/R
  R_DOC_DIR=/usr/local/lib/R/doc
  R_INCLUDE_DIR=/usr/local/lib/R/include
  R_SHARE_DIR=/usr/local/lib/R/share
  PATH=/Users/ivanek/perl5/bin:/usr/local/opt/mysql-client/bin:/usr/local/opt/libxml2/bin:/usr/local/opt/tcl-tk/bin:/usr/local/bin:/usr/local/sbin:/Users/ivanek/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS
  HOME=/Users/ivanek

R session launched, attempting to connect on port 24591...
dyld: Library not loaded: libRblas.dylib
  Referenced from: /usr/local/lib/R/lib/libR.dylib
  Reason: image not found

Connected to R session, attempting to initialize...

However the version 1.2.1335 (which works) creates this diagnostic report:

[1] "1.2.1335"

$R
[1] "/usr/local/bin/R"

$pdflatex
[1] "/usr/local/bin/pdflatex"

$bibtex
[1] "/usr/local/bin/bibtex"

$gcc
[1] "/usr/bin/gcc"

$git
[1] "/usr/bin/git"

$svn
[1] "/usr/bin/svn"

R version 3.6.1 Patched (2019-09-14 r77193)
Platform: x86_64-apple-darwin18.7.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /usr/local/lib/R/lib/libRlapack.dylib

locale:
[1] C/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.6.1 tools_3.6.1   

SysInfo:
                                                                                           sysname 
                                                                                          "Darwin" 
                                                                                           release 
                                                                                          "18.7.0" 
                                                                                           version 
"Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64" 
                                                                                          nodename 
                                                                        "dbm203-190.dbm.unibas.ch" 
                                                                                           machine 
                                                                                          "x86_64" 
                                                                                             login 
                                                                                          "ivanek" 
                                                                                              user 
                                                                                          "ivanek" 
                                                                                    effective_user 
                                                                                          "ivanek" 

R Version:
               _                                          
platform       x86_64-apple-darwin18.7.0                  
arch           x86_64                                     
os             darwin18.7.0                               
system         x86_64, darwin18.7.0                       
status         Patched                                    
major          3                                          
minor          6.1                                        
year           2019                                       
month          09                                         
day            14                                         
svn rev        77193                                      
language       R                                          
version.string R version 3.6.1 Patched (2019-09-14 r77193)
nickname       Action of the Toes                         
$Apple_PubSub_Socket_Render
[1] "/private/tmp/com.apple.launchd.iVF7kYsCiZ/Render"

$CLICOLOR_FORCE
[1] "1"

$COLORFGBG
[1] "15;0"

$COLORTERM
[1] "truecolor"

$CPPFLAGS
[1] "-I/usr/local/opt/openblas/include"

$DISPLAY
[1] "/private/tmp/com.apple.launchd.m3W9YpYJVg/org.macosforge.xquartz:0"

$DYLD_FALLBACK_LIBRARY_PATH
[1] "/usr/local/lib/R/lib:/Users/ivanek/lib:/usr/local/lib:/usr/lib:::/lib:/Library/Java/JavaVirtualMachines/adoptopenjdk-12.jdk/Contents/Home/lib/server"

$EDITOR
[1] "vi"

$GIT_ASKPASS
[1] "rpostback-askpass"

$HISTCONTROL
[1] "ignoreboth:erasedups"

$HOME
[1] "/Users/ivanek"

$ITERM_ORIG_PS1
[1] "\\[\033[32m\\]\\u@\\h\\[\033[37m\\]:\\[\033[34m\\]\\W\\[\033[37m\\]$ \\[\033(B\033[m\\]"

$ITERM_PREV_PS1
[1] "\\[\033]133;D;$?\a\033]133;A\a\\]\\[\033[32m\\]\\u@\\h\\[\033[37m\\]:\\[\033[34m\\]\\W\\[\033[37m\\]$ \\[\033(B\033[m\\]\\[\033]133;B\a\\]"

$ITERM_PROFILE
[1] "Default"

$ITERM_SESSION_ID
[1] "w0t4p0:7F2BE21C-E335-4C6A-82D1-5BA0354A19D2"

$LANG
[1] "en_US.UTF-8"

$LC_COLLATE
[1] "C"

$LC_CTYPE
[1] "en_US.UTF-8"

$LC_TERMINAL
[1] "iTerm2"

$LC_TERMINAL_VERSION
[1] "3.3.4"

$LC_TYPE
[1] "en_US.UTF-8"

$LDFLAGS
[1] "-L/usr/local/opt/openblas/lib"

$LN_S
[1] "ln -s"

$LOGNAME
[1] "ivanek"

$MAKE
[1] "make"

$PAGER
[1] "/usr/bin/less"

$PATH
[1] "/Users/ivanek/perl5/bin:/usr/local/opt/mysql-client/bin:/usr/local/opt/libxml2/bin:/usr/local/opt/tcl-tk/bin:/usr/local/bin:/usr/local/sbin:/Users/ivanek/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS"

$PERL5LIB
[1] "/Users/ivanek/perl5/lib/perl5"

$PERL_LOCAL_LIB_ROOT
[1] "/Users/ivanek/perl5"

$PERL_MB_OPT
[1] "--install_base \"/Users/ivanek/perl5\""

$PERL_MM_OPT
[1] "INSTALL_BASE=/Users/ivanek/perl5"

$PKG_CONFIG_PATH
[1] "/usr/local/opt/openblas/lib/pkgconfig"

$PS1
[1] "\\[\033[32m\\]\\u@\\h\\[\033[37m\\]:\\[\033[34m\\]\\W\\[\033[37m\\]$ \\[\033(B\033[m\\]"

$PWD
[1] "/Users/ivanek"

$RMARKDOWN_MATHJAX_PATH
[1] "/Applications/RStudio.app/Contents/Resources/resources/mathjax-26"

$RSTUDIO
[1] "1"

$RSTUDIO_CONSOLE_COLOR
[1] "256"

$RSTUDIO_CONSOLE_WIDTH
[1] "80"

$RSTUDIO_PANDOC
[1] "/Applications/RStudio.app/Contents/MacOS/pandoc"

$RSTUDIO_SESSION_PORT
[1] "28617"

$RSTUDIO_USER_IDENTITY
[1] "ivanek"

$RSTUDIO_WINUTILS
[1] "bin/winutils"

$RS_PPM_FD_READ
[1] "15"

$RS_PPM_FD_WRITE
[1] "16"

$RS_RPOSTBACK_PATH
[1] "/Applications/RStudio.app/Contents/MacOS/rpostback"

$RS_SHARED_SECRET
[1] "2824752491622650073984943658"

$R_BROWSER
[1] "/usr/bin/open"

$R_BZIPCMD
[1] "/usr/bin/bzip2"

$R_DOC_DIR
[1] "/usr/local/lib/R/doc"

$R_GZIPCMD
[1] "/usr/bin/gzip"

$R_HOME
[1] "/usr/local/lib/R"

$R_INCLUDE_DIR
[1] "/usr/local/lib/R/include"

$R_LIBS_SITE
[1] ""

$R_LIBS_USER
[1] "~/Library/R/3.6/library"

$R_PAPERSIZE
[1] "a4"

$R_PDFVIEWER
[1] "/usr/bin/open"

$R_PLATFORM
[1] "x86_64-apple-darwin18.7.0"

$R_PRINTCMD
[1] "lpr"

$R_RD4PDF
[1] "times,inconsolata,hyper"

$R_SESSION_TMPDIR
[1] "/var/folders/cb/xv8tc7250x132tsz1l0rpqzw0000gr/T//Rtmpd7kYUB"

$R_SHARE_DIR
[1] "/usr/local/lib/R/share"

$R_STRIP_SHARED_LIB
[1] "strip -x"

$R_STRIP_STATIC_LIB
[1] "strip -S"

$R_SYSTEM_ABI
[1] "osx,gcc,gxx,gfortran,gfortran"

$R_TEXI2DVICMD
[1] "/usr/local/Cellar/texinfo/6.6/bin/texi2dvi"

$R_UNZIPCMD
[1] "/usr/bin/unzip"

$R_ZIPCMD
[1] "/usr/bin/zip"

$SED
[1] "/usr/bin/sed"

$SHELL
[1] "/bin/bash"

$SHLVL
[1] "1"

$SSH_ASKPASS
[1] "rpostback-askpass"

$SSH_AUTH_SOCK
[1] "/private/tmp/com.apple.launchd.m6hl01oM2s/Listeners"

$TAR
[1] "/usr/bin/tar"

$TERM
[1] "xterm-256color"

$TERM_PROGRAM
[1] "iTerm.app"

$TERM_PROGRAM_VERSION
[1] "3.3.4"

$TERM_SESSION_ID
[1] "w0t4p0:7F2BE21C-E335-4C6A-82D1-5BA0354A19D2"

$TMPDIR
[1] "/var/folders/cb/xv8tc7250x132tsz1l0rpqzw0000gr/T/"

$TZ
[1] "Europe/Zurich"

$USER
[1] "ivanek"

$XPC_FLAGS
[1] "0x0"

$XPC_SERVICE_NAME
[1] "0"

$`_`
[1] "/Applications/RStudio.app/Contents/MacOS/RStudio"

$`__CF_USER_TEXT_ENCODING`
[1] "0x1F8:0x0:0x0"

 [1] ".GlobalEnv"        "tools:rstudio"     "package:stats"     "package:graphics"  "package:grDevices"
 [6] "package:utils"     "package:datasets"  "package:methods"   "Autoloads"         "package:base"     
Log file: rdesktop.log
--------------------------------------------------

(Empty)

Log file: rsession-ivanek.log
--------------------------------------------------

16 Sep 2019 09:42:03 [rsession-ivanek] ERROR system error 2 (No such file or directory) [path=/Users/ivanek/.Rhistory]; OCCURRED AT: rstudio::core::Error rstudio::core::FilePath::open_w(boost::shared_ptr<std::ostream> *, bool) const /Users/vagrant/workspace/IDE/macos-v1.2/src/cpp/core/FilePath.cpp:1165; LOGGED FROM: void rstudio::r::session::reportHistoryAccessError(const std::string &, const rstudio::core::FilePath &, const rstudio::core::Error &) /Users/vagrant/workspace/IDE/macos-v1.2/src/cpp/r/session/RInit.cpp:391
16 Sep 2019 09:56:02 [rsession-ivanek] WARNING Process supervisor did not terminate within 1 second; LOGGED FROM: void (anonymous namespace)::rCleanup(bool) /Users/vagrant/workspace/IDE/macos-v1.2/src/cpp/session/SessionMain.cpp:1193
16 Sep 2019 15:04:25 [rsession-ivanek] WARNING Private command disabled, unsupported $HISTCONTROL: [ignoreboth:erasedups]; LOGGED FROM: bool rstudio::core::terminal::PrivateCommand::output(const std::string &) /Users/vagrant/workspace/IDE/macos-v1.2/src/cpp/core/terminal/PrivateCommand.cpp:243
@ronblum
Copy link
Contributor

ronblum commented Sep 19, 2019

@ivanek Thank you for raising this issue. I can't reproduce it, both with the initial R 3.6.1 and the 9/14 patched version. Can you try resetting RStudio's state—any change in behavior? https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-Desktop-s-State

@kevinushey
Copy link
Contributor

How did you install R? It looks like you're not using CRAN R.

@kevinushey
Copy link
Contributor

I have a copy of R built from sources on my own machine that I can run against RStudio without issue so I suspect there is something unique about the copy of R you have installed.

@ivanek
Copy link
Author

ivanek commented Sep 19, 2019

I reset the preferences, but that did not help.

My R installation: I installed the required libraries using brew and afterwards I compiled R itself form source. I did not have any issue with that before. The error message is a bit cryptic for me. What could be the problem with openblas? The older version of Rstudio starts fine.

otool -L /usr/local/lib/R/lib/libR.dylib
/usr/local/lib/R/lib/libR.dylib:
	libR.dylib (compatibility version 3.6.0, current version 3.6.1)
	libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/gcc/lib/gcc/9/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
	/usr/local/opt/gcc/lib/gcc/9/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1575.17.0)
	/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
	/usr/local/opt/pcre/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.11.0)
	/usr/local/opt/xz/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.4.0)
	/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 62.1.0)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

and

otool -L /usr/local/lib/R/lib/libRblas.dylib
/usr/local/lib/R/lib/libRblas.dylib:
	libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/gcc/lib/gcc/9/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
	/usr/local/opt/gcc/lib/gcc/9/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

@ronblum ronblum added the info needed Additional information requested—reprex, steps, open question, etc. label Sep 19, 2019
@ivanek
Copy link
Author

ivanek commented Sep 19, 2019

What would be the way to debug it further? (the issue persists also with RStudio-daily)

@kevinushey
Copy link
Contributor

kevinushey commented Sep 19, 2019

You can try fixing the library lookup path:

install_name_tool -change \
    libRblas.dylib /usr/local/lib/R/lib/libRblas.dylb \
    /usr/local/lib/R/lib/libR.dylib

It looks like my locally-compiled version of R works because I compiled and linked to an external BLAS.

@kevinushey
Copy link
Contributor

And compare that with what you see with a regular CRAN build of R:

kevinushey@Kevins-MacBook-Pro:/Library/Frameworks/R.framework/Resources/lib
$ otool -L libR.dylib
libR.dylib:
        /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib (compatibility version 3.6.0, current version 3.6.1)
        /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
        /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
        /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1259.11.0)
        /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libreadline.5.2.dylib (compatibility version 5.0.0, current version 5.2.0)
        /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
        /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 55.1.0)
        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libomp.dylib (compatibility version 5.0.0, current version 5.0.0)

Note that libRblas.dylib is explicitly referenced with a full path.

@kevinushey
Copy link
Contributor

And finally -- these restricted are being imposed upon us by Apple with the hardened runtime; there's not much more we can do on the RStudio side about this.

@ivanek
Copy link
Author

ivanek commented Sep 20, 2019

Indeed, the relative path to the R lib files might be an issue. If I start the RStudio from /usr/local/lib/R/lib directory, it starts fine. However I cannot switch to any projects. It starts to complain about the missing libR.dylib library. Now I need to figure out how to install R and also packages with absolute path for lib files.

@kevinushey
Copy link
Contributor

Did you see my advice regarding the use of install_name_tool? That lets you change these library paths as necessary.

@ivanek
Copy link
Author

ivanek commented Sep 23, 2019

I had to execute install_name_tool on several libraries:

  1. On R libs and libs from default packages in order to start the Rstudio:
install_name_tool -change libR.dylib /usr/local/lib/R/lib/libR.dylib /usr/local/lib/R/lib/libRblas.dylib
install_name_tool -change libRblas.dylib /usr/local/lib/R/lib/libRblas.dylib /usr/local/lib/R/lib/libR.dylib
install_name_tool -change libR.dylib /usr/local/lib/R/lib/libR.dylib /usr/local/lib/R/lib/libRlapack.dylib
install_name_tool -change libRblas.dylib /usr/local/lib/R/lib/libRblas.dylib /usr/local/lib/R/lib/libRlapack.dylib


install_name_tool -change libR.dylib /usr/local/lib/R/lib/libR.dylib /usr/local/lib/R/library/utils/libs/utils.so
install_name_tool -change libR.dylib /usr/local/lib/R/lib/libR.dylib /usr/local/lib/R/library/grDevices/libs/grDevices.so
  1. There were still error messages that default libraries cannot be loaded, so I applied it to few others:
install_name_tool -change libR.dylib /usr/local/lib/R/lib/libR.dylib /usr/local/lib/R/library/methods/libs/methods.so
install_name_tool -change libR.dylib /usr/local/lib/R/lib/libR.dylib /usr/local/lib/R/library/stats/libs/stats.so
install_name_tool -change libRblas.dylib /usr/local/lib/R/lib/libRblas.dylib /usr/local/lib/R/library/stats/libs/stats.so
install_name_tool -change libRlapack.dylib /usr/local/lib/R/lib/libRlapack.dylib /usr/local/lib/R/library/stats/libs/stats.so
install_name_tool -change libR.dylib /usr/local/lib/R/lib/libR.dylib /usr/local/lib/R/library/tools/libs/tools.so
  1. Plus the following, but these were not directly required.
install_name_tool -change libR.dylib /usr/local/lib/R/lib/libR.dylib /usr/local/lib/R/library/grDevices/libs/cairo.so
install_name_tool -change libR.dylib /usr/local/lib/R/lib/libR.dylib /usr/local/lib/R/library/graphics/libs/graphics.so

Afterwards Rstudio can start, however I cannot load other libraries (almost each lib complains about the missing path to libR.dylib library. So I would have to check each *.so file if the links are absolute.

On top of it, the help pages do not work, there is this error message:

Error in tools::startDynamicHelp() : internet routines cannot be loaded

@ivanek
Copy link
Author

ivanek commented Sep 23, 2019

After reinstalling R into /Library/Frameworks/R.framework everything works. Thanks for help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info needed Additional information requested—reprex, steps, open question, etc.
Projects
None yet
Development

No branches or pull requests

3 participants