kingaa / pomp

R package for statistical inference using partially observed Markov processes
https://kingaa.github.io/pomp
GNU General Public License v3.0
111 stars 27 forks source link

cannot compile shared library error #76

Closed eclee25 closed 6 years ago

eclee25 commented 6 years ago

Hello,

I am encountering cannot compile shared-object library errors in two independent installations of pomp. In both installations, I have executed the code described in FAQ 4.2 and the correct outputs were printed. It seems that the errors arose when I tried to examine diagnostic plots from my models.

In setup 1, I am running pomp v1.18.8.1 on a Windows machine with R v3.4.4. Below are the errors and warnings encountered:

`Error in { : task 1 failed - "cannot compile shared-object library 'C:/Users/eclee/AppData/Local/Temp/RtmpMflR9X/12960/pomp_4b25dac22029d58a63db14ebe865424a.dll': status = 1 compiler messages: C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-34~1.4/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c C:/Users/eclee/AppData/Local/Temp/RtmpMflR9X/12960/pomp_4b25dac22029d58a63db14ebe865424a.c -o C:/Users/eclee/AppData/Local/Temp/RtmpMflR9X/12960/pomp_4b25dac22029d58a63db14ebe865424a.o C:/Users/eclee/AppData/Local/Temp/RtmpMflR9X/12960/pomp_4b25dac22029d58a63db14ebe865424a.c:5:18: fatal error: pomp.h: No such file or directory

include

              ^

compilation terminated. make: *** [C:/PROGRA~1/R/R-34~1.4/etc/x64/Makeconf:208: C:/Users/eclee/AppData/Local/Temp/RtmpMflR9X/12960/pomp4b25dac22029d58a63db14ebe865424a.o] Error 1 Warning message: running command 'make -f "C:/PROGRA~1/R/R-34~1.4/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-34~1.4/share/make/winshlib.mk" SHLIB

In setup 2, I am running pomp v1.18.8.1 on an Ubuntu 16.04.3 LTS machine with R v3.4.3. Below are the errors and warnings encountered:

'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet \ CMD SHLIB foo.c

Error: in ‘pomp’: error in building shared-object library from C snippets: in ‘Cbuilder’: compilation error: cannot compile shared-object library ‘/home/eclee25/.tmp/RtmpHTHvJV/2808/pomp_a7dfe8b5bfa01eb49a2f83706336854e.so’: status = 1 compiler messages: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/eclee25/R/x86_64-pc-linux-gnu-library/3.4/pomp/include -I/home/eclee25/cholera/trunk -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c /home/eclee25/.tmp/RtmpHTHvJV/2808/pomp_a7dfe8b5bfa01eb49a2f83706336854e.c -o /home/eclee25/.tmp/RtmpHTHvJV/2808/pomp_a7dfe8b5bfa01eb49a2f83706336854e.o /home/eclee25/.tmp/RtmpHTHvJV/2808/pomp_a7dfe8b5bfa01eb49a2f83706336854e.c: In function ‘__pomp_stepfn’: /home/eclee25/.tmp/RtmpHTHvJV/2808/pomp_a7dfe8b5bfa01eb49a2f83706336854e.c:41:76: fatal error: C:/Users/eclee/Documents/R/win-library/3.4/pomp/include/pomp.h: No such file or directory compilation terminated. /usr/l In addition: Warning message: running command 'PKG_CPPFLAGS="-I/home/eclee25/R/x86_64-pc-linux-gnu-library/3.4/pomp/include -I/home/eclee25/cholera/trunk" '/usr/lib/R/bin/R' CMD SHLIB -c -o /home/eclee25/.tmp/RtmpHTHvJV/2808/pomp_a7dfe8b5bfa01eb49a2f83706336854e.so /home/eclee25/.tmp/RtmpHTHvJV/2808/pomp_a7dfe8b5bfa01eb49a2f83706336854e.c 2>&1' had status 1

Any ideas on what may resolve these issues? Thanks!

kingaa commented 6 years ago

In the first error, the compiler complains about not being able to find the 'pomp.h' header. This is ordinarily not a problem, and the appearance of the '#include ' message makes me suspect something is strange about the code you are attempting to compile. Can you send a reproducible example?

The second situation is even weirder, since you are on a linux box, but the code is searching in "C:/Users/eclee/", which is a windows path. Are you sure you installed the packages correctly?

In any event, if you send me the codes that generate these errors, it will be most helpful.

eclee25 commented 6 years ago

Thanks for the quick response. I'm realizing now that I had been playing around with putting an include statement in one of the Csnippets in response to my error in setup 1. That's why the error in setup 2 is so strange. I think setup 2 seems to be working now that this line is removed, but I'll try to make a simple reproducible example in setup 1.

eclee25 commented 6 years ago

I believe that there was indeed a problem with my pomp model that seems to have triggered these errors, and now everything appears to be working. Thanks for your help. Closing this issue.

natelee1019 commented 5 years ago

Sorry I also encounter such problem when i was using pomp2 in R studio. I have installed the package successfully but unable to use their result

Code:

parus %>%
pfilter(Np=1000,times="year",t0=1960,
params=c(K=190,r=2.7,sigma=0.2,theta=0.05,N.0=148),
rprocess=discrete_time(
function (r, K, sigma, N, ...) {
e <- rnorm(n=1,mean=0,sd=sigma)
c(N = exp(log(N)+r*(1-N/K)+e))
},
delta.t=1
),
rmeasure=function (N, theta, ...) {
c(pop=rnbinom(n=1,size=1/theta,mu=N+1e-10))
},
dmeasure=function (pop, N, theta, ..., log) {
dnbinom(x=pop,mu=N+1e-10,size=1/theta,log=log)
},
partrans=parameter_trans(log=c("sigma","theta","N_0","r","K")),
paramnames=c("sigma","theta","N_0","r","K")
) -> pf

Error:

in ‘pfilter’: error in building shared-object library from C snippets: in ‘Cbuilder’: compilation error: cannot compile shared-object library ‘C:/Users/Nate/AppData/Local/Temp/Rtmpu2FrxK/13772/pomp_a4090d204de6cc36ae02b72bd061b471.dll’: status = 1 compiler messages: Warning messages: 1: In system(cmd) : 'make' not found 2: In system(paste(cmd, "shlib-clean")) : 'make' not found
kingaa commented 5 years ago

FAQ 4.3