James-Thorson/spatial_DFA

Compiling C++ file

DubChen opened this issue · 12 comments

Hi Jim,

Trying to set up spatial DFA on my computer, but seem to be running into issues after getting all the packages installed. When I go to compile with the following code from your example:

TmbFile = system.file("executables", package="SpatialDFA")

library( INLA )
library( TMB )

library( SpatialDFA )
Version = "spatial_dfa_v18"

setwd( TmbFile )
compile( paste0(Version,".cpp") )

I get the following errors:

Note: Using Makevars in C:/Users/wchen16/Documents/.R/Makevars
c:/Rtools/mingw_64/bin/g++ -I"C:/PROGRA1/R/R-331.1/include" -DNDEBUG -IC:/Users/wchen16/DOCUME1/R/WIN-LI1/3.3/TMB/include -DTMB_SAFEBOUNDS -DLIB_UNLOAD=R_unload_spatial_dfa_v18 -DTMB_LIB_INIT=R_init_spatial_dfa_v18 -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -mtune=core2 -c spatial_dfa_v18.cpp -o spatial_dfa_v18.o
c:/Rtools/mingw_64/bin/g++: not found
make: *** [spatial_dfa_v18.o] Error 127
Error in compile(paste0(Version, ".cpp")) : Compilation failed
In addition: Warning message:
running command 'make -f "C:/PROGRA1/R/R-331.1/etc/x64/Makeconf" -f "C:/PROGRA1/R/R-331.1/share/make/winshlib.mk" -f "C:\Users\wchen16\AppData\Local\Temp\RtmpQrHdY7\file3b43c5e6ef0" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="spatial_dfa_v18.dll" WIN=64 TCLBIN=64 OBJECTS="spatial_dfa_v18.o"' had status 2

Is it possible that the paths/directories to the missing files are incorrect? I notice a lowercase "c:" rather than "C:", but I don't know where I'd go to change that.

Thanks in advance!
Will

Will,

I'm sorry to say that this is a TMB-installation problem rather than a
problem with SpatialDFA per se (you can tell from the "Error 127" message). I recommend trying the three installation methods listed here: https://github.com/James-Thorson/2016_Spatio-temporal_models. If none of them work, please post an issue on the TMB issue
tracker (https://github.com/kaskr/adcomp/issues).

jim

Ah, thanks. I'll try again.

@DubChen
Hi, DubChen
I'm also facing this problem. Have you solved this problem yet?
Can you give me some help with this question?

Thanks in advance!
Han Qingpeng

Note: Using Makevars in C:/Users/PC/Documents/.R/Makevars
Error in compile(paste0(Version, ".cpp")) : Compilation failed
In addition: Warning message:
running command 'make -f "d:/PROGRA2/R/R-341.2/etc/x64/Makeconf" -f "d:/PROGRA2/R/R-341.2/share/make/winshlib.mk" -f "C:\Users\PC\AppData\Local\Temp\RtmpgDmj48\file97450543bad" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="geo_index_v4b.dll" WIN=64 TCLBIN=64 OBJECTS="geo_index_v4b.o"' had status 127

@James-Thorson
thank you
I have solved this problem through these steps to confirm that TMB was working: https://github.com/nwfsc-assess/geostatistical_delta-GLMM/wiki/Steps-to-install-TMB..

While I could easily install TMB, I think my problem is with TMBHelper

ERROR: hard-coded installation path: please report to the package maintainer and use ‘--no-staged-install’
* removing ‘/Users/diogoborgesprovete/Library/R/3.6/library/00LOCK-FishStatsUtils/00new/TMBhelper’
Error: package or namespace load failed for ‘FishStatsUtils’:
 .onAttach failed in attachNamespace() for 'FishStatsUtils', details:
  call: NULL
  error: Failed to install 'TMBhelper' from GitHub:
  (converted from warning) installation of package ‘/var/folders/kd/_k75gv855qxbyrqq0rtqk1w40000gr/T//RtmpGath4o/filed1524fd43114/TMBhelper_1.2.0.tar.gz’ had non-zero exit status
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/diogoborgesprovete/Library/R/3.6/library/FishStatsUtils’
Error: Failed to install 'SpatialDFA' from GitHub:
  Failed to install 'FishStatsUtils' from GitHub:
  (converted from warning) installation of package ‘/var/folders/kd/_k75gv855qxbyrqq0rtqk1w40000gr/T//RtmpTwKdJd/file1ee37f8942f0/FishStatsUtils_2.5.0.tar.gz’ had non-zero exit status

Any thoughts?

Thank you in advance

This package is deprecated, and (essentially) all functionality is available in package VAST. VAST also contains instructions here for dealing with this "staged-install" error.

What are you aiming to use SpatialDFA for?

Thanks for the quick @James-Thorson !
I was hoping to use your JSDM for spatio-temporal dynamics, the GEB paper. Is it implemented in SpatialDFA, isn't it?

Best

the GEB paper is implemented using SpatialDFA. As I said though, VAST does the same stuff and is better maintained and has more functionality. Are you trying to do a strict replication study (which would require SpatialDFA), or you trying to adapt it to new circumstances (where I recommend using VAST)?

I see. I missread the previous message as you saying the TMBhelper was deprecated, not SpatialDFA.
I quickly tried to install VAST, but came across some errors. I'm check your debugging page and see if I can deal with it. I saw MacOS and recent version of R may have errors.

BTW, yes I'm trying to adapt it to new circumstances, analysing a frog metacommunity with temporal replication (13 months and 14 ponds) with respective environmental predictor variables.

Thanks a lot again.