furrer-lab / r-containers

GNU General Public License v3.0
1 stars 0 forks source link

fedora clang based container #9

Closed j-i-l closed 5 months ago

j-i-l commented 5 months ago

With this configuration we run into this exact error:

https://stackoverflow.com/questions/63957381/how-to-install-rjags-when-instalaltion-is-failing-with-undefined-symbol-zn4jag

Where the solution suggests that this is caused by a mismatch of the compiler versions used to compile JAGS and rjags. However, in our case, both are clang version 14.0.5 (Fedora 14.0.5-2.fc36)

j-i-l commented 5 months ago

hm... maybe when building jags we need to explicitly state that we want clang to use, not gcc?!

j-i-l commented 5 months ago

Should have a closer look at: https://usermanual.wiki/Document/jagsinstallationmanual.880863585.pdf

j-i-l commented 5 months ago

Still the same issue...

j-i-l commented 5 months ago

rjags install still fails with:

#19 12.54 Error: package or namespace load failed for ‘rjags’:
#19 12.54  .onLoad failed in loadNamespace() for 'rjags', details:
#19 12.54   call: dyn.load(file, DLLpath = DLLpath, ...)
#19 12.54   error: unable to load shared object '/opt/R-devel/lib64/R/library/00LOCK-rjags/00new/rjags/libs/rjags.so':
#19 12.54   /opt/R-devel/lib64/R/library/00LOCK-rjags/00new/rjags/libs/rjags.so: undefined symbol: _ZN4jags7Console11listModulesEv
#19 12.54 Error: loading failed
j-i-l commented 5 months ago

switching to fedora-gcc we get:

#16 8.494 using C compiler: ‘gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)’
#16 8.498 using C++ compiler: ‘g++ (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)’
#16 8.511 gcc -I"/opt/R-devel/lib64/R/include" -DNDEBUG -I/usr/local/include/JAGS    -I/usr/local/include    -fpic  -g -O2  -c init.c -o init.o
#16 8.577 g++ -std=gnu++17 -I"/opt/R-devel/lib64/R/include" -DNDEBUG -I/usr/local/include/JAGS    -I/usr/local/include    -fpic  -g -O2  -c jags.cc -o jags.o
#16 11.30 g++ -std=gnu++17 -I"/opt/R-devel/lib64/R/include" -DNDEBUG -I/usr/local/include/JAGS    -I/usr/local/include    -fpic  -g -O2  -c parallel.cc -o parallel.o
#16 12.03 g++ -std=gnu++17 -shared -L/opt/R-devel/lib64/R/lib -L/usr/local/lib64 -o rjags.so init.o jags.o parallel.o -L/usr/local/lib64 -ljags -L/opt/R-devel/lib64/R/lib -lR
#16 12.14 installing to /opt/R-devel/lib64/R/library/00LOCK-rjags/00new/rjags/libs
#16 12.15 ** R
#16 12.15 ** data
#16 12.16 ** byte-compile and prepare package for lazy loading
#16 13.07 ** help
#16 13.13 *** installing help indices
#16 13.17 ** building package indices
#16 13.52 ** testing if installed package can be loaded from temporary location
#16 13.83 ** checking absolute paths in shared objects and dynamic libraries
#16 13.87 ** testing if installed package can be loaded from final location
#16 14.18 ** testing if installed package keeps a record of temporary installation path
#16 14.18 * DONE (rjags)
#16 14.19 
j-i-l commented 5 months ago

Trying to pin lapack and blas libraries to what is used by R when compiling jags

Checking with R CMD config in the fedora-clang docker and add the specifics to JAGS configuration.

j-i-l commented 5 months ago

rjags installation worked.

The magic command:

LD="llvm-ld" CC="/usr/bin/clang" CXX="/usr/bin/clang++ -std=gnu++17 -stdlib=libc++" ./configure --with-blas="-L/opt/R-devel/lib64/R/lib -lRblas" --with-lapack="-L/opt/R-devel/lib64/R/lib -lRlapack" --libdir=/usr/local/lib64

This ports basically the output of

To the JAGS compilation. I'm unsure whether all of it is needed, but well: It works!

j-i-l commented 5 months ago

A quick testing pipeline using this container (https://github.com/furrer-lab/devel-abn/actions/runs/7495135469/job/20471533655?pr=92) ran through as expected.

I'd say it's ready to merge.

matteodelucchi commented 5 months ago

A quick testing pipeline using this container (https://github.com/furrer-lab/devel-abn/actions/runs/7495135469/job/20471533655?pr=92) ran through as expected.

I'd say it's ready to merge.

The pipeline doesn't fail upon a test failure though... See: https://github.com/furrer-lab/devel-abn/actions/runs/7495135469/job/20471533655#step:7:340

j-i-l commented 5 months ago

A quick testing pipeline using this container (https://github.com/furrer-lab/devel-abn/actions/runs/7495135469/job/20471533655?pr=92) ran through as expected.

I'd say it's ready to merge.

The pipeline doesn't fail upon a test failure though... See: https://github.com/furrer-lab/devel-abn/actions/runs/7495135469/job/20471533655#step:7:340

Indeed! Will change this.

j-i-l commented 5 months ago

A quick testing pipeline using this container (https://github.com/furrer-lab/devel-abn/actions/runs/7495135469/job/20471533655?pr=92) ran through as expected. I'd say it's ready to merge.

The pipeline doesn't fail upon a test failure though... See: https://github.com/furrer-lab/devel-abn/actions/runs/7495135469/job/20471533655#step:7:340

Indeed you're right. Will be addressed with https://github.com/furrer-lab/devel-abn/pull/92#pullrequestreview-1821013802 as this is not related to the container configuration.