问题
recently I installed Microsoft R Open 3.3.1 on my MacBook Pro (El Capitan 10.11.6). When I open RStudio or I use the R console I get this warning message:
Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
unable to load shared object '/Library/Frameworks/R.framework/Resources/modules//R_X11.so':
dlopen(/Library/Frameworks/R.framework/Resources/modules//R_X11.so, 6): Symbol not found: _CGBitmapContextCreate
Referenced from: /Library/Frameworks/R.framework/Resources/modules//R_X11.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Resources/modules//R_X11.so
Do you know a way to prevent the printing of the message (or solve the issue)?
Thanks!
回答1:
For a CRAN R installation, I see that R_X11.so
references the following libraries:
kevin@MBP:/Library/Frameworks/R.framework/Resources/modules
$ otool -L R_X11.so
R_X11.so:
R_X11.so (compatibility version 0.0.0, current version 0.0.0)
/opt/X11/lib/libSM.6.dylib (compatibility version 7.0.0, current version 7.1.0)
/opt/X11/lib/libICE.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/opt/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/opt/X11/lib/libXext.6.dylib (compatibility version 11.0.0, current version 11.0.0)
/opt/X11/lib/libXrender.1.dylib (compatibility version 5.0.0, current version 5.0.0)
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
/opt/X11/lib/libXt.6.dylib (compatibility version 7.0.0, current version 7.0.0)
/opt/X11/lib/libXmu.6.dylib (compatibility version 9.0.0, current version 9.0.0)
/Library/Frameworks/R.framework/Versions/3.3/Resources/lib/libR.dylib (compatibility version 3.3.0, current version 3.3.1)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.17.0)
That library does not reference the symbol you suggest:
kevin@MBP:/Library/Frameworks/R.framework/Resources/modules
$ nm R_X11.so | grep CGBitmap
However, for an MRO installation, I see the following libraries + symbols:
kevin@MBP:/Volumes/Samsung 850 EVO/Library/Frameworks/R.framework/Resources/modules
$ otool -L R_X11.so
R_X11.so:
R_X11.so (compatibility version 0.0.0, current version 0.0.0)
/opt/X11/lib/libSM.6.dylib (compatibility version 7.0.0, current version 7.1.0)
/opt/X11/lib/libICE.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/opt/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/opt/X11/lib/libXext.6.dylib (compatibility version 11.0.0, current version 11.0.0)
/opt/X11/lib/libXrender.1.dylib (compatibility version 5.0.0, current version 5.0.0)
/usr/lib/libexpat.1.dylib (compatibility version 7.0.0, current version 7.2.0)
/opt/X11/lib/libXt.7.dylib (compatibility version 8.0.0, current version 8.0.0)
/opt/X11/lib/libXmu.6.dylib (compatibility version 9.0.0, current version 9.0.0)
/Library/Frameworks/R.framework/Versions/3.3.1-MRO/Resources/lib/libR.dylib (compatibility version 3.3.0, current version 3.3.1)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1255.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.1.1)
with referenced symbols:
kevin@MBP:/Volumes/Samsung 850 EVO/Library/Frameworks/R.framework/Resources/modules
$ nm R_X11.so | grep CGBitmap
U _CGBitmapContextCreate
These symbols are normally provided by the CoreGraphics.framework
:
kevin@MBP:/System/Library/Frameworks/CoreGraphics.framework/Versions/A
$ nm CoreGraphics | grep CGBitmapContext
0000000000046321 T _CGBitmapContextCreate
< ... other symbols ... >
However, the MRO-generated R_X11.so
does not link to that, and so lookup of those symbols fails.
tl;dr: Microsoft is shipping you broken software that does not contain links to the libraries providing the symbols it needs. Use the CRAN-provided binaries of R instead.
回答2:
I had the issue also. The issue had been solved after installing XQuartz and then re-logining the system.
Note: the use of X11 (including tcltk) requires XQuartz to be installed since it is no longer part of OS X. Always re-install XQuartz when upgrading your OS X to a new major version.
来源:https://stackoverflow.com/questions/39618269/warning-message-when-opening-rstudio-or-the-r-console