Rstan を変な環境にインストール

その1:processxで詰まる。
(1)ソースをもってくる。
(2)ソースを展開して、一つ一つ下のようにビルド。
(3)ソースを圧縮、Rに読ませる。install.packages("processx.tar",repos=NULL,type="source")


他は、processx-vector.c はg++に変えるとかで対処できる。

Rstanインストール時の
In file included from processx.h(34),
from create-time.c(4):
unix/processx-unix.h(29): error: identifier "siginfo_t" is undefined
void processx__sigchld_callback(int sig, siginfo_t *info, void *ctx);
^

compilation aborted for create-time.c (code 2)

とか、
In file included from processx.h:34:0,
from create-time.c:4:
unix/processx-unix.h:29:42: error: unknown type name ‘siginfo_t’
void processx__sigchld_callback(int sig, siginfo_t *info, void *ctx);

のエラーは、
gcc -std=gnu99 -I"/ap/r/3.5.1/lib64/R/include" -DNDEBUG -I/usr/local/include -D_POSIX_C_SOURCE=199309L -fpic -g -O2 -std=c99 -c create-time.c -o create-time.o

を加える必要あり。
-D_POSIX_C_SOURCE=199309L

https://github.com/geommer/yabar/issues/18

その2:rstanで詰まる
Error in .shlib_internal(args) :
C++14 standard requested but CXX14 is not defined

https://qiita.com/kouki111x1/items/0ae9ef4fff617a8c0f55

ホームの下に、.Rに以下のRmarkvarsように作成して対処
dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR))
dir.create(dotR)
M <- file.path(dotR, "Makevars")
if (!file.exists(M))
file.create(M)
cat("\nCXX14FLAGS=-O3 -Wno-unused-variable -Wno-unused-function -fPIC",
"CXX14 = g++ -std=c++1y",
file = M, sep = "\n", append = TRUE)
途中で -fPICをいれろとあったので、追加
CXX14がはいってないので、下のバージョンで