upgrade R - F77 cause compilation error

I try to compile the source code of R 2.12 on CentOS, but it throw an error when trying to install *cluster*.

* installing *source* package ‘cluster’ ...
** libs
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c clara.c -o clara.o
g77   -fpic  -g -O2 -c daisy.f -o daisy.o
g77   -fpic  -g -O2 -c dysta.f -o dysta.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c fanny.c -o fanny.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c init.c -o init.o
g77   -fpic  -g -O2 -c meet.f -o meet.o
g77   -fpic  -g -O2 -c mona.f -o mona.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c pam.c -o pam.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c sildist.c -o sildist.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c spannel.c -o spannel.o
g77   -fpic  -g -O2 -c twins.f -o twins.o
gcc -std=gnu99 -shared -L/usr/local/lib -o cluster.so clara.o daisy.o dysta.o fanny.o init.o meet.o mona.o pam.o sildist.o spannel.o twins.o -L/usr/lib/gcc/i386-redhat-linux/3.4.6 -lg2c -lm
installing to /usr/local/lib/R/library/cluster/libs
** R
** data
**  moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/local/lib/R/library/cluster/libs/cluster.so':
  /usr/local/lib/R/library/cluster/libs/cluster.so: undefined symbol: cl_daisy_
ERROR: loading failed
* removing ‘/usr/local/lib/R/library/cluster’
* restoring previous ‘/usr/local/lib/R/library/cluster’

The downloaded packages are in
        ‘/tmp/RtmpP1rf0B/downloaded_packages’
Updating HTML index of packages in '.Library'
Warning message:
In install.packages("cluster") :
  installation of package 'cluster' had non-zero exit status


*cluster* was one of the recommended packages. The first idea came into my mind was not to install that package. This can be done by:

./configure --without-recommended-packages 

But this did not solve the problem, and many recommended packages was not updated.
R/etc/Makeconf was very informative for figuring out what the cause is.

I switched the fortran compiler to gfortran instead of g77, and it's very weird to find that gfortran was not install on CentOS by default. As I know, gfortran usually coexists with GCC4, which also cause some problems when compiling some old version of R packages.

After switch the fortran compiler to gfortran, the installation works.

* installing *source* package cluster ...
** libs
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c clara.c -o clara.o
gfortran   -fpic  -g -O2 -c daisy.f -o daisy.o
gfortran   -fpic  -g -O2 -c dysta.f -o dysta.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c fanny.c -o fanny.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c init.c -o init.o
gfortran   -fpic  -g -O2 -c meet.f -o meet.o
gfortran   -fpic  -g -O2 -c mona.f -o mona.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c pam.c -o pam.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c sildist.c -o sildist.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c spannel.c -o spannel.o
gfortran   -fpic  -g -O2 -c twins.f -o twins.o
gcc -std=gnu99 -shared -L/usr/local/lib -o cluster.so clara.o daisy.o dysta.o fanny.o init.o meet.o mona.o pam.o sildist.o spannel.o twins.o -L/usr/lib/gcc/i386-redhat-linux/3.4.6 -lg2c -lm
installing to /usr/local/lib/R/library/cluster/libs
** R
** data
**  moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded

* DONE (cluster)

The downloaded packages are in
        /tmp/RtmpP1rf0B/downloaded_packages
Updating HTML index of packages in '.Library'

After install the newest version of R, we can use the following command to upgrade all installed packages hosted in CRAN and Bioconductor to the newest version as mention in a previous post.

update.packages(checkBuilt=TRUE, ask=FALSE)
source("http://bioconductor.org/biocLite.R")
update.packages(repos=biocinstallRepos(), ask=FALSE)
p5rn7vb

Related Posts

  1. 关于installation of package ‘Category’ had non-zero exit status的问题!我是在服务器上我自己的用户下安装的!服务器是f77,你用了switched the fortran compiler to gfortran instead of g77没有权限啊!提示信息如下
    * installing *source* package ‘Category’ ...
    ** preparing package for lazy loading
    Error in dyn.load(file, DLLpath = DLLpath, ...) :
    unable to load shared object '/lib/RBGL/libs/RBGL.so':
    libR.so: cannot open shared object file: No such file or directory
    ERROR: lazy loading failed for package ‘Category’
    * removing ‘/lib/Category’
    * restoring previous ‘/lib/Category’
    Warning message:
    In install.packages(pkgs = pkgs, lib = lib, repos = repos, ...) :
    installation of package ‘Category’ had non-zero exit status

    Reply

    ygc Hong Kong Mozilla Firefox Mac OS Reply:

    你有權限改成gfortran,你需要改的是R_HOME/etc/Makeconf,$R_HOME環境變量可以設在你用戶目錄下。

    看你出錯信息,原因應該是你沒裝boost庫,這是C++的庫,但RBGL依賴於此。你還是求助於系統管理員比較好。

    Reply

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>