Closed navarromia2 closed 4 years ago
@navarromia2: the compiler seems to be complaining
clang: error: no such file or directory: '1/Documents/GADL_Model'
Is there a file or directory at that location on your machine?
Look at the line invoking the compiler:
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I -I/Users/mianavarro 1/Documents/GADL_Model -I/usr/local/include -fPIC -Wall -g -O2 -c /var/folders/yk/_h3q1nws2f13n6p3_0w2h5xh0000gp/T//Rtmp4MPStb/74117/pomp_c2e76eb1a52f716b7bbe3d4a676b8d8a.c -o /var/folders/yk/_h3q1nws2f13n6p3_0w2h5xh0000gp/T//Rtmp4MPStb/74117/pomp_c2e76eb1a52f716b7bbe3d4a676b8d8a.o
It seems you have perhaps a directory named /Users/mianavarro 1
? Command-line tools handle file and directory names with spaces in them properly only if you take care to quote them appropriately. That's always something of a difficulty, as different kinds of quotes are needed in different contexts. The easiest solution is probably just to remove spaces from your file and directory names. You'll notice that most programmers use underscores "_" where a space " " would make sense from the point of view of natural language. The reason is that for the shell (the program that interprets the command-line instructions), the space is syntactic. Of course, in natural language it is too.
If you want my unsolicited advice, I would recommend that you make a habit of excluding all spaces from all your file and directory names. There is a little command called detox
that will do this for you (but be cautious when using it in bulk).
Also (more unsolicited advice, apologies for that), remember: the error messages are your friend!
@navarromia2: the compiler seems to be complaining
clang: error: no such file or directory: '1/Documents/GADL_Model'
Is there a file or directory at that location on your machine?
Yes, there is a folder in the Documents directory called GADL_Model, which holds the R script and the csv.
After fixing the space and turning the periods into underscores in variable names, I now have this error:
Error: error in building shared-object library from C snippets: in ‘Cbuilder’: compilation error: cannot compile shared-object library ‘/var/folders/yk/_h3q1nws2f13n6p3_0w2h5xh0000gp/T//RtmpYUhGyY/2538/pomp_adc970b3eddd7d97d12f8c38c4d74243.so’: status = 1
compiler messages:
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/pomp/include -I/Users/mianavarro_1/Documents/GADL_Model -I/usr/local/include -fPIC -Wall -g -O2 -c /var/folders/yk/_h3q1nws2f13n6p3_0w2h5xh0000gp/T//RtmpYUhGyY/2538/pomp_adc970b3eddd7d97d12f8c38c4d74243.c -o /var/folders/yk/_h3q1nws2f13n6p3_0w2h5xh0000gp/T//RtmpYUhGyY/2538/pomp_adc970b3eddd7d97d12f8c38c4d74243.o
/var/folders/yk/_h3q1nws2f13n6p3_0w2h5xh0000gp/T//RtmpYUhGyY/2538/pomp_adc970b3eddd7d97d12f8c38c4d74243.c:590:5: error: use of undeclared identifier 'dSk_dt'
dSk_dt = -(lam_kk + lam_ka + lam_kv) * Sk + phi_kC * Ck;
^
/var/folder
In addition: Warning message:
In system2(command = R.home("bin/R"), args = c("CMD", "SHLIB", "-c", :
running command 'PKG_CPPFLAGS="-I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/pomp/include -I/Users/mianavarro_1/Documents/GADL_Model" '/Library/Frameworks/R.framework/Resources/bin/R' CMD SHLIB -c -o /var/folders/yk/_h3q1nws2f13n6p3_0w2h5xh0000gp/T//RtmpYUhGyY/2538/pomp_adc970b3eddd7d97d12f8c38c4d74243.so /var/folders/yk/_h3q1nws2f13n6p3_0w2h5xh0000gp/T//RtmpYUhGyY/2538/pomp_adc970b3eddd7d97d12f8c38c4d74243.c 2>&1' had status 1```
I see you understood to fix the path to the GADL_Model
folder.
On to your latest message. The error message says
error: use of undeclared identifier 'dSk_dt'
Have you declared dSK_dt
? It seems you have not, at least in the last code that you have shown.
The compiler messages are generally somewhat informative, but one must read them for them to be useful. If these messages are not sufficiently meaningful, one can often google the error message to find out what it means.
Looking ahead, I point out that the assignment operator in C is not '<-' as in R, but is rather '='.
In general, C snippets must contain valid C code. Please consult a reference on writing C, or find someone willing to teach you these basics. This is not the intended purpose of the issues page.
Hi @kingaa ,
I have a compilation error which I think is caused due to syntax misspecification. However, unlike the error: use of undeclared identifier 'dSk_dt'
in your comment above, I get no hints from my error messages about the offending syntax.
I know that it might be a syntactic error since I have reproduced it by purposely misspecifying a Csnippet
within a working code elsewhere. Is there an option in the pomp
call that I might have switched on/off by mistake? Frankly, I have never incurred this issue before.
Any insight would be greatly appreciated.
Following is the error message --
Error: error in building shared-object library from C snippets: in ‘Cbuilder’: compilation error: cannot compile shared-object library ‘/Users/devengokhale/Documents/GitHub/social-determinants-causal-inference/workshop/toy_cm/SEIR/seir_metapop_toy.so’: status = 1
compiler messages:
using C compiler: ‘Apple clang version 15.0.0 (clang-1500.1.0.2.5)’
using SDK: ‘MacOSX14.2.sdk’
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Users/devengokhale/Library/R/arm64/4.3/library/pomp/include' -I'/Users/devengokhale/Documents/GitHub/social-determinants-causal-inference/workshop/toy_cm/SEIR' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c /Users/devengokhale/Documents/GitHub/social-determinants-causal-inference/workshop/toy_cm/SEIR/seir_metapop_toy.c -o /Users/devengokhale/Documents/GitHub/social-determinants-causal-inference/workshop/toy_cm/SEIR/seir_metapop_toy.o
/Users/devengokhale/Documents/GitHub/social-determinants-
In addition: Warning message:
In system2(command = R.home("bin/R"), args = c("CMD", "SHLIB", "-c", :
running command 'PKG_CPPFLAGS="-I'/Users/devengokhale/Library/R/arm64/4.3/library/pomp/include' -I'/Users/devengokhale/Documents/GitHub/social-determinants-causal-inference/workshop/toy_cm/SEIR'" '/Library/Frameworks/R.framework/Resources/bin/R' CMD SHLIB -c -o /Users/devengokhale/Documents/GitHub/social-determinants-causal-inference/workshop/toy_cm/SEIR/seir_metapop_toy.so /Users/devengokhale/Documents/GitHub/social-determinants-causal-inference/workshop/toy_cm/SEIR/seir_metapop_toy.c 2>&1' had status 1
@vgdeven: sorry that the error message is not more helpful. pomp can only pass along the messages it gets from the compiler. It should be possible to get your compiler (clang
) to give more informative messages, through some combination of options and environment variables. You can adjust various environment variables to control the options that are passed to the compiler on a call to R CMD SHLIB
.
You may find it useful to save the whole C file that pomp
is creating (adjust the cfile
and/or cdir
options as needed) and then try to compile it manually just to interact more directly with the compiler.
@kingaa: On tinkering with this issue for a bit, a rather bizarre behavior clang emerged. If executed while setting the home (root) directory of my hard drive as my working directory, all of my error messages are again switched to being very informative.
I think there is a certain clang option that restricts the diagnostic output to the root directory. I am reading up on clang right now. I will post a solution here if I find one.
But thanks very much for helping out.
Hello Aaron,
After going through your FAQ and trying the two installation methods, as well as installing XCode, I keep getting the compilation error. I followed your script linked below using the negative binomial distribution. Let me know what you may think the error is. I also looked at forum posts and reviewed your advice there (ex. installing gfortran) and still no luck.
Best, Mia
(I also attached the data csv in case you need it.) Cleaned dati-regioni_Lombardia 0224-0424.csv.zip
Error & Code (starts after line of ##)
(@kingaa removed the link to Issue 9, which was marked "invalid" and is not pertinent here).