[R-SIG-Mac] rJava compilation on R 3.5 devel [SOLVED]
Marc Girondot
marc_grt at yahoo.fr
Wed Jan 31 14:03:52 CET 2018
I have found a solution based on the proposition of Keith. Thanks a lot
############
First I have made some cleaning because I had pieces of clang in many
places.
Then with a clean version I installed
clang-4.0.0-darwin15.6-Release.tar.gz using the version in
http://r.research.att.com/libs/clang-4.0.0-darwin15.6-Release.tar.gz
Note that it produced an error at the end when I run the command:
sudo tar xvzf clang-4.0.0-darwin15.6-Release.tar.gz -C /
The error is:
tar: Error exit delayed from previous errors.
But it seems to be ok
then I create the link as propose by Keith:
cd /usr/local/lib
sudo ln -s /usr/local/clang4/lib/libomp.dylib libomp.dylib
And it works perfectly if the install.packages("rJava") is ran as root:
sudo R
######################
Now, let try with clang 5.0.1 from homebrew.
First I delete all tracks of previous installation of clang4:
sudo cd <folder where is clang-4.0.0-darwin15.6-Release.tar.gz)>
# I use this trick to enter the root password firsttime; after it does
not ask within the loop
for file in $(tar tfz clang-4.0.0-darwin15.6-Release.tar.gz); do
sudo rm -f /$file;
done
# Remove empty _folders_ associated with the binary
for file in $(tar tfz clang-4.0.0-darwin15.6-Release.tar.gz); do
sudo rmdir -p /$file;
done
Then I install llvm with homebrew:
brew install llvm
in /usr/local/opt/llvm/lib there is no libomp.dylib but libgomp.dylib
and libiomp5.dylib. I don't know if I can use it instead of libomp.dylib.
But I see one in:
/Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libomp.dylib
Better to use this one:
cd /usr/local/lib
sudo ln -s
/Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libomp.dylib
libomp.dylib
And the compilation ran correctly.
Thanks a lot !
Marc
Le 31/01/2018 à 11:52, Keith O'Hara a écrit :
> Sorry, ignore the installation question, I missed the ‘brew install’ line.
>
> Try adding a symbolic link from the brew install of libomp to /usr/local/lib.
>
>
>
>> On Jan 31, 2018, at 5:38 AM, Keith O'Hara <keith.ohara at nyu.edu> wrote:
>>
>> Apple’s LLVM doesn’t support OpenMP, which explains the second error.
>>
>> How did you install clang-5.0.1? If you installed using MacPorts, then you might need to create a symbolic link to libomp in /usr/local/lib. Check if the following exists:
>>
>> /opt/local/lib/libomp/libomp.dylib
>>
>>
>>
>>> On Jan 31, 2018, at 5:22 AM, Marc Girondot via R-SIG-Mac <r-sig-mac at r-project.org> wrote:
>>>
>>> Dear Experts,
>>>
>>> I use now r-3.5 devel as it is stable (from http://r.research.att.com , version (2018/01/30, r74185) ) but I have a problem with compilation of rJava package.
>>>
>>> In short (all the explanations are bellow):
>>>
>>> If I use clang 4.0.0 from here: http://r.research.att.com/libs/, I get this error: ld: library not found for -lomp
>>>
>>> If I use clang from xcode, I get this error: clang: error: unsupported option '-fopenmp'
>>>
>>> If I use clang 5.0.1, I get this error: ld: library not found for -lomp
>>>
>>> Any idea to have rJava in r-devel ?
>>>
>>> Thanks a lot
>>>
>>> Marc
>>>
>>>
>>>
>>> First I ran:
>>>
>>> sudo R CMD javareconf
>>>
>>> I have the Java version : 1.8.0_162
>>>
>>> I need to compile it from source but it failed with clang4 reporting an error.
>>>
>>> I try various origin of clang:
>>>
>>> at the beginning of the compilation, it said:
>>>
>>> checking for gcc... /usr/local/clang4/bin/clang
>>>
>>> I tried several version of clang:
>>>
>>> belinda:local marcgirondot$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --version
>>> Apple LLVM version 9.0.0 (clang-900.0.39.2)
>>> Target: x86_64-apple-darwin17.3.0
>>> Thread model: posix
>>> InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
>>>
>>> or (same version installed by: brew install llvm )
>>>
>>> belinda:local marcgirondot$ /Applications/clang+llvm-5.0.1-final-x86_64-apple-darwin/bin/clang --version
>>> clang version 5.0.1 (tags/RELEASE_501/final)
>>> Target: x86_64-apple-darwin17.3.0
>>> Thread model: posix
>>> InstalledDir: /Applications/clang+llvm-5.0.1-final-x86_64-apple-darwin/bin
>>>
>>> or
>>>
>>> belinda:local marcgirondot$ /usr/local/clang4/bin/clang --version
>>> clang version 4.0.0 (tags/RELEASE_400/final)
>>> Target: x86_64-apple-darwin17.3.0
>>> Thread model: posix
>>> InstalledDir: /usr/local/clang4/bin
>>>
>>> If I use the former, I get this error:
>>> /usr/local/clang4/bin/clang -o libjri.jnilib Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o -dynamiclib -framework JavaVM -fopenmp -L/usr/local/lib -F/Library/Frameworks/R.framework/.. -framework R -lpcre -llzma -lbz2 -lz -licucore -lm -liconv
>>> 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’
>>>
>>> Then I tried more recent versions:
>>>
>>> I make a symbolic link to clang 5.0.1 or the one within xcode:
>>> cd /usr/local
>>> sudo ln -s /Applications/clang+llvm-5.0.1-final-x86_64-apple-darwin clang4
>>>
>>> I get this error: (after running sudo R and within R: install.packages("rJava")
>>> /usr/local/clang4/bin/clang -o libjri.jnilib Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o -dynamiclib -framework JavaVM -fopenmp -L/usr/local/lib -F/Library/Frameworks/R.framework/.. -framework R -lpcre -llzma -lbz2 -lz -licucore -lm -liconv
>>> ld: library not found for -lomp
>>> clang-5.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’
>>>
>>>
>>> If I make the symbolic link to
>>> cd /usr/local
>>> sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr clang4
>>>
>>> I get this error: (after running sudo R and within R: install.packages("rJava")
>>> /usr/local/clang4/bin/clang -o libjri.jnilib Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o -dynamiclib -framework JavaVM -fopenmp -L/usr/local/lib -F/Library/Frameworks/R.framework/.. -framework R -lpcre -llzma -lbz2 -lz -licucore -lm -liconv
>>> clang: error: unsupported option '-fopenmp'
>>> make[2]: *** [libjri.jnilib] Error 1
>>> make[1]: *** [src/JRI.jar] Error 2
>>> make: *** [jri] Error 2
>>> ERROR: compilation failed for package ‘rJava’
>>>
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
More information about the R-SIG-Mac
mailing list