0

I've been trying to troubleshoot installation of rJava in R (3.4.2) on my Mac OS Sierra 10.12.6. I've followed the advice I've found about OpenMP issues (http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/). The error I'm getting now, though, identifies the library not found as '-lomp' instead of '-fopenmp.' I'm not sure how to proceed from here.

Here's what it looks like when it hits the error:

ld: library not found for -lomp
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/y_/0bm1vdx95dn4m8x_xtctp2gh0000gn/T/RtmpfslTnc/downloaded_packages’

2 Answers2

2

I had the same issue, and fixed it by creating a link to the library (libomp.dylib) in a directory where it can be found (/usr/local/lib/), as explained here.

smoore
  • 21
  • 3
0

Take a look here for full description of how to compile most recent Java inside OSX.

Note that you need clang with omp support - it is not available directly from Apple: http://www.owsiak.org/r-3-4-rjava-macos-and-even-more-mess/

You need to:

  • get clang from llvm page
  • configure R to use JDK of your choice
  • compile rJava from sources
Oo.oO
  • 12,464
  • 3
  • 23
  • 45