Reputation: 816
When I try to install the package RGtk2 I get the following error:
> install.packages("RGtk2")
Package which is only available in source form, and may need
compilation of C/C++/Fortran: ‘RGtk2’
Do you want to attempt to install these from sources?
y/n: y
installing the source package ‘RGtk2’
trying URL 'https://cran.rstudio.com/src/contrib/RGtk2_2.20.33.tar.gz'
Content type 'application/x-gzip' length 2792938 bytes (2.7 MB)
==================================================
downloaded 2.7 MB
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for INTROSPECTION... no
checking for GTK... no
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’
Warning in install.packages :
installation of package ‘RGtk2’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/m4/l02774c51vx71qt6_wdq59lw0000gn/T/Rtmpa7sxIS/downloaded_packages’
>
I am running macOS Sierra (Version 10.12.4) and R version 3.4.0.
Upvotes: 3
Views: 5618
Reputation: 1699
when I tried to install RGtk2 this comes up... I checked which gcc
and it shows a c compiler. why does it say that C compiler is not working?
$ R CMD INSTALL ~/Downloads/RGtk2_2.20.33.tar.gz
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library’
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for INTROSPECTION... no
checking for GTK... yes
checking for GTHREAD... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/private/var/folders/xh/kw0cr4xj52zd9pd8t46d6xwh0000gn/T/RtmpnYEC6D/R.INSTALL13a7b3357df80/RGtk2':
configure: error: C compiler cannot create executables
See `config.log' for more details.
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’
Upvotes: 0
Reputation: 153
I assume you have R and RStudio installed already. If not, install it. Then do the following.
1) Install XQuartz
2) Install GTK 2.24.17-X11
3) Download cairoDevice and RGtk2
4) From terminal run R CMD INSTALL ~/Downloads/cairoDevice_2.24.tar.gz
5) Install Homebrew for Mac.
6) From terminal type the following commands:
brew uninstall cairo --ignore-dependencies
brew install --with-x11 cairo
7) Type brew edit gtk+
in terminal and scroll to def install section and edit the reference with quartz to (press i to edit and to save and exit, press escape key and type colon (shift+ semi colon key). Then type wq.)
"--with-gdktarget=x11",
"--enable-x11-backend"
8) Then type brew install --build-from-source --verbose gtk+
in the same terminal window.
9) Then type export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib/pkgconfig/gtk+-2.0.pc:/opt/X11/lib/pkgconfig
10) Type R CMD INSTALL ~/Downloads/RGtk2_2.20.33.tar.gz
from the same terminal window.
Hopefully it will work for you.
Upvotes: 2
Reputation: 9
Following the directions on this website will likely be helpful: https://gist.github.com/sebkopf/9405675.
Be sure to read the additional conversations after the post for useful modifications.
Upvotes: -1
Reputation: 263362
You probably don't have GTK installed in your system (outside of R). You can try an install from the GTK package in the ../libs/ directory here:
http://r.research.att.com/libs/
Probably need XQuartz, Xcode of the proper version for your macOS version and the correct Command Line Tools first. The download and install code for the bash-install are at the bottom of that /libs/ page.
Upvotes: 0