From jinghuazhao at hotmail.com  Thu Apr 20 21:27:03 2017
From: jinghuazhao at hotmail.com (jing hua zhao)
Date: Thu, 20 Apr 2017 19:27:03 +0000
Subject: [Rd] Intel MKL compiling issue
In-Reply-To: <f3ba35fa-9409-23b3-a9db-3c7165a060b4@stats.ox.ac.uk>
References: <assp.1282c13225.1492604380.3239.81.camel@ipb-halle.de>
 <1492676507.12031.32.camel@iarc.fr>
 <LOXP123MB115888589BCC98C692154A1CA51B0@LOXP123MB1158.GBRP123.PROD.OUTLOOK.COM>,
 <f3ba35fa-9409-23b3-a9db-3c7165a060b4@stats.ox.ac.uk>
Message-ID: <LOXP123MB1158FC13DA78230C318B01EBA51B0@LOXP123MB1158.GBRP123.PROD.OUTLOOK.COM>

On our Scientific Linux 6, there is


gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)


and later version (a symbolic at HOME to the system directory),

export MKL=/home/jhz22/11.3.3.210/mkl
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MKLROOT/lib/intel64
./configure --prefix=/home/jhz22 LDFLAGS=-L/home/jhz22/lib CPPFLAGS=-I/home/jhz22/include  \
--enable-R-shlib --with-lapack \
--with-blas="-fopenmp -m64 -I$MKL/include -L$MKL/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lpthread -lm"


The errors are as follows,


