Not sure if this helps. I tried your suggestion and swapped over to a Windows instance (just in case). It produced slightly different error messages.
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! file2cc451971e87.cpp:6:36: warning: ISO C99 requires whitespace after the macro name
#define STAN__SERVICES__COMMAND_HPP#include <boost/integer/integer_log2.hpp>
^
In file included from C:/Users/Documents/R/R-3.5.3/library/BH/include/boost/math/distributions/gamma.hpp:13:0,
from G:/Documents/work_folder/projects_research/code/spi_paper/myqgamma.hpp:1,
from file2cc451971e87.cpp:39:
C:/Users/Documents/R/R-3.5.3/library/BH/include/boost/math/distributions/fwd.hpp:16:1: error: expected identifier before 'namespace'
namespace boost{ namespace math{
^
C:/Users/Documents/R/R-3.5.3/library/BH/include/boost/math/distributions/fwd.hpp:16:1: error: expected '>' before 'namespace'
C:/Users/Documents/R/R-3.5.3/library/BH/include/boost/math/distributions/fwd.hpp:16:16: error: expected unqualified-id before '{' token
namespac
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command 'C:/Users/Documents/R/R-3.5.3/bin/x64/R CMD SHLIB file2cc451971e87.cpp 2> file2cc451971e87.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection
>