<div dir="ltr">Hello Everyone,<div><br><div><div>I am trying to generate a C static library(libdeepstate.a) in an Rcpp(inst/include/lib) package using Makevars similar to RInside(generating RInside.so and RInside.a)</div><div>My static library libdeepstate.a  has four compiled c programs </div><div><img src="cid:ii_kbwop1hf0" alt="image.png" width="472" height="87" class="gmail-CToWUd"><br></div><div><br></div><div>I saved those files DeepState.c, Log.c,Option.c,Stream.c in inst/include folder and using src/Makevars to compile those *.c files and link the respective object files with the static library as follows:</div><div>src/Makevars:</div><div><div><font face="monospace">USERLIBST=libdeepstate.a<br>USERDIR=../inst/lib<br>PKG_CPPFLAGS =-I. -I../inst/include/<br>PKG_LIBS =<br>all: $(SHLIB) userLibrary<br>SOURCES= ../inst/include/DeepState.c ../inst/include/Log.c ../inst/include/Option.c ../inst/include/Stream.c<br>OBJECTS= $(SOURCES:.c=.o)<br>userLibrary: $(USERLIBST)<br>-@if test ! -e $(USERDIR)$(R_ARCH); then mkdir -p $(USERDIR)$(R_ARCH); fi<br>cp $(USERLIBST) $(USERDIR)$(R_ARCH)<br>rm $(USERLIBST)<br><b>$(USERLIBST): $(OBJECTS)<br>$(AR) qc $(USERLIBST) $^</b><br>@if test -n "$(RANLIB)"; then $(RANLIB) $(USERLIBST); fi</font><br><br></div><div>When I install the package I get something like this :<br></div></div><div><br></div><div><b><font face="monospace">gcc -I"/home/akhila/lib/R/include" -DNDEBUG -I. -I../inst/include/   -I/usr/local/include  -fpic  -g -O2  -c ../inst/include/DeepState.c -o ../inst/include/DeepState.o<br>gcc -I"/home/akhila/lib/R/include" -DNDEBUG -I. -I../inst/include/   -I/usr/local/include  -fpic  -g -O2  -c ../inst/include/Log.c -o ../inst/include/Log.o<br>gcc -I"/home/akhila/lib/R/include" -DNDEBUG -I. -I../inst/include/   -I/usr/local/include  -fpic  -g -O2  -c ../inst/include/Option.c -o ../inst/include/Option.o<br>gcc -I"/home/akhila/lib/R/include" -DNDEBUG -I. -I../inst/include/   -I/usr/local/include  -fpic  -g -O2  -c ../inst/include/Stream.c -o ../inst/include/Stream.o<br>gcc -shared -L/home/akhila/lib/R/lib -L/usr/local/lib -o testproject.so ../inst/include/DeepState.o ../inst/include/Log.o ../inst/include/Option.o ../inst/include/Stream.o -L/home/akhila/lib/R/lib -lR<br>ar qc libdeepstate.a ../inst/include/DeepState.o ../inst/include/Log.o ../inst/include/Option.o ../inst/include/Stream.o<br>cp libdeepstate.a ../inst/lib</font></b></div><div><b><font face="monospace">rm libdeepstate.a</font></b><br></div><div><br></div><div>The code can be found in GitHub:<a href="https://github.com/akhikolla/RcppDeepState/">https://github.com/akhikolla/RcppDeepState/</a></div><div>This Travis build has the complete details of the warnings: <a href="https://travis-ci.org/github/akhikolla/RcppDeepState/builds/702470420">https://travis-ci.org/github/akhikolla/RcppDeepState/builds/702470420</a></div><div>But when I check the package I get the following warnings: using devtools::check()</div><div><font face="monospace"><b>W  checking pragmas in C/C++ headers and code ... WARNING</b><br></font></div><div><b><font face="monospace">   File which contains non-portable pragma(s)<br>     ‘inst/include/Log.c’<br>   File which contains pragma(s) suppressing diagnostics:<br>     ‘inst/include/Log.c’<br>✓  checking compilation flags used ...<br>W  checking compiled code ...<br>   File ‘testproject/libs/testproject.so’:<br>     Found ‘__assert_fail’, possibly from ‘assert’ (C)<br>       Object: ‘../inst/include/DeepState.o’<br>     Found ‘__printf_chk’, possibly from ‘printf’ (C)<br>       Objects: ‘../inst/include/DeepState.o’, ‘../inst/include/Log.o’<br>     Found ‘abort’, possibly from ‘abort’ (C)<br>       Object: ‘../inst/include/DeepState.o’<br>     Found ‘exit’, possibly from ‘exit’ (C)<br>       Objects: ‘../inst/include/DeepState.o’, ‘../inst/include/Option.o’<br>     Found ‘printf’, possibly from ‘printf’ (C)<br>       Object: ‘../inst/include/Log.o’<br>     Found ‘puts’, possibly from ‘printf’ (C), ‘puts’ (C)<br>       Objects: ‘../inst/include/DeepState.o’, ‘../inst/include/Log.o’<br>     Found ‘rand’, possibly from ‘rand’ (C)<br>       Object: ‘../inst/include/DeepState.o’<br>     Found ‘srand’, possibly from ‘srand’ (C)<br>       Object: ‘../inst/include/DeepState.o’<br>     Found ‘stderr’, possibly from ‘stderr’ (C)<br>       Object: ‘../inst/include/Log.o’<br>     Found ‘stdout’, possibly from ‘stdout’ (C)<br>       Object: ‘../inst/include/Log.o’<br>     Found ‘vprintf’, possibly from ‘vprintf’ (C)<br>       Object: ‘../inst/include/Log.o’<br>   File ‘testproject/libs/testproject.so’:<br>     Found no calls to: ‘R_registerRoutines’, ‘R_useDynamicSymbols’<br>   <br> Compiled code should not call entry points which might terminate R nor<br> write to stdout/stderr instead of to the console, nor use Fortran I/O<br> nor system RNGs.<br> It is good practice to register native routines and to disable symbol<br> search.<br></font></b></div><div><b><font face="monospace"><br></font></b></div><div>  <b>Found no calls to: ‘R_registerRoutines’, ‘R_useDynamicSymbols’  - why is this necessary as I am trying to compile some external C files(inst/include/DeepState.c) which are not in src folder</b></div><div>   <b>Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system RNGs. - what does this mean?</b>  <b><br></b></div><div>how can I solve this issue and get rid of the warning in the R CMD check?  </div><div>Can someone please suggest a way to resolve this?</div><div><br></div><div><br></div><div>Regards,</div></div></div><div>Akhila Chowdary Kolla</div></div>