[R-SIG-Mac] problem installing rjags package

Michael Braun braunm at mit.edu
Sun Oct 10 18:03:06 CEST 2010


Thanks for the suggestions.  I did go through the JAGS installation manual slowly and carefully, but that doesn't mean I didn't miss something.

I may not have been clear about what I did.  The JAGS that is installed is the pre-compiled binary (I wanted to be sure that how I was compiling JAGS wasn't causing the problems).  The compilation flags below are generated by R (I used gcc to compile R,  and linked R to the MKL BLAS, and that seems to have worked well).  Perhaps I need to change my Makevars file for rjags?  Because (I think) R only (seems to) use the Makevars in my ~/.R folder, it's hard to keep track of what's linking to what across multiple projects (hence, why the -lgsl is in there). 

In any event, what did seem to work is when I ran R as root, and then installed rjags.  I can now load the library even when not running R as root.  So perhaps there was some kind of permissions problem that was keeping R from accessing the jags library (which is in /usr/local/lib).  Is there a particular R library path variable that I should be looking at?  I do have /usr/local/lib as part of R_DYLIB_LIBRARY_PATH, DYLD_LIBRARY_PATH, and LD_LIBRARY_PATH.





On Oct 10, 2010, at 8:11 AM, <plummer at iarc.fr> <plummer at iarc.fr> wrote:

> Michael,
> 
> I do have some experience of using MKL with JAGS and left quite
> detailed instructions, for Linux, in the installation manual (section 1.3.5).
> 
> In addition to the problems noted by Brian there seem to be anomalies
> with your MKL configuration:
> - You are compiling with GNU compilers but trying to use the Intel
>  64-bit interface layer. This will not work.
> - You are using the sequential MKL library but still linking to
>  libpthread, which is redundant.
> 
> As noted in the manual, on Linux I have been unable to link JAGS with
> the MKL using GNU compilers, except by building a static version, which
> is obviously not helpful if you want to interface to R.
> 
> To be honest, BLAS/LAPACK performance is not a bottleneck for JAGS unless
> perhaps, you have a very special problem.  All of this effort to link
> to MKL will probably not pay off and binary packages of both JAGS and rjags
> are available and which do actually work.
> 
> Martyn
> 
> Quoting Prof Brian Ripley <ripley at stats.ox.ac.uk>:
>> Note your link line has no reference to -ljags.  Mine is (for i386,
>> x86_64 is later on in the output)
>> 
>> g++ -arch i386 -dynamiclib -Wl,-headerpad_max_install_names -undefined
>> dynamic_lookup -single_module -multiply_defined suppress
>> -L/usr/local/lib -o rjags.so jags.o -L/usr/local/lib -ljags
>> -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
>> -Wl,CoreFoundation
>> 
>> with no reference to -lgsl.  Also, have you perhaps excluded
>> /usr/local/lib (the usual place to install JAGS) from the R library
>> paths?
>> 
>> Have you contacted the maintainer?  Although not a Mac user he is very
>> knowledgable, including about MKL.
>> 
>> On Sat, 9 Oct 2010, Michael Braun wrote:
>> 
>>> Hi!
>>> 
>>> I am trying to install rjags on my Mac Pro running OSX 10.6.4, and R
>>> 2.11.1 (which I compiled myself so I could link to the Intel MKL
>>> blas, which I prefer to other options).  I was successfully able to
>>> install JAGS 2.1.0 through both the binary installer, and compiling
>>> from source (I get the same problem either way).
>>> 
>>> But I would like to use the rjags package. When I do
>>> 
>>> install.packages("rjags")
>>> 
>>> 
>>> I get the folliowing output:
>>> 
>>> * installing *source* package ‘rjags’ ...
>>> checking for prefix by checking for jags... /usr/local/bin/jags
>>> checking for g++... g++
>>> 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 g++ accepts -g... yes
>>> checking how to run the C++ preprocessor... g++ -E
>>> checking for grep that handles long lines and -e... /usr/bin/grep
>>> checking for egrep... /usr/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
>>> checking for gcc... gcc
>>> checking whether we are using the GNU C compiler... yes
>>> checking whether gcc accepts -g... yes
>>> checking for gcc option to accept ISO C89... none needed
>>> checking for jags_version in -ljags... yes
>>> configure: creating ./config.status
>>> config.status: creating src/Makevars
>>> configure: creating ./config.status
>>> config.status: creating src/Makevars
>>> config.status: creating R/unix/zzz.R
>>> ** libs
>>> *** arch - x86_64
>>> g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include
>> -I/Library/Frameworks/R.framework/Resources/include/x86_64
>> -I/usr/local/include/JAGS
>> -I/opt/intel/Compiler/11.1/089/Frameworks/mkl/Headers
>> -I/Install_Files/MKL_gfortran_interface/include/em64t/lp64    -fPIC  -m64
>> -msse4.2 -g -O2 -c jags.cc -o jags.o
>>> g++ -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined
>> dynamic_lookup -single_module -multiply_defined suppress
>> -L/opt/intel/Compiler/11.1/089/Frameworks/mkl/Libraries/em64t
>> -L/Users/braunm/Install_Files/MKL_gfortran_interface/lib/em64t -o rjags.so
>> jags.o -lgsl -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread
>> -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
>> -Wl,CoreFoundation
>>> installing to /Users/braunm/.R/Library/rjags/libs/x86_64
>>> ** R
>>> ** data
>>> ** preparing package for lazy loading
>>> ** help
>>> *** installing help indices
>>> ** building package indices ...
>>> Error : .onLoad failed in loadNamespace() for 'rjags', details:
>>> call: dyn.load(file, DLLpath = DLLpath, ...)
>>> error: unable to load shared library
>> '/Users/braunm/.R/Library/rjags/libs/x86_64/rjags.so':
>>> dlopen(/Users/braunm/.R/Library/rjags/libs/x86_64/rjags.so, 10): Symbol
>> not found: _JAGS_NA
>>> Referenced from: /Users/braunm/.R/Library/rjags/libs/x86_64/rjags.so
>>> Expected in: flat namespace
>>> in /Users/braunm/.R/Library/rjags/libs/x86_64/rjags.so
>>> ERROR: installing package indices failed
>>> * removing ‘/Users/braunm/.R/Library/rjags’
>>> 
>>> 
>>> However, when I go to look at the symbols in the jags library, I see
>>> 
>>> braunm4: /usr/local/lib $ nm libjags.dylib |grep JAGS
>>> 0000000000098650 S _JAGS_NA
>>> 0000000000110338 S _JAGS_NAN
>>> 0000000000110348 S _JAGS_NEGINF
>>> 0000000000110340 S _JAGS_POSINF
>>> 000000000000133c t __GLOBAL__I_JAGS_NA
>>> 
>>> and when I try
>>> 
>>> braunm4: /usr/local/lib $ nm libjags.a |grep JAGS
>>>                U _JAGS_NA
>>>                U _JAGS_NEGINF
>>>                U _JAGS_NA
>>>                U _JAGS_NA
>>> 0000000000000060 S _JAGS_NA
>>> 00000000000000b8 B _JAGS_NAN
>>> 00000000000000c8 B _JAGS_NEGINF
>>> 00000000000000c0 B _JAGS_POSINF
>>>                U _JAGS_NA
>>>                U _JAGS_NEGINF
>>>                U _JAGS_POSINF
>>>                U _JAGS_NEGINF
>>>                U _JAGS_POSINF
>>>                U _JAGS_NEGINF
>>>                U _JAGS_NA
>>>                U _JAGS_NEGINF
>>>                U _JAGS_NEGINF
>>>                U _JAGS_NA
>>>                U _JAGS_NEGINF
>>>                U _JAGS_POSINF
>>> 
>>> 
>>> So the jags libraries (both static and dynamic) are in the standard place,
>> and it looks like the symbols rjags.so needs are there as well.  So I'm not
>> sure what the rjags installer is looking for.  Is there perhaps an
>> environment variable that I am missing?
>>> 
>>> Here is my sessionInfo():
>>> 
>>>> sessionInfo()
>>> R version 2.11.1 (2010-05-31)
>>> x86_64-apple-darwin10.4.2
>>> 
>>> locale:
>>> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>>> 
>>> attached base packages:
>>> [1] stats     grDevices datasets  graphics  utils     methods   base
>>> 
>>> other attached packages:
>>> [1] xtable_1.5-6     doMC_1.2.1       multicore_0.1-3  foreach_1.3.0
>> codetools_0.2-2  iterators_1.0.3  coda_0.13-5      matrixcalc_1.0-1
>> lattice_0.18-8   reshape_0.8.3    plyr_1.2.1
>>> [12] mvtnorm_0.9-92
>>> 
>>> loaded via a namespace (and not attached):
>>> [1] grid_2.11.1  tcltk_2.11.1 tools_2.11.1
>>> 
>>> 
>>> Thanks in advance for your help.
>>> 
>>> Michael
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> -------------------------------------------
>>> Michael Braun
>>> Homer A. Burnell (1928) Career Development Professor,
>>> 	and Assistant Professor of Management Science (Marketing Group)
>>> MIT Sloan School of Management
>>> 100 Main St.., E62-535
>>> Cambridge, MA 02139
>>> braunm at mit.edu
>>> 617-253-3436
>>> 
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>> 
>> 
>> --
>> Brian D. Ripley,                  ripley at stats.ox.ac.uk
>> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>> University of Oxford,             Tel:  +44 1865 272861 (self)
>> 1 South Parks Road,                     +44 1865 272866 (PA)
>> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
> 
> 
> -----------------------------------------------------------------------
> This message and its attachments are strictly confidential. If you are
> not the intended recipient of this message, please immediately notify 
> the sender and delete it. Since its integrity cannot be guaranteed, 
> its content cannot involve the sender's responsibility. Any misuse, 
> any disclosure or publication of its content, either whole or partial, 
> is prohibited, exception made of formally approved use
> -----------------------------------------------------------------------

-------------------------------------------
Michael Braun
Homer A. Burnell (1928) Career Development Professor, 
	and Assistant Professor of Management Science (Marketing Group)
MIT Sloan School of Management
100 Main St.., E62-535
Cambridge, MA 02139
braunm at mit.edu
617-253-3436



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20101010/8ef4adcf/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1844 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20101010/8ef4adcf/attachment-0001.bin>


More information about the R-SIG-Mac mailing list