Compilation ERROR

Hello stan mailinglist,
I have followed the procedures of rstan installation. However, I cannot run the 8 school example. I have provided information below. Can anyone help me out?

library(rstan)
Loading required package: ggplot2
Loading required package: StanHeaders
rstan (Version 2.16.2, packaged: 2017-07-03 09:24:58 UTC, GitRev: 2e1f913d3ca3)

Compilation ERROR, function(s)/method(s) not created! filee0034165935.cpp:8:39: fatal error: stan/model/model_header.hpp: No such file or directory

R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Sys.getenv(‘PATH’)
[1] "C:\Program Files\R\R-3.3.3\bin\x64;c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;c:\Rtools\bin;c:\Rtools\mingw_32\bin;c:\Rtools\bin;c:\Rtools\mingw_64\bin;

system(‘g++ -v’)
Using built-in specs.
COLLECT_GCC=c:\Rtools\GCC-46~1.3\bin\G__~1.EXE
COLLECT_LTO_WRAPPER=c:/rtools/gcc-46~1.3/bin/…/libexec/gcc/i686-w64-mingw32/4.6.3/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: /data/gannet/ripley/Sources/mingw-test3/src/gcc/configure --host=i686-w64-mingw32 --build=x86_64-linux-gnu --target=i686-w64-mingw32 --with-sysroot=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --prefix=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --with-gmp=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpfr=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpc=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --disable-shared --enable-static --enable-targets=all --enable-languages=c,c++,fortran --enable-libgomp --enable-sjlj-exceptions --enable-fully-dynamic-string --disable-nls --disable-werror --enable-checking=release --disable-win32-registry --disable-rpath --disable-werror CFLAGS=‘-O2 -mtune=core2 -fomit-frame-pointer’ LDFLAGS=
Thread model: win32
gcc version 4.6.3 20111208 (prerelease) (GCC)

cat(readLines(M), sep = “\n”)

CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function

CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations

CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function

CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations

Don’t use version 4.6.3 with R 3.3. Use 4.9.1. In that case, c:\Rtools\bin and c:\Rtools\mingw_64\bin should come first on your PATH.

I installed Rtools34 instead, but I have the same issue. What should I do then?

system(‘g++ -v’)
Using built-in specs.
COLLECT_GCC=c:\Rtools\mingw_32\bin\G__~1.EXE
COLLECT_LTO_WRAPPER=c:/Rtools/mingw_32/bin/…/libexec/gcc/i686-w64-mingw32/4.9.3/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: …/…/…/src/gcc-4.9.3/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/home/Jeroen/mingw-gcc-4.9.3/i686-493-posix-dwarf-rt_v3-s/mingw32 --with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++ --enable-static --disable-shared --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i6…
Thread model: posix
gcc version 4.9.3 (i686-posix-dwarf, Built by MinGW-W64 project)

Sys.getenv(‘PATH’)
[1] "C:\Program Files\R\R-3.3.3\bin\x64;c:\Rtools\bin;c:\Rtools\mingw_32\bin;

This is inconsistent. Assuming you have a 64bit machine, it should be c:\Rtools\mingw_64\bin; at the end.

Hi bgoodri,

I did follow your suggestions. Now

Sys.getenv(“PATH”)
[1] “C:\Program Files\R\R-3.4.1\bin\x64;c:\Rtools\bin;c:\Rtools\mingw_64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;”

system(‘g++ -v’)
Using built-in specs.
COLLECT_GCC=c:\Rtools\mingw_64\bin\G__~1.EXE
COLLECT_LTO_WRAPPER=c:/Rtools/mingw_64/bin/…/libexec/gcc/x86_64-w64-mingw32/4.9.3/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: …/…/…/src/gcc-4.9.3/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/home/Jeroen/mingw-gcc-4.9.3/x86_64-493-posix-seh-rt_v3-s/mingw64 --with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-static --disable-shared --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --with-m…
Thread model: posix
gcc version 4.9.3 (x86_64-posix-seh, Built by MinGW-W64 project)

But I still get the same error message
fatal error: stan/model/model_header.hpp: No such file or directory
#include <stan/model/model_header.hpp>

I found an old post here Redirecting to Google Groups
I almost have exact issue but in that post there is no solution in the end.

Finally, problem solved. To anyone who may experience this issue in the future,

  1. Follow the procedures in stan installation page, and be consistent (I made mistake before as pointed by bgoodri)
  2. If you are forced by the ICT department to install R packages into the network drive. Find a way NOT to do so and install everything in your local drive.
1 Like