Hi R-users, talking about the compilation of rjags (gnu 4.4.7 - blas and lapack routines) package in R I have solved the issue in the thread as follows:
Before compiling JAGS I need to recompile BLAS and LAPACK libraries with -fPIC instruction: BLAS Makefile: [root@n14 library]# cat /home/c.zazza/BLAS_pic/make.inc #################################################################### # BLAS make include file. # # March 2007 # #################################################################### # SHELL = /bin/sh # # The machine (platform) identifier to append to the library names # PLAT = _LINUX # # Modify the FORTRAN and OPTS definitions to refer to the # compiler and desired compiler options for your machine. NOOPT # refers to the compiler options desired when NO OPTIMIZATION is # selected. Define LOADER and LOADOPTS to refer to the loader and # desired load options for your machine. # FORTRAN = gfortran *OPTS = -O3 -fPIC* DRVOPTS = $(OPTS) *NOOPT = -fPIC* LOADER = gfortran *LOADOPTS = -fPIC* # # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # ARCH = ar ARCHFLAGS= cr RANLIB = ranlib # # The location and name of the Reference BLAS library. # BLASLIB = blas$(PLAT).a Also lapack makefile needs for -fPIC: [root@n14 library]# cat /home/c.zazza/lapack-3.5.0_pic/make.inc #################################################################### # LAPACK make include file. # # LAPACK, Version 3.5.0 # # November 2013 # #################################################################### # SHELL = /bin/sh # # Modify the FORTRAN and OPTS definitions to refer to the # compiler and desired compiler options for your machine. NOOPT # refers to the compiler options desired when NO OPTIMIZATION is # selected. Define LOADER and LOADOPTS to refer to the loader and # desired load options for your machine. # FORTRAN = gfortran OPTS = -O2 -frecursive -fPIC DRVOPTS = $(OPTS) NOOPT = -O0 -frecursive -fPIC LOADER = gfortran LOADOPTS = -fPIC # # Timer for the SECOND and DSECND routines # # Default : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME #TIMER = EXT_ETIME # For RS6K : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME_ # TIMER = EXT_ETIME_ # For gfortran compiler: SECOND and DSECND will use a call to the INTERNAL FUNCTION ETIME TIMER = INT_ETIME # If your Fortran compiler does not provide etime (like Nag Fortran Compiler, etc...) # SECOND and DSECND will use a call to the INTERNAL FUNCTION CPU_TIME # TIMER = INT_CPU_TIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # # Configuration LAPACKE: Native C interface to LAPACK # To generate LAPACKE library: type 'make lapackelib' # Configuration file: turned off (default) # Complex types: C99 (default) # Name pattern: mixed case (default) # (64-bit) Data model: LP64 (default) # # CC is the C compiler, normally invoked with options CFLAGS. # CC = gcc CFLAGS = -O3 -fPIC # # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # ARCH = ar ARCHFLAGS= cr RANLIB = ranlib # # Location of the extended-precision BLAS (XBLAS) Fortran library # used for building and testing extended-precision routines. The # relevant routines will be compiled and XBLAS will be linked only if # USEXBLAS is defined. # # USEXBLAS = Yes XBLASLIB = # XBLASLIB = -lxblas # # The location of the libraries to which you will link. (The # machine-specific, optimized BLAS library should be used whenever # possible.) # #BLASLIB = ../../librefblas.a BLASLIB = /home/c.zazza/BLAS/blas_LINUX.a LAPACKLIB = liblapack.a TMGLIB = libtmglib.a LAPACKELIB = liblapacke.a Next, we compile JAGS as follows: *1032 wget http://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.0.0.tar.gz <http://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.0.0.tar.gz>* * 1034 tar -zxvf JAGS-4.0.0.tar.gz* * 1035 cd /share/apps/JAGS-4.0.0* *1038 ./configure F77="gfortran" --with-blas="/apps/BLAS_pic/blas_LINUX.a" --with-lapack="-ltmglib -llapack" LDFLAGS="-L/apps/lapack-3.5.0_pic" --prefix="/apps/jags" --libdir="/apps/jags/lib64"* *1039 make -j4 >& make.log &* * 1040 tail -f make.log* * 1041 make install* afterwards, before running R we need to set this:* (otherwise you obtain the error you posted like: libjargs.x.y.z etc etc):* *1027 export LD_LIBRARY_PATH=$RDIR/lib64/R/lib:${LD_LIBRARY_PATH}* Finally, within the R-environment we install rjags as follows: *install.packages("rjags", configure.args = "--with-jags-prefix=/apps/jags --with-jags-include=/apps/jags/include/JAGS --with-jags-lib=/apps/jags/lib64 --with-jags-modules=/apps/jags/lib/JAGS/modules-4")* [root@n14 bin]# export LD_LIBRARY_PATH="/home/apps/jags/lib64:${LD_LIBRARY_PATH}" [root@n14 bin]# echo $LD_LIBRARY_PATH /home/apps/jags/lib64:/home/apps/R-3.2.1/lib64/R/lib:/opt/torque/lib:/home/apps/R/3.1.0/lib64:/opt/openmpi/gnu4.4.7/lib:/home/apps/gromacs-4.6.5/build_intel.13.1.1/lib:/usr/local/cuda/lib64:/opt/intel/composer_xe_2013.3.163/compiler/lib/intel64:/opt/intel/composer_xe_2013.3.163/mpirt/lib/intel64:/opt/intel/composer_xe_2013.3.163/ipp/../compiler/lib/intel64:/opt/intel/composer_xe_2013.3.163/ipp/lib/intel64:/opt/intel/mic/coi/host-linux-release/lib:/opt/intel/mic/myo/lib:/opt/intel/composer_xe_2013.3.163/compiler/lib/intel64:/opt/intel/composer_xe_2013.3.163/mkl/lib/intel64:/opt/intel/composer_xe_2013.3.163/tbb/lib/intel64/gcc4.4 [root@n14 bin]# R R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-unknown-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > install.packages("rjags", configure.args = "--with-jags-prefix=/home/apps/jags --with-jags-include=/home/apps/jags/include/JAGS --with-jags-lib=/home/apps/jags/lib64 --with-jags-modules=/home/apps/jags/lib/JAGS/modules-4") --- Please select a CRAN mirror for use in this session --- CRAN mirror 1: 0-Cloud [https] 2: 0-Cloud 3: Algeria 4: Argentina (La Plata) 5: Australia (Canberra) 6: Australia (Melbourne) 7: Austria [https] 8: Austria 9: Belgium (Antwerp) 10: Belgium (Ghent) 11: Brazil (BA) 12: Brazil (PR) 13: Brazil (RJ) 14: Brazil (SP 1) 15: Brazil (SP 2) 16: Canada (BC) 17: Canada (NS) 18: Canada (ON) 19: Chile [https] 20: Chile 21: China (Beijing 2) 22: China (Beijing 3) 23: China (Beijing 4) [https] 24: China (Beijing 4) 25: China (Xiamen) 26: Colombia (Cali) [https] 27: Colombia (Cali) 28: Czech Republic 29: Denmark 30: Ecuador 31: El Salvador 32: Estonia 33: France (Lyon 1) 34: France (Lyon 2) [https] 35: France (Lyon 2) 36: France (Marseille) 37: France (Montpellier) 38: France (Paris 1) 39: France (Paris 2) [https] 40: France (Paris 2) 41: Germany (Berlin) 42: Germany (Göttingen) 43: Germany (Münster) [https] 44: Germany (Münster) 45: Greece 46: Hungary 47: Iceland [https] 48: Iceland 49: India 50: Indonesia (Jakarta) 51: Iran 52: Ireland 53: Italy (Milano) 54: Italy (Padua) [https] 55: Italy (Padua) 56: Italy (Palermo) 57: Japan (Tokyo) 58: Japan (Yamagata) 59: Korea (Seoul 1) 60: Korea (Seoul 2) 61: Korea (Ulsan) 62: Lebanon 63: Mexico (Mexico City) [https] 64: Mexico (Mexico City) 65: Mexico (Texcoco) 66: Mexico (Queretaro) 67: Netherlands (Amsterdam) 68: Netherlands (Utrecht) 69: New Zealand 70: Norway 71: Philippines 72: Poland 73: Portugal (Lisbon) 74: Russia (Moscow) [https] 75: Russia (Moscow) 76: Singapore 77: Slovakia 78: South Africa (Cape Town) 79: South Africa (Johannesburg) 80: Spain (A Coruña) [https] 81: Spain (A Coruña) 82: Spain (Madrid) 83: Sweden 84: Switzerland [https] 85: Switzerland 86: Taiwan (Chungli) 87: Taiwan (Taipei) 88: Thailand 89: Turkey (Denizli) 90: Turkey (Mersin) 91: UK (Bristol) [https] 92: UK (Bristol) 93: UK (Cambridge) [https] 94: UK (Cambridge) 95: UK (London 1) 96: UK (London 2) 97: UK (St Andrews) 98: USA (CA 1) [https] 99: USA (CA 1) 100: USA (CA 2) 101: USA (CO) 102: USA (IA) 103: USA (IN) 104: USA (KS) [https] 105: USA (KS) 106: USA (MD) [https] 107: USA (MD) 108: USA (MI 1) [https] 109: USA (MI 1) 110: USA (MI 2) 111: USA (MO) 112: USA (NC) 113: USA (OH 1) 114: USA (OH 2) 115: USA (OR) 116: USA (PA 1) 117: USA (PA 2) 118: USA (TN) [https] 119: USA (TN) 120: USA (TX) [https] 121: USA (TX) 122: USA (WA) [https] 123: USA (WA) 124: Venezuela Selection: 53 trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/src/contrib/rjags_4-4.tar.gz' Content type 'text/plain' length 72125 bytes (70 KB) ================================================== downloaded 70 KB * installing *source* package ‘rjags’ ... ** package ‘rjags’ successfully unpacked and MD5 sums checked configure: WARNING: unrecognized options: --with-jags-include, --with-jags-lib, --with-jags-modules checking for pkg-config... /usr/bin/pkg-config configure: WARNING: pkg-config file for jags 4 unavailable configure: WARNING: Consider adding the directory containing `jags.pc` configure: WARNING: to the PKG_CONFIG_PATH environment variable configure: Attempting legacy configuration of rjags checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking how to run the C++ preprocessor... g++ -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking Console.h usability... yes checking Console.h presence... yes checking for Console.h... yes configure: Compile flags are -I/home/apps/jags/include/JAGS configure: Link flags are -L/home/apps/jags/lib64 -ljags checking for gcc... gcc -std=gnu99 checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking for jags_version in -ljags... yes checking version of JAGS library... OK configure: creating ./config.status config.status: creating src/Makevars configure: WARNING: unrecognized options: --with-jags-include, --with-jags-lib, --with-jags-modules configure: creating ./config.status config.status: creating src/Makevars config.status: creating R/unix/zzz.R configure: WARNING: unrecognized options: --with-jags-include, --with-jags-lib, --with-jags-modules ** libs g++ -I/home/apps/R-3.2.1/lib64/R/include -DNDEBUG -I/home/apps/jags/include/JAGS -I/usr/local/include -fpic -g -O2 -c jags.cc -o jags.o g++ -I/home/apps/R-3.2.1/lib64/R/include -DNDEBUG -I/home/apps/jags/include/JAGS -I/usr/local/include -fpic -g -O2 -c parallel.cc -o parallel.o g++ -shared -L/usr/local/lib64 -o rjags.so jags.o parallel.o -L/home/apps/jags/lib64 -ljags installing to /home/apps/R-3.2.1/lib64/R/library/rjags/libs ** R ** data ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded * DONE (rjags) The downloaded source packages are in ‘/tmp/Rtmpd2BSpp/downloaded_packages’ Updating HTML index of packages in '.Library' Making 'packages.html' ... done All the best, Costantino Il giorno giovedì 5 novembre 2015 18:32:18 UTC+1, Evan Cooch ha scritto: > On 11/5/2015 9:45 AM, Rainer Hurling wrote: > > Am 04.11.2015 um 21:36 schrieb Evan Cooch: > >> > >> > >> On 11/4/2015 2:08 PM, Evan Cooch wrote: > >>> Greetings -- > >>> > >>> This has also been posted on the jags forum, but since I suspect the > >>> problem is more 'R-related' than jags, will aos post here. > >>> > >>> Decided to 'upgrade' from jags 3.x.x to 4.x.x today, on my GNU/Linux > >>> boxes (which run latest RHEL). Here are the basic details: > >>> > >>> 1\ used R 3.2.2 compiled from source. 64-bit -- nothing fancy, other > >>> than the fact that I used OpenBLAS instead of 'generic'. Works fine. > >>> > >>> 2\ downloaded and compiled JAGS 4.0.1 from source (nothing fancy, > >>> ./configure & make & make install) -- no errors. Runs fine as a > >>> standalone app from CLI. > >>> > >>> > >>> 3\ Downloaded rjags_4-3.tar.gz, and installed from R CLI (within R -- > >>> usual R CMD INSTALL approach). Again, no errors reported. > >>> > >>> > >>> However, when I fire up R, and try something simple like > >>> > >>> library(R2jags) > >>> > >>> I get a whole slew of error messages - following is reproducible on > >>> all my machines: > >>> > >>> Loading required package: rjags > >>> Loading required package: coda > >>> Error : .onLoad failed in loadNamespace() for 'rjags', details: > >>> call: dyn.load(file, DLLpath = DLLpath, ...) > >>> error: unable to load shared object > >>> '/usr/lib64/R/library/rjags/libs/rjags.so': > >>> libjags.so.3: cannot open shared object file: No such file or directory > >>> Error: package ‘rjags’ could not be loaded > >>> > >>> > >> > >> Further puzzlement -- I uninstalled R2jags and rjags, with the idea that > >> re-installing them (ostensibly with the 'latest and greatest') would do > >> the trick. While the process went fine for R2jags, when I tried to > >> re-install rjags, got the following error messages: > >> > >> checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed > >> checking for jags_version in -ljags... yes > >> checking version of JAGS library... wrong version > >> configure: error: rjags requires JAGS version 4.x.y > >> ERROR: configuration failed for package ‘rjags’ > >> * removing ‘/usr/lib64/R/library/rjags’ > >> * restoring previous ‘/usr/lib64/R/library/rjags’ > > > > Hmm, is it possible, that your JAGS 4.x.y installation is fine, but an > > old libjags.so library is lying around from a not fully completed > > deinstallation? Could you have a look for older libjags.so versions, > > please? > > > > Just a thought. > > > > > I suppose thats possible -- I'll go through the sequence again at some > point, and report back. > > ______________________________________________ > r-h...@r-project.org <javascript:> mailing list -- To UNSUBSCRIBE and > more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.