/usr/bin/ld: warning: libpcre.so.1, needed by ../../lib/libR.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: liblzma.so.5, needed by ../../lib/libR.so, not found (try using -rpath or -rpath-link)
../../lib/libR.so: undefined reference to `pcre_exec'
../../lib/libR.so: undefined reference to `pcre_study'
../../lib/libR.so: undefined reference to `lzma_alone_decoder at XZ_5.0'
../../lib/libR.so: undefined reference to `pcre_fullinfo'
../../lib/libR.so: undefined reference to `lzma_stream_decoder at XZ_5.0'
../../lib/libR.so: undefined reference to `pcre_version'
../../lib/libR.so: undefined reference to `pcre_maketables'
../../lib/libR.so: undefined reference to `lzma_stream_encoder at XZ_5.0'
../../lib/libR.so: undefined reference to `pcre_free'
../../lib/libR.so: undefined reference to `lzma_raw_decoder at XZ_5.0'
../../lib/libR.so: undefined reference to `lzma_lzma_preset at XZ_5.0'
../../lib/libR.so: undefined reference to `lzma_version_string at XZ_5.0'
../../lib/libR.so: undefined reference to `pcre_jit_stack_alloc'
../../lib/libR.so: undefined reference to `pcre_free_study'
../../lib/libR.so: undefined reference to `lzma_crc64 at XZ_5.0'
../../lib/libR.so: undefined reference to `pcre_assign_jit_stack'
../../lib/libR.so: undefined reference to `lzma_end at XZ_5.0'
../../lib/libR.so: undefined reference to `lzma_raw_encoder at XZ_5.0'
../../lib/libR.so: undefined reference to `pcre_config'
../../lib/libR.so: undefined reference to `pcre_compile'
../../lib/libR.so: undefined reference to `lzma_code at XZ_5.0'
collect2: ld returned 1 exit status
make[3]: *** [R.bin] Error 1
make[3]: Leaving directory `/home/jhz22/R-devel/src/main'
make[2]: *** [R] Error 2
make[2]: Leaving directory `/home/jhz22/R-devel/src/main'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/home/jhz22/R-devel/src'
make: *** [R] Error 1


However, once --enable-R-shlib is dropped, the compile is successful. I suppose I can live with this though the option is required by RStudio. For the MKL version I reported earlier, I have on our RHEL6,


gcc --version

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)


The error is as follows -- I did try various versions of pcre and gcc 4.8.2 as well with similar error messages.


ranlib libR.a
gcc -std=gnu99 -Wl,--export-dynamic -fopenmp    -L/usr/local/lib64 -o R.bin Rmain.o CommandLineArgs.o Rdynload.o Renviron.o RNG.o agrep.o apply.o arithmetic.o array.o attrib.o bind.o builtin.o character.o coerce.o colors.o complex.o connections.o context.o cum.o dcf.o datetime.o debug.o deparse.o devices.o dotcode.o dounzip.o dstruct.o duplicate.o edit.o engine.o envir.o errors.o eval.o format.o gevents.o gram.o gram-ex.o graphics.o grep.o identical.o inlined.o inspect.o internet.o iosupport.o lapack.o list.o localecharset.o logic.o main.o mapply.o match.o memory.o names.o objects.o options.o paste.o platform.o plot.o plot3d.o plotmath.o print.o printarray.o printvector.o printutils.o qsort.o radixsort.o random.o raw.o registration.o relop.o rlocale.o saveload.o scan.o seq.o serialize.o sort.o source.o split.o sprintf.o startup.o subassign.o subscript.o subset.o summary.o sysutils.o times.o unique.o util.o version.o g_alab_her.o g_cntrlify.o g_fontdb.o g_her_glyph.o xxxpr.o   `ls ../unix/*.o ../appl/*.o ../nmath/*.o` ../extra/tre/libtre.a    -fopenmp -m64 -I/genetics/data/software/intel/composer_xe_2013.4.183/mkl/include -L/genetics/data/software/intel/composer_xe_2013.4.183/mkl/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lpthread -lm -lgfortran -lm   -lreadline  -lpcre -llzma -lbz2 -lz -lrt -ldl -lm
grep.o: In function `setup_jit':
/genetics/data/software/R-devel/src/main/grep.c:109: undefined reference to `pcre_assign_jit_stack'
/genetics/data/software/R-devel/src/main/grep.c:106: undefined reference to `pcre_jit_stack_alloc'
grep.o: In function `do_regexpr':
/genetics/data/software/R-devel/src/main/grep.c:2832: undefined reference to `pcre_free_study'
grep.o: In function `do_gsub':
/genetics/data/software/R-devel/src/main/grep.c:2116: undefined reference to `pcre_free_study'
grep.o: In function `do_grep':
/genetics/data/software/R-devel/src/main/grep.c:1109: undefined reference to `pcre_free_study'
grep.o: In function `do_strsplit':
/genetics/data/software/R-devel/src/main/grep.c:629: undefined reference to `pcre_free_study'
collect2: ld returned 1 exit status
make[3]: *** [R.bin] Error 1
make[3]: Leaving directory `/genetics/data/software/R-devel/src/main'
make[2]: *** [R] Error 2
make[2]: Leaving directory `/genetics/data/software/R-devel/src/main'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/genetics/data/software/R-devel/src'
make: *** [R] Error 1


________________________________
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Sent: 20 April 2017 16:48
To: jing hua zhao; r-devel at r-project.org
Subject: Re: [Rd] Intel MKL compiling issue

There is nothing here indicating any kind of error, so no way to give
any insights ....

And please do follow the posting guide, including not posting HTML.

FWIW, I have tested R 3.4.0 RC (sic) with MKL 11.3, which is later than
your 2013 ... (on x86_64 Fedora 24).


On 20/04/2017 10:39, jing hua zhao wrote:
> Dear R-developers,
>
>
> I would appreciate any insights over compiling R 3.4 with Intel MKL -- I have been successful until R 3.3.3 but now it stops complaining about pcre though it worked without Intel MKL as follows,
>
>
> ./configure LDFLAGS=-L/genetics/data/software/lib CFLAGS=-fPIC -I/genetics/data/software/include --enable-R-shlib
>
>
> I have used,
>
>
> export MKL_NUM_THREADS=15
> export MKLROOT=/genetics/data/software/intel/composer_xe_2013.4.183/mkl
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MKLROOT/lib/intel64
> /genetics/data/software/intel/composer_xe_2013.4.183/mkl/bin/mklvars.sh intel64
> CPPFLAGS="-I/genetics/data/software/include -L/genetics/data/software/lib" \
> ./configure --prefix=/genetics/data/software --enable-R-shlib --enable-threads=posix --with-lapack \
>  --with-blas="-fopenmp -m64 -I$MKLROOT/include -L$MKLROOT/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lpthread -lm"
>
>
> Many thanks,
>
>
>
> Jing Hua
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford

	[[alternative HTML version deleted]]



[Rd] Intel MKL compiling issue
jing hua zhao