From simon.urbanek at r-project.org  Tue Jul 13 00:51:55 2010
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Mon, 12 Jul 2010 18:51:55 -0400
Subject: [Rd] R-2.11.1 build and 'so' libraries withouth the 'lib'
	prefix//update
In-Reply-To: <201007122259.14529.lux-integ@btconnect.com>
References: <201007121029.30870.lux-integ@btconnect.com>
	<201007121950.55739.lux-integ@btconnect.com>
	<0B33AEC1-7E7C-42DC-A2CD-187A64DB8680@r-project.org>
	<201007122259.14529.lux-integ@btconnect.com>
Message-ID: <BD117118-7B3B-461D-96E5-AC979C36AD40@r-project.org>


On Jul 12, 2010, at 5:59 PM, lI wrote:

> On Monday 12 July 2010 20:52:15 Simon Urbanek wrote:
>> On Jul 12, 2010, at 2:50 PM, lI wrote:
>>> On Monday 12 July 2010 11:07:23 lI wrote:
>>>> On Monday 12 July 2010 10:29:30 lI wrote:
>>>>> Greetings,
>>>>> 
>>>>> I have a computer with the following setup:
>>>>> 1)cblfs (pure 64-bit (amd64) linux), kernel2.6.34 gcc4.4.2
>>>>> 2)R-2.11.1
>>>>> 
>>>>> I compiled R with BLAS and lapack  using the switched  ( --with-blas="-
>>>>> lpthread -latlas  -lfptf77blas"
>>>>> --with-lapack="-llapack -lcblas"  ).
>>>>> (( http://cran.r-project.org/doc/manuals/R-admin.html#Linear-algebra) )
>>>>> 
>>>>> Prior to compiling R-2.11.1
>>>>> sh conigure --help   gave  options including  the following
>>>>> SHLIB_LD         command for linking shared libraries
>>>>>               which contain object files  from a C or Fortran compiler
>>>>> only SHLIB_LDFLAGS   special flags used by SHLIB_LD
>>>>> SHLIB_CXXLDFLAGS   special flags used by SHLIB_CXXLD
>>>>> SHLIB_FCD   command for linking shared libraries which contain object
>>>>> files from the Fortran 95 compiler
>>>>> SHLIB_FCLDFLAGS  special flags used by SHLIB_FCLD
>>>>> 
>>>>> 
>>>>> I did not know what to set for these   and accepted whatever the
>>>>> defaults were.  I ended up with shared-libraries which are  as 
>>>>> follows:-
>>>>> 
>>>>> $R_HOME/lib/{libRblas.so,libRlapack.so  }  i.e. with   the prefix 'lib'
>>>>> and the following shared-libraries  without the 'lib' prefix.
>>>>> 
>>>>> $R_HOME/modules/{R_X11.so,internet.so,lapack.so,vfonts.so }
>>>>> $R_HOME/library/cluster/libs/cluster.so
>>>>> $R_HOME/library/foreign/libs/foreign.so
>>>>> $R_HOME/library/grDevices/libs/grDevices.so
>>>>> $R_HOME/library/grid/libs/grid.so
>>>>> $R_HOME/library/KernSmooth/libs/KernSmooth.so
>>>>> $R_HOME/library/lattice/libs/lattice.so
>>>>> $R_HOME/library/MASS/libs/MASS.so
>>>>> $R_HOME/library/Matrix/libs/Matrix.so
>>>>> $R_HOME/library/methods/libs/methods.so
>>>>> $R_HOME/library/mgcv/libs/mgcv.so
>>>>> $R_HOME/library/nlme/libs/nlme.so
>>>>> $R_HOME/library/nnet/libs/nnet.so
>>>>> $R_HOME/library/rpart/libs/rpart.so
>>>>> $R_HOME/library/spatial/libs/spatial.so
>>>>> $R_HOME/library/splines/libs/splines.so
>>>>> $R_HOME/library/stats/libs/stats.so
>>>>> $R_HOME/library/survival/libs/survival.so
>>>>> $R_HOME/library/tools/libs/tools.so
>>>>> 
>>>>> 
>>>>> In linux builds   the linker usually looks for libs with the 'lib'
>>>>> prefix. In this installation  all the libraries
>>>>> ---in $R_HOME/modules
>>>>> ---in $R_HOME/library/patha/to/whatevr
>>>>> 
>>>>> do not have the   'lib' prefix.
>>>>> 
>>>>> QUESTION:
>>>>> A) does any on list know   SHLIB_LD   SHLIB_LDFLAGS  SHLIB_CXXLDFLAGS
>>>>> SHLIB_FCD   SHLIB_FCLDFLAGS    settings for compiling R  and do these
>>>>> result in  so libs with the 'lib' prefix?
>>>>> B) If all of A) is negative what is there to be done to    to enable
>>>>> generation   libraries in $R_HOME/modules $R_HOME/library/~  with the
>>>>> 'lib' prefix?
>>>> 
>>>> I forgot to add     my configure/make  options.  These were:-
>>>> ########################
>>>> export BUILD64="-m64"
>>>> sh configure \
>>>> CC="gcc $BUILD64" \
>>>> CXX="g++ $BUILD64" \
>>>> F77="gfortran  $BUILD64" \
>>>> FC="gfortran  $BUILD64" \
>>>> JAVA_HOME=$JAVA_HOME \
>>>> LIBnn=lib64 \
>>>> CPPFLAGS="-I$ATLAS_HOME/include -I/opt/acml4.4.0/gfortran64_mp/include 
>>>> - I/opt/acml4.4.0/gfortran64/include -I/usr/local/numerics/include" \
>>>> LDFLAGS="-L$ATLAS_HOME/lib  -L/opt/acml4.4.0/gfortran64_mp/lib -
>>>> L/usr/local/numerics/lib -L/usr/lib" \
>>>> --prefix=/opt/TEST/R-2.11.1 \
>>>> --x-includes=$XORG_PREFIX/include \
>>>> --x-libraries=$XORG_PREFIX/lib \
>>>> --with-tcl-config=/usr/lib  \
>>>> --with-tk-config=/usr/lib \
>>>> --with-system-zlib=/usr  \
>>>> --with-system-bzlib=/usr \
>>>> --with-system-pcre=/usr  \
>>>> --with-x  \
>>>> --with-libpth-prefix=/usr \
>>>> --with-libintl-prefix=/usr \
>>>> --with-blas="-lpthread -latlas  -lfptf77blas" \
>>>> --with-lapack="-llapack -lcblas" \
>>>> --enable-R-shlib \
>>>> --enable-BLAS-shlib
>>>> ################
>>>> 
>>>> The sources  compiled trouble-free.   with  'make'  as normal user.
>>>> I then ran  'make install' as  super-user  and int installed in the
>>>> prefix as set..
>>>> 
>>>> A reply to the following questions would be much appreciateed:-
>>>> QUESTION:
>>>> A) does any on list know   SHLIB_LD   SHLIB_LDFLAGS  SHLIB_CXXLDFLAGS
>>>> SHLIB_FCD   SHLIB_FCLDFLAGS    settings for compiling R  and do these
>>>> result in  so libs with the 'lib' prefix?
>>>> B) If all of A) is negative what is there to be done to   enable
>>>> generation  of  shared-libraries in $R_HOME/modules/ and
>>>> $R_HOME/library/~ directories/sub-directories  with the 'lib'    prefix?
>>> 
>>> thanks everyone for the help in clarifying what were share-libraries  and
>>> otherwise.
>>> 
>>> As stated above I used two switches
>>> --enable-R-shlib \
>>> --enable-BLAS-shlib
>>> in the   configure options of the downloaded R-2.11.1 source  prior to
>>> compilation.
>>> 
>>> I am compiling  R-2.11.1   as  an optional dependency of kdeedu-4.4.5.   
>>> This asks for R-shlib   )which I noticed it is disable by the default  in
>>> the configure script.)
>>> 
>>> After compile and install of R-2.11.1,  I am only able to start R from
>>> the command  line
>> 
>> How are you starting it? The R start script does setup everything so that
>> you should never touch anything inside.
>> 
>>> when I   move the generated libRblas.so to libRblas.soDUFF and
>>> symlink libacml.so    to libRblas.so  and update $R_HOME/etc/ldpaths
>>> accordingly.  I am unable to start R  with the compiled-in 
>>> $R_HOME/libR.so and  $R_HOME/libRblas.so.
>>> 
>>> QUESTIONS:
>>> A) How  does one  start R with the  the generated  libR.so and
>>> libRblas.so?
>> 
>> bin/R
>> 
>>> B) is the generated  libR.so  interchangable with libRblas.so  (i.e. R
>>> library without blas   enhanced algebra  capabilities?)
>> 
>> No - those are two entirely different libraries. The libRblas can be
>> interchanged with a suitably complete BLAS implementation, but please do
>> read the manuals for details.
>> 
>> Cheers,
>> Simon
>> 
> 
> Thanks to you for your help.  Following your guidance,  kdeedu-4.4.5  now 
> builds successfully against R-2.11.1.   However when I    edit ~/etc/ldpaths 
> with  the line
> 
> export LD_LIBRARY_PATH=path/to/acml/lib:$LD_LIBRARY_PATH
> 
> R fails to start.

Of course as you should expect. Why would you edit? It has nothing to do with BLAS ...

Also did you read the manual? It explicitly covers your case ... 

Cheers,
Simon


>  it only starts when   the above point to $R_HOME/lib. (nb I 
> have  a symbolic link of libacml.so  to libRblas.so
> any ideas?
> 
> 



[Rd] R-2.11.1 build and 'so' libraries withouth the 'lib' prefix//update
Simon Urbanek