[R-SIG-Mac] BayesX Library

Simon Urbanek simon.urbanek at r-project.org
Sat Jun 9 02:43:19 CEST 2012


On Jun 8, 2012, at 7:59 PM, Paul Ossenbruggen wrote:

> Dear Sir:
> 
> I have installed the BayesX, R2BayesX and BayesXsrc on my Mac using OSX10.7.4.
> 
> I have tried several examples from R help without success. For example:
> 
>> set.seed(111)
>> n <- 500
>> ## regressors
>> dat <- data.frame(x = runif(n, -3, 3))
>> ## response
>> dat$y <- with(dat, 10 + sin(x) + rnorm(n, sd = 0.6))
>> 
>> ## estimate models with
>> ## bayesx MCMC and REML
>> b1 <- bayesx(y ~ sx(x), method = "MCMC", data = dat)
> dyld: Library not loaded: /usr/local/lib/libreadline.5.2.dylib
>  Referenced from: /Library/Frameworks/R.framework/Versions/2.15/Resources/library/BayesXsrc/libs/i386/BayesX
>  Reason: image not found
> Total run time was: 0.877 sec
> 
> Please let me know how to fix this problem.
> 

There is a problem in the BayesXsrc package so you may want to report it to the authors - it is circumventing the R package build system to build a binary without checking for the availability of the libraries it uses. Unfortunately it goes undetected in make check, because the CRAN build machine happens to have local versions of those libraries outside of R as well, but users don't. Only package libraries (.so and .dylib) are guaranteed to be re-mapped to use R's internal libraries.
(Besides, it segfaults on me when run on the command line even on the build machine).

Ideally, the authors of BayesXsrc should use regular package library to run their code so it is covered by our build system and tests, but if they need a separate executable (and don't want to run it off the package shared object itself), they should make sure that they provide any dependencies needed for the binary (I would also suggest using Makevars since they are effectively turning their Makefile into Makevars by using shell expansion of env vars which is inherently fragile and unreliable (any parameter containing a space will break it) instead of the make variables which they would have at their disposal in Makevars).


That said, a dirty hack to work around at least the problem you are seeing is to create a symlink to expose R's readline in the local system libraries like this:
sudo ln -s /Library/Frameworks/R.framework/Resources/lib/libreadline.5.2.dylib /usr/local/lib/libreadline.5.2.dylib

Cheers,
Simon


> I also tried the demo without obtaining any worthwhile output.
> 
> 
> Demos in package ŒR2BayesX‚:
> 
> forest                  A SpaceˆTime Study on Forest Health
> zambia                  Determinants of Childhood Malnutrition in Zambia
> 
> 	Since I am not the only person having this problem and reluctant to move forward with one of the following recommendations below, I am curious if the problem has been diagnosed further and clear cut fix has been determined. To be frank, I need more information to implement the first two recommendations.
> 
> 
>> Hi all, 
>> 
>> I have a problem with the library R2BayesX, when i try to use the command 
>> bayesx i get this error: 
>> dyld: Library not loaded: /usr/local/lib/libreadline.5.2.dylib 
>>   Referenced from: 
>> /Library/Frameworks/R.framework/Versions/2.15/Resources/library/BayesXsrc/libs/i386/BayesX 
>>   Reason: image not found 
> 
> So your R installation on your unstated OS is incomplete/corrupt. 
> 
> It looks like this is OS X, so: 
> 
> - wrong list (use R-sig-mac) 
> - you need to tell the correct list a lot more, including the 'at a 
> minimum' information asked for in the R posting guide (see below), and 
> how you installed R. 
> - a possible answer is to install 
> http://r.research.att.com/src/readline-5.2.tar.gz : see the OS X 
> documentation.
> 
> Thanks,
> 
> Paul
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list