Unresovled - RJava installation not working- C compiler cannot create executables

I'm having the same problem but I've installed Clang 6.0.0 and GNU Fortran 6.1, so I'm hoping to get a better solution. Also need to note that it's looking to access gcc/7.2.0 and I have version 9.2.0_1.

My error looks like this:

> install.packages("rJava", type = "source")
trying URL 'https://cran.rstudio.com/src/contrib/rJava_0.9-11.tar.gz'
Content type 'application/x-gzip' length 675188 bytes (659 KB)
downloaded 659 KB

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... /usr/local/Cellar/gcc/7.2.0/bin/gcc-7
checking whether the C compiler works... no
configure: error: in `/private/var/folders/27/rm0ty0c95p58_hbvcr6n38m40000gq/T/RtmpuHU4bp/R.INSTALL25375b87a773/rJava':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status

The downloaded source packages are in
1 Like

Hi, and welcome!

I'm guessing you're trying to install under MAC OS? Running compile errors down is very OS dependent. Can you provide OS/version?

Yes, thank you! I'm in macOS Mojave version 10.14.6

1 Like

If it's any comfort, I had the same problem, but decided against proceeding because I have Javarations about the language. I considered but didn't try this approach

Glad I'm not alone! Unfortunately I've ran through those solutions to no success. I have the latest JDK and an older version, and I've run sudo R CMD javareconf more times than I can count.

1 Like

Update - it's working now but with no explanation! Didn't restart the computer or anything, just let it sit for the night and when I tried it the next day it worked. Java is crazy.

1 Like