ANTsX / ANTsR

R interface to the ANTs biomedical image processing library
https://antsx.github.io/ANTsR
Apache License 2.0
127 stars 35 forks source link

Installation fail with devtools #377

Open ptsii opened 1 year ago

ptsii commented 1 year ago

I just tried to build ANTsR from within R doing:

> library(devtools)
> install_github("stnava/cmaker")
> install_github("stnava/ANTsR")

It seemed to compile fine, but then failed on the install:

installing to /Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-ANTsR/00new/ANTsR/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘ANTsR’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-ANTsR/00new/ANTsR/libs/ANTsR.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-ANTsR/00new/ANTsR/libs/ANTsR.so, 0x0006): symbol not found in flat namespace (_composeDisplacementFields)
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/ANTsR’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/22/g163kh494cj0yrk3fqkc13240000gq/T//RtmpbUSmYm/file49a5753f8886/ANTsR_0.5.7.5.tar.gz’ had non-zero exit status

This is a multi-user machine (OSX), but this was done from one of the accounts that has admin privileges.

Any ideas about what might have happened?

ptsii commented 1 year ago

I'm not sure what this means (what caused the problem). It occurred twice FWIW. I ended up trying to install using Method 2 (from command line) listed here: https://github.com/ANTsX/ANTsR. That worked without errors.

cookpa commented 1 year ago

Thanks for the workaround. I've not used cmaker in a long time - what version of cmake does it provide? If it's too old, that might be the cause of compilation problems.

ptsii commented 1 year ago

I'm not sure how to check that - how do I check what version of cmaker it provides? That may well be the issue, because before trying the second method (command line install sequence using R CMD INSTALL), I in fact updated to the latest cmaker.

cookpa commented 1 year ago

Looks like CMake 3.11 from here

https://github.com/stnava/cmaker/blob/master/DESCRIPTION

I think but I'm not sure that R CMD install uses system commands, so if you have a newer cmake in your environment, that might be why it works.

cookpa commented 1 year ago

I have reproduced this error via Docker, when installing using devtools::install and remotes::install

#8 6553.4 Error: package or namespace load failed for ‘ANTsR’ in dyn.load(file, DLLpath = DLLpath, ...):
#8 6553.4  unable to load shared object '/usr/local/lib/R/site-library/00LOCK-ANTsR/00new/ANTsR/libs/ANTsR.so':
#8 6553.4   /usr/local/lib/R/site-library/00LOCK-ANTsR/00new/ANTsR/libs/ANTsR.so: undefined symbol: composeDisplacementFields
#8 6553.4 Error: loading failed
#8 6553.4 Execution halted

This is using R 4.0.5 and CMake 3.25.3, so I think it's not cmake.