[R-SIG-Mac] Build R with Intel Compiler

Simon Zehnder szehnder at uni-bonn.de
Fri Nov 8 10:05:03 CET 2013


Where does R in make install get its libraries/library paths from to be installed? I set DYLD_LIBRARY_PATH and libiomp5.dylib is on that path … Is there another variable to be set (DYLD_FALLBACK_LIBRARY_PATH I want to use only, if no other possibility remains). 

Best

Simon
On 07 Nov 2013, at 19:52, Simon Urbanek <simon.urbanek at r-project.org> wrote:

> 
> On Nov 7, 2013, at 1:30 PM, Simon Zehnder <szehnder at uni-bonn.de> wrote:
> 
>> Your and Brian’s guesses were right: the -openmp linker flag was it. It compiles now fine, though I get errors in make check-all and make install: 
>> 
>> Running a make check-all gives me (with and without flag -ipo)
>> 
>> Running examples in 'mgcv-Ex.R’ failed
>> ...
>> Loading required package: splines
>>> plot(b,pages=1)
>>> b<-gamm(y~s(x0,bs="tr",m=2)+s(x1,bs="ps",m=c(1,3))+
>> +          s(x2,bs="tr",m=3)+s(x3,bs="tr",m=2),data=dat)
>>> plot(b$gam,pages=1)
>> Warning in sqrt(rowSums((P$X %*% x$Vp[first:last, first:last, drop = FALSE]) *  :
>> NaNs produced
>> Error in if (se && pd[[i]]$se) { : missing value where TRUE/FALSE needed
>> Calls: plot -> plot.gam
>> Execution halted
>> 
>> A sudo make install gives me:
>> 
>> /opt/intel/composer_xe_2013_sp1.1.103/bin/intel64/icc -std=gnu99 -I. -I../../src/include -I../../../R-3.0.2/src/include -I/usr/X11/include/ -D__ACCELERATE__ -DHAVE_CONFIG_H    -fPIC  -O3 -ipo -openmp -xHost  -DR_HOME='"/usr/local/R/R-intel/R.framework/Versions/3.0/Resources"' -o Rscript \
>> 	  ../../../R-3.0.2/src/unix/Rscript.c
>> installing packages ...
>> building HTML index ...
>> dyld: Library not loaded: libiomp5.dylib
> 
> ^^ your Intel libs (or at least libiomp5) are missing paths in the id string - probably not installed properly? You can hack around that using DYLD_FALLBACK_LIBRARY_PATH but it's better to fix the issue in libiomp5 directly.
> 
> 
>> Referenced from: /Users/simonzehnder/Downloads/build/bin/exec/R
>> Reason: image not found
>> /bin/sh: line 1: 87375 Done                    echo "utils:::make.packages.html(.Library, verbose=FALSE, docdir=\"/usr/local/R/R-intel/R.framework/Versions/3.0/Resources/doc\")"
>>    87376 Trace/BPT trap: 5       | R_DEFAULT_PACKAGES=NULL LC_ALL=C ../../bin/R --vanilla --slave > /dev/null
>> make[2]: *** [install] Error 133
>> make[1]: *** [install] Error 1
>> make: *** [install] Error 1
>> 
>> It seems that it is connected with the MKL. I have in my MKL variable “-lmkl_gf_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread. It seems that libiomp5 is not linked to correctly. 
>> 
>> I uploaded also my config.log to https://gist.github.com/simonsays1980/7359508 
>> 
>> Best
>> 
>> Simon
>> 
>> 
>> 
>> On 07 Nov 2013, at 15:33, Simon Urbanek <simon.urbanek at r-project.org> wrote:
>> 
>>> 
>>> On Nov 7, 2013, at 7:56 AM, Simon Zehnder <szehnder at uni-bonn.de> wrote:
>>> 
>>>> I am trying to build R with an Intel Compiler (14.0.3). Has anyone before done it and could give me a hint for the configuration? 
>>>> 
>>>> I am sourcing the compilervars.sh for Intel and then configure R with 
>>>> 
>>>> ./R-3.0.2/configure OBJC="clang" --enable-R-framework=/usr/local/R/R-intel --x-includes=/usr/X11/include/ --x-libraries=/usr/X11/lib/ --enable-memory-profiling --with-blas="$MKL" --with-lapack
>>>> 
>>>> Further Variables are:
>>>> 
>>>> CFLAGS=“-O3 -ipo -openmp -xHost”
>>>> CXXFLAGS=“-O3 -ipo -openmp -xHost”
>>>> MKL=“-lmkl_gf_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread”!
>>>> 
>>>> I get always the same error:
>>>> 
>>>> /opt/intel/composer_xe_2013_sp1.1.103/bin/intel64/icc -std=gnu99 -I../../../R-3.0.2/src/extra/zlib -I../../../R-3.0.2/src/extra/bzip2 -I../../../R-3.0.2/src/extra/pcre -I../../../R-3.0.2/src/extra  -I../../../R-3.0.2/src/extra/xz/api -I. -I../../src/include -I../../../R-3.0.2/src/include -I/usr/local/include -DHAVE_CONFIG_H    -fPIC  -O3 -ipo -openmp -xHost  -c ../../../R-3.0.2/src/main/Rmain.c -o Rmain.o
>>>> /opt/intel/composer_xe_2013_sp1.1.103/bin/intel64/icc -std=gnu99  -L/usr/local/lib -o R.bin Rmain.o  -L../../lib -lR
>>>> Undefined symbols for architecture x86_64:
>>>> "___kmpc_begin", referenced from:
>>>>   _main in ipo_icc4xtjyH.o
>>>> "___kmpc_end", referenced from:
>>>>   _main in ipo_icc4xtjyH.o
>>>> ld: symbol(s) not found for architecture x86_64
>>>> 
>>>> Any clue what this could be? 
>>>> 
>>> 
>>> The above certainly won't work, because you're missing linker flags - I'm pretty sure that you must use -openmp in the linker for it to work, I'm not sure about -ipo -- but doesn't R detect all those automatically? I don't think you should put them in manually. The actual error comes from missing libguide link flags, but they may be implicit if you fix the other problem.
>>> 
>>> Cheers,
>>> S



More information about the R-SIG-Mac mailing list