How to update a package that has StanHeaders and rstan in its LinkingTo

Yes, it’s there. I just followed the instructions here and here, and now get additional warnings from R CMD check:

* DONE
Status: 2 WARNINGs

See
  ‘/bmlm.Rcheck/00check.log’
for details.


checking compilation flags used ... WARNING
Compilation used the following non-portable flag(s):
  ‘-Wno-macro-redefined’ ‘-Wno-unknown-pragmas’ ‘-Wno-unused-function’
  ‘-Wno-unused-variable’
including flag(s) suppressing warnings

checking compiled code ... WARNING
File ‘bmlm/libs/bmlm.so’:
  Found ‘_abort’, possibly from ‘abort’ (C)
    Object: ‘Modules.o’

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.

See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual.
R CMD check results
0 errors | 2 warnings | 0 notes

R CMD check succeeded

My ~/.R/Makevars looks like this:

R_XTRA_CPPFLAGS =  -I$(R_INCLUDE_DIR)   #set_by_rstan
CC=/usr/local/clang4/bin/clang
CXX=/usr/local/clang4/bin/clang++
CXX1X=/usr/local/clang4/bin/clang++
CXX98=/usr/local/clang4/bin/clang++
CXX11=/usr/local/clang4/bin/clang++
CXX14=/usr/local/clang4/bin/clang++
CXX17=/usr/local/clang4/bin/clang++
LDFLAGS=-L/usr/local/clang4/lib

CXX14FLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function  -Wno-macro-redefined -Wno-unknown-pragmas

CC=clang
CXX14=clang++ -arch x86_64 -ftemplate-depth-256

There are multiple entries for some keys, but I’ve left them as is because that’s what’s created when following the steps outlined in the links above.


Update:
Removing this line

R_XTRA_CPPFLAGS =  -I$(R_INCLUDE_DIR)   #set_by_rstan

Removes the warning

checking compiled code ... WARNING
File ‘bmlm/libs/bmlm.so’:
  Found ‘_abort’, possibly from ‘abort’ (C)
    Object: ‘Modules.o’

Is it safe to remove that line? And if so, can I also safely remove the other flags that result in warnings?