<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>