I recently decided I should learn a bit about Bayesian statistics so I bought a copy of John Kruschke”s *Doing Bayesian Data Analysis and am installing Stan and JAGS.
It looks like I have successfully installed JAGS but I cannot get rjags to install. So far I have tried installing from within RStudio, at terminal level, and compiling from source. Any suggestions would be appreciated.
Ubuntu 20.04
R 4.0.5
RStudio 1.4.1106
JAGS 4.3.0
rjags 4-10
**From within RStudio and at terminal level**
> install.packages("rjags")
Installing package into ‘/home/john/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rjags_4-10.tar.gz'
Content type 'application/x-gzip' length 74060 bytes (72 KB)
==================================================
downloaded 72 KB
* installing *source* package ‘rjags’ ...
** package ‘rjags’ successfully unpacked and MD5 sums checked
** using staged installation
checking for pkg-config... /usr/bin/pkg-config
configure: Setting compile and link flags according to pkg-config
configure: Compile flags are -I/usr/local/include/JAGS
configure: Link flags are -L/usr/local/lib -ljags
checking for gcc... gcc -std=gnu99
checking whether we are using the GNU C compiler... no
checking whether gcc -std=gnu99 accepts -g... no
checking for gcc -std=gnu99 option to accept ISO C89... unsupported
checking for jags_version in -ljags... yes
checking version of JAGS library... OK
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
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include/JAGS -fpic -g -O2 -fdebug-prefix-map=/build/r-base-tRgc13/r-base-4.0.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include/JAGS -fpic -g -O2 -fdebug-prefix-map=/build/r-base-tRgc13/r-base-4.0.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c jags.cc -o jags.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include/JAGS -fpic -g -O2 -fdebug-prefix-map=/build/r-base-tRgc13/r-base-4.0.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c parallel.cc -o parallel.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o rjags.so init.o jags.o parallel.o -L/usr/local/lib -ljags -L/usr/lib/R/lib -lR
installing to /home/john/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-rjags/00new/rjags/libs
** R
** data
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘rjags’:
.onLoad failed in loadNamespace() for 'rjags', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/john/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-rjags/00new/rjags/libs/rjags.so':
libjags.so.4: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/john/R/x86_64-pc-linux-gnu-library/4.0/rjags’
Warning in install.packages :
installation of package ‘rjags’ had non-zero exit status
** From source**
tar xf rjags_4-10.tar.gz
john@john:~/Downloads$ cd rjags
john@john:~/Downloads/rjags$ ./configure
configure: error: "R_HOME is not defined"
john@john:~/Downloads/rjags$
'/home/john/R/x86_64-pc-linux-gnu-library/4.0//00new/rjags/libs/rjags.so'
00LOCK-rjagscd
R/x86_64-pc-linux-gnu-library/4.0//00new/rjags
It looks like I may be missing libjags.so.4 but, if so, I have no idea where to find it.