From plummerm at iarc.fr  Wed Apr 22 17:30:22 2015
From: plummerm at iarc.fr (Martyn Plummer)
Date: Wed, 22 Apr 2015 15:30:22 +0000
Subject: [Rd] shlib problems with Intel compiler
In-Reply-To: <9D2F27BD-240B-419F-8C0A-CCC3B1B4D680@noaa.gov>
References: <9D2F27BD-240B-419F-8C0A-CCC3B1B4D680@noaa.gov>
Message-ID: <1429716621.24336.53.camel@iarc.fr>

On Tue, 2015-04-21 at 11:46 -0600, Andy Jacobson (NOAA Affiliate) wrote:
> Hi,
> 
> I'm encountering trouble compiling caTools_1.17.1.tar.gz and
> e1071_1.6-4.tar.gz on a Linux system using the Intel compiler suite.
> 14 other packages I generally use installed without any trouble.  I
> notice both of these trouble packages have a C++ component, so I
> wonder if that might be the issue.  Below, there's information on my
> platform, compiler, and some diagnostic output showing the errors.
> 
> Advice appreciated!
> 
> Thanks,
> 
> Andy

There are two things missing when R tries to create the shared object
file on this line:

icpc -L/usr/local/lib64 -o e1071.so Rsvm.o cmeans.o cshell.o floyd.o
svm.o

Firstly, the compiler flag "-shared" is missing. It tells the compiler
to build a shared object instead of an executable. Secondly the linker
flag "-lR" is missing, along with the "-L" flag that tells the linker
where to find the shared R library.

To find out what went wrong, you should share the configuration you used
when building R.

Martyn

> 
> 
> Intel compiler suite:  icc (ICC) 14.0.2 20140120
> 
> sessionInfo() reports:
> 
> R version 3.1.3 (2015-03-09)
> Platform: x86_64-unknown-linux-gnu (64-bit)
> Running under: Red Hat Enterprise Linux Server release 6.5 (Santiago)
> 
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base     
> 
> loaded via a namespace (and not attached):
> [1] tools_3.1.3
> 
> 
> Abbreviated versions of the output from R CMD INSTALL:
> 
> For caTools:
> 
> * installing to library ?/scratch3/BMC/co2/lib/R-3.1/x86_64-unknown-linux-gnu?
> * installing *source* package ?caTools? ...
> ** package ?caTools? successfully unpacked and MD5 sums checked
> ** libs
> icpc -I/apps/R/3.1.3-intel/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O3 -fp-model precise  -c Gif2R.cpp -o Gif2R.o
> icpc -I/apps/R/3.1.3-intel/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O3 -fp-model precise  -c GifTools.cpp -o GifTools.o
> icc -std=gnu99 -I/apps/R/3.1.3-intel/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O3 -wd188 -ip -fp-model precise  -c runfunc.c -o runfunc.o
> icpc -L/usr/local/lib64 -o caTools.so Gif2R.o GifTools.o runfunc.o
> /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o: In function `_start':
> (.text+0x20): undefined reference to `main'
> Gif2R.o: In function `imwritegif':
> /tmp/RtmpEfnBsm/R.INSTALL17c3a7327d4fb/caTools/src/Gif2R.cpp:19: undefined reference to `R_chk_calloc'
> /tmp/RtmpEfnBsm/R.INSTALL17c3a7327d4fb/caTools/src/Gif2R.cpp:23: undefined reference to `R_chk_free'
> ... (many more R_* undefined references)
> 
> For e1071:
> 
> * installing to library ?/scratch3/BMC/co2/lib/R-3.1/x86_64-unknown-linux-gnu?
> * installing *source* package ?e1071? ...
> ** package ?e1071? successfully unpacked and MD5 sums checked
> checking for C++ compiler default output file name... a.out
> checking whether the C++ compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables... 
> checking for suffix of object files... o
> checking whether we are using the GNU C++ compiler... yes
> checking whether icpc accepts -g... yes
> ** libs
> icc -std=gnu99 -I/apps/R/3.1.3-intel/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O3 -wd188 -ip -fp-model precise  -c Rsvm.c -o Rsvm.o
> icc -std=gnu99 -I/apps/R/3.1.3-intel/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O3 -wd188 -ip -fp-model precise  -c cmeans.c -o cmeans.o
> icc -std=gnu99 -I/apps/R/3.1.3-intel/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O3 -wd188 -ip -fp-model precise  -c cshell.c -o cshell.o
> icc -std=gnu99 -I/apps/R/3.1.3-intel/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O3 -wd188 -ip -fp-model precise  -c floyd.c -o floyd.o
> icpc -I/apps/R/3.1.3-intel/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O3 -fp-model precise  -c svm.cpp -o svm.o
> icpc -L/usr/local/lib64 -o e1071.so Rsvm.o cmeans.o cshell.o floyd.o svm.o
> /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o: In function `_start':
> (.text+0x20): undefined reference to `main'
> Rsvm.o: In function `do_cross_validation':
> /tmp/Rtmp9h7iYE/R.INSTALL1d9615a42180e/e1071/src/Rsvm.c:91: undefined reference to `GetRNGstate'
> /tmp/Rtmp9h7iYE/R.INSTALL1d9615a42180e/e1071/src/Rsvm.c:94: undefined reference to `unif_rand'
> /tmp/Rtmp9h7iYE/R.INSTALL1d9615a42180e/e1071/src/Rsvm.c:106: undefined reference to `PutRNGstate'
> ... (many more undefined references)
> 
> 
> 
> 



[Rd] shlib problems with Intel compiler
Martyn Plummer