PecanProject / pecan

The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.
www.pecanproject.org
Other
202 stars 233 forks source link

Make suddenly failing on Mojave 10.14.16 #2614

Open serbinsh opened 4 years ago

serbinsh commented 4 years ago

Bug Description

As discussed on Slack, I am suddenly struggling to get make to build PEcAn on my Mac OSX desktop. I have been successfully building on this machine for a few years now, this is a new problem. Idid recently update to R v4.0, which has caused other headaches, so maybe that is related? Basically here is the issue:

Running make at cmd

10-4-27-175:pecan sserbin$ make
./scripts/time.sh " modules/emulator" Rscript -e "options(Ncpus = 1, repos = 'https://cran.rstudio.com')" -e "deps <- if (grepl('base/utils', ' modules/emulator')) { c('Depends', 'Imports', 'LinkingTo') } else { TRUE }" -e "devtools::install_deps('modules/emulator', dependencies = deps, upgrade=FALSE)"

Results in


real    0m5.095s
user    0m3.322s
sys 0m0.267s
./scripts/time.sh " modules/emulator" Rscript -e "devtools::document('"modules/emulator"')"
Updating PEcAn.emulator documentation
Loading PEcAn.emulator
Error: Dependency package(s) 'tmvtnorm' not available.
Backtrace:
    █
 1. └─devtools::document("modules/emulator")
 2.   ├─withr::with_envvar(...)
 3.   │ └─base::force(code)
 4.   └─roxygen2::roxygenise(pkg$path, roclets, load_code = load_code)
 5.     └─roxygen2:::load_code(base_path)
 6.       └─pkgload::load_all(path, helpers = FALSE, attach_testthat = FALSE)
 7.         └─pkgload:::load_imports(path)
 8.           └─pkgload:::abort_for_missing_packages(res, imports$package)
In addition: Warning message:
In (function (dep_name, dep_ver = "*")  :
  Dependency package 'tmvtnorm' not available.
Execution halted
make: *** [.doc/modules/emulator] Error 1

I have installed that package. Also I can successfully do this in R studio

devtools::install_github(repo = "git@github.com:PecanProject/pecan.git", ref = "develop", subdir = "modules/emulator", dependencies = T, force = T)
Installing package into ‘/Users/sserbin/R/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘PEcAn.emulator’ ...
** using staged installation
** R
** 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
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (PEcAn.emulator)

Both are pointing to the same R library??

To Reproduce

make install

Expected behavior

PEcAn builds

Screenshots

NA

Machine (please complete the following information):

Additional context

Add any other context about the problem here.

serbinsh commented 4 years ago

Oh also I noticed make no longer shows where the packages are installing to. That was a handy feature to be sure it was using the correct R/library path

serbinsh commented 4 years ago

And also based on the debug suggestion by @infotroph

10-4-27-175:pecan sserbin$ Rscript -e '.libPaths()'
[1] "/Users/sserbin/R/library"
[2] "/Library/Frameworks/R.framework/Versions/4.0/Resources/library"

So i think its looking in the right place

robkooper commented 4 years ago

Only new library installed recently is libglpk-dev. Can you install tmvtnorm in Rstudio?

Also looks like you are using R version 4.0, so not sure all dependencies are ready for that (it should since I think travis has been building with that).

serbinsh commented 4 years ago

Probably related to a package dependency

> library(tmvtnorm)
Loading required package: mvtnorm
Loading required package: Matrix
Loading required package: stats4
Loading required package: gmm
Loading required package: sandwich
Error: package or namespace load failed for 'gmm' in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/sserbin/R/library/gmm/libs/gmm.so':
  dlopen(/Users/sserbin/R/library/gmm/libs/gmm.so, 6): Library not loaded: /usr/local/gfortran/lib/libgomp.1.dylib
  Referenced from: /Users/sserbin/R/library/gmm/libs/gmm.so
  Reason: image not found
Error: package 'gmm' could not be loaded
>

But after install gmm I still have issues

> library(gmm)
Loading required package: sandwich
Error: package or namespace load failed for ‘gmm’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/sserbin/R/library/gmm/libs/gmm.so':
  dlopen(/Users/sserbin/R/library/gmm/libs/gmm.so, 6): Library not loaded: /usr/local/gfortran/lib/libgomp.1.dylib
  Referenced from: /Users/sserbin/R/library/gmm/libs/gmm.so
  Reason: image not found
robkooper commented 4 years ago

Since you started with a new version of R, did you remove all existing files from /Users/sserbin/R/library? Did you update gfortran as well? What does ls - /usr/local/gfortran/lib/libgomp* return?

serbinsh commented 4 years ago

I ran update.packages. I have not updated gfortran from last install. Nothing in the lib folder it is referencing...hmm

serbinsh commented 4 years ago

Others have had this issue as well but need to find a solution: https://community.rstudio.com/t/loading-gmm-package-on-macosx/63594

serbinsh commented 4 years ago

Tried from source

> install.packages("gmm_1.6-4.tar.gz", repo = NULL, type = "source")
Installing package into ‘/Users/sserbin/R/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘gmm’ ...
** package ‘gmm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c lambda_met.f -o lambda_met.o
gcc-9 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c src.c -o src.o
gcc-9 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o gmm.so lambda_met.o src.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/Cellar/gcc/9.2.0/lib/gcc/9 -lgomp -L/usr/local/Cellar/gcc/9.2.0/lib/gcc/9 -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Users/sserbin/R/library/00LOCK-gmm/00new/gmm/libs
** R
** data
** 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
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (gmm)
>
> library(gmm)
Loading required package: sandwich
>
serbinsh commented 4 years ago
> library(tmvtnorm)
Loading required package: mvtnorm
Loading required package: Matrix
Loading required package: stats4
>
serbinsh commented 4 years ago

A mew one

./scripts/time.sh " modules/data.atmosphere" Rscript -e "devtools::document('"modules/data.atmosphere"')"
Updating PEcAn.data.atmosphere documentation
Updating roxygen version in /Users/sserbin/Data/GitHub/pecan/modules/data.atmosphere/DESCRIPTION
Loading PEcAn.data.atmosphere
Registered S3 method overwritten by 'hoardr':
  method           from
  print.cache_info httr
Error: Dependency package(s) 'nneo' not available.
Backtrace:
    █
 1. └─devtools::document("modules/data.atmosphere")
 2.   ├─withr::with_envvar(...)
 3.   │ └─base::force(code)
 4.   └─roxygen2::roxygenise(pkg$path, roclets, load_code = load_code)
 5.     └─roxygen2:::load_code(base_path)
 6.       └─pkgload::load_all(path, helpers = FALSE, attach_testthat = FALSE)
 7.         └─pkgload:::load_imports(path)
 8.           └─pkgload:::abort_for_missing_packages(res, imports$package)
In addition: Warning message:
In (function (dep_name, dep_ver = "*")  :
  Dependency package 'nneo' not available.
Execution halted
make: *** [.doc/modules/data.atmosphere] Error 1
10-4-26-86:pecan sserbin$ R
> install.packages('nneo')
Installing package into ‘/Users/sserbin/R/library’
(as ‘lib’ is unspecified)
Warning message:
package ‘nneo’ is not available (for R version 4.0.0)
>
serbinsh commented 4 years ago

So nneo is archived, am I missing something or is this still needed for pecan.atmosphere? This is the NEON package yes?

mdietze commented 4 years ago

We should drop that package and switch to the newer neonUtilities package

serbinsh commented 4 years ago
> devtools::install_github("ropenscilabs/nneo")
Skipping install of 'nneo' from a github remote, the SHA1 (37bb3d2d) has not changed since last install.
  Use `force = TRUE` to force installation
> devtools::install_github("ropenscilabs/nneo", force = TRUE)
Downloading GitHub repo ropenscilabs/nneo@master

OK thanks @mdietze

infotroph commented 4 years ago

See https://github.com/PecanProject/pecan/issues/2206 for more on nneo vs neonUtilities

serbinsh commented 4 years ago

Build finished once I sorted out all of these issues.

etaagen commented 3 years ago

Hi - I still have an error when loading gmm after installing from source - do you have any tips? Thank you!!

etaagen commented 3 years ago

I ended up having to update my OS to Big Sur so that I could download Xcode and installed gfortran from this source https://github.com/fxcoudert/gfortran-for-macOS/releases - problem solved!