hclimente / martini

🍸R version of SConES, a systems-biology approach to GWAS.
4 stars 2 forks source link

Failed to build from source without `memoise` #9

Closed sukanka closed 1 year ago

sukanka commented 1 year ago

memoise is in Suggests, so I take it as optional and try to build martini without memoise, but the build process failed.

The relevant log is

** byte-compile and prepare package for lazy loading
Error in loadNamespace(x) : there is no package called ‘memoise’
Error: unable to load R code in package ‘martini’
Execution halted
ERROR: lazy loading failed for package ‘martini’
* removing ‘/build/r-martini/src/martini’
* restoring previous ‘/build/r-martini/src/martini’

For full log, see https://build.bioarchlinux.org/api/pkg/r-martini/log/1669469803

So, perhaps memoise should be in Imports or Depends?

hclimente commented 1 year ago

Thanks for the report. I am surprised that this is not popping up in Bioconductor's nightly builds or on my local runs.

Do you have a command I can use to reproduce it?

sukanka commented 1 year ago

Thanks for your reply. I'm building it on archlinux, so I can provide the PKGBUILD, if r-memoise is removed, the build process will fail.

Perhaps you could try to build it in a clear R installation with only these packages installed.

r-igraph
r-rcpp
r-rcppeigen
r-snpstats

This should reproduce the error. Thanks!

sukanka commented 1 year ago

Update: Another way to reproduce:

  1. Prepare a clear R installation, make sure memoise is NOT installed, and make sure gcc-fortran (i.e., gfortran) is installed.
  2. In R, run
    
    if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("martini")

3. Get the error

... g++ -std=gnu++14 -I"/usr/include/R/" -DNDEBUG -I'/home/sukanka/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I'/home/sukanka/R/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include' -I/usr/local/include -std=c++11 -fopenmp -D_USE_KNETFILE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -DBGZF_CACHE -I./lib /usr/lib64/R/bin/Rscript -e "Rcpp:::CxxFlags()" -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS -fopenmp -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects -c lib/maxflow/maxflow.cpp -o lib/maxflow/maxflow.o ar -crus libmaxflow.a lib/maxflow/maxflow.o ar: u' modifier ignored sinceD' is the default (see `U') cp -r lib/maxflow "/home/sukanka/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-martini/00new/martini/include" mkdir -p "/home/sukanka/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-martini/00new/martini/usrlib" cp libmaxflow.a "/home/sukanka/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-martini/00new/martini/usrlib" g++ -std=gnu++14 -shared -L/usr/lib64/R/lib -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -o martini.so RcppExports.o mincut.o -pthread -fopenmp /home/sukanka/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-martini/00new/martini/usrlib/libmaxflow.a -fopenmp -pthread -L/usr/lib64/R/lib -lR installing to /home/sukanka/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-martini/00new/martini/libs R data * moving datasets to lazyload DB inst ** byte-compile and prepare package for lazy loading Error in loadNamespace(x) : there is no package called ‘memoise’ Error: unable to load R code in package ‘martini’ Execution halted ERROR: lazy loading failed for package ‘martini’

The downloaded source packages are in ‘/tmp/RtmpbfXjeR/downloaded_packages’ Installation paths not writeable, unable to update packages path: /usr/lib/R/library packages: boot, foreign, Matrix, nlme, survival Warning message: In install.packages(...) : installation of package ‘martini’ had non-zero exit status

The probable reason is memoise is called in the function get_gxg https://github.com/hclimente/martini/blob/1ad4e08051076a0b2fa327859da144f6d4c437b6/R/db.R#L183-L191 However, the function get_gxg requires memoise to be installed, and then get_gxg is called in tests, for example https://github.com/hclimente/martini/blob/1ad4e08051076a0b2fa327859da144f6d4c437b6/tests/testthat/test_get_gxg.R#L9-L15

So without disabling tests, this package has to be installed with memoise present.

hclimente commented 1 year ago

I was able to reproduce the error, and added memoise to Imports. It should be available on Bioconductor soon. Thank you for your help to fix it!

I still cannot see why this error happened. As far as I know, installing a package does not invoke the tests, so I do not think get_gxg is called at installation time. This issue does not happen with STRINGdb or httr either...

sukanka commented 1 year ago

It's available on BIOC now, thanks!