Compilation ERROR, function(s)/method(s) not created!

907 views
Skip to first unread message

Lu Zhang

unread,
Apr 26, 2017, 2:02:29 AM4/26/17
to stan-...@googlegroups.com
Hi Stan,

   I am trying to install Rstan on my old PC. But I got the following Compilation Error after running a stan code:
888: }
889:
890:
Error in compileCode(f, code, language = language, verbose = verbose) :
 
Compilation ERROR, function(s)/method(s) not created! c:/Rtools/mingw_64/bin/g++: not found
make
: *** [fileb8437281799.o] Error 127

     I searched the error message online, and found the old issue: https://github.com/stan-dev/rstan/issues/307. Then I installed Rtools3.3.* followed the old issue, but it didn't work. The setting in R is listed below:
> Sys.getenv("PATH")
[1] "D:\\Program Files\\Rtools\\bin;D:\\Program Files\\Rtools\\mingw_32\\bin;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;c:\\Program Files (x86)\\Lenovo\\Lenovo Home\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\2.0\\bin\\x86;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\2.0\\bin\\x64;C:\\Program Files (x86)\\Lenovo\\Access Connections\\;C:\\Program Files\\Common Files\\Lenovo;C:\\Program Files\\Lenovo Fingerprint Reader\\;C:\\Program Files\\Lenovo Fingerprint Reader\\x86\\;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;c:\\Program Files (x86)\\Lenovo\\Lenovo Home\\DCMainWin.exe"
> system('g++ -v')
Using built-in specs.
COLLECT_GCC
=D:\PROGRA~1\Rtools\mingw_32\bin\G__~1.EXE
COLLECT_LTO_WRAPPER
=D:/PROGRA~1/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/i686-w64-mingw32-static --with-mpfr=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static --with-mpc=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static --with-isl=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static --with-cloog=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i686-posix-dwarf, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/home/Jeroen/mingw-gcc-4.9.3/i686-493-posix-dwarf-rt_v3-s/mingw32/opt/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-zlib-static/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/home/Jeroen/mingw-gcc-4.9.3/i686-493-posix-dwarf-rt_v3-s/mingw32/opt/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-zlib-static/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/home/Jeroen/mingw-gcc-4.9.3/i686-493-posix-dwarf-rt_v3-s/mingw32/opt/lib -L/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-zlib-static/lib -L/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
Thread model: posix
gcc version
4.9.3 (i686-posix-dwarf, Built by MinGW-W64 project)

My R version is 3.4.0. My Rstan version is 2.15.1. The operating system is Windows 10.

I also tried installing rstan from github, and I did tests in R3.3.2 and R3.3.3, but none of them solve the problem.  Would anyone give me some suggestions?

Thank you very much!

Sincerely,

Lu



 

Ben Goodrich

unread,
Apr 26, 2017, 2:38:23 AM4/26/17
to Stan users mailing list
On Wednesday, April 26, 2017 at 2:02:29 AM UTC-4, Lu Zhang wrote:
Error in compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created! c:/Rtools/mingw_64/bin/g++: not found
make
: *** [fileb8437281799.o] Error 127

You appear to be running 32bit R on a 64bit system. Try executing this once:

cat('Sys.setenv(BINPREF = "C:/Rtools/mingw_32/bin/")',
    file = file.path(Sys.getenv("HOME"), ".Rprofile"), 
    sep = "\n", append = TRUE)

Ben

Lu Zhang

unread,
Apr 26, 2017, 12:34:02 PM4/26/17
to Stan users mailing list
I uninstalled the R and reinstall only 64 bit version of R and Rtools, and installed Rstan from github. and tried your command. Still not work.

Ben Goodrich

unread,
Apr 26, 2017, 1:47:13 PM4/26/17
to Stan users mailing list
On Wednesday, April 26, 2017 at 12:34:02 PM UTC-4, Lu Zhang wrote:
I uninstalled the R and reinstall only 64 bit version of R and Rtools, and installed Rstan from github. and tried your command. Still not work.

That is hopefully because what I posted was for the case of 32 bit R. If you are using 64 bit R, then it would be

cat('Sys.setenv(BINPREF = "C:/Rtools/mingw_64/bin/")',
    
file = file.path(Sys.getenv("HOME"), ".Rprofile"), 
    sep = "\n", append = TRUE)

or whatever directory g++ resides in.

Lu Zhang

unread,
Apr 26, 2017, 2:26:47 PM4/26/17
to stan-...@googlegroups.com
Cool, I will try this evening. 

--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/ayUJzNRR2hw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lu Zhang

unread,
Apr 26, 2017, 9:21:50 PM4/26/17
to Stan users mailing list
Sorry, I still got the same error:
890:
Error in compileCode(f, code, language = language, verbose = verbose) :

 
Compilation ERROR, function(s)/method(s) not created! C:/Rtools/mingw_64/bin/g++: not found
make
: *** [file261042c44b7c.o] Error 127
Warning message:
running command
'make -f "D:/PROGRA~1/R/R-34~1.0/etc/x64/Makeconf" -f "D:/PROGRA~1/R/R-34~1.0/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file261042c44b7c.dll" WIN=64 TCLBIN=64 OBJECTS="file261042c44b7c.o"' had status 2
In addition: Warning message:
running command
'D:/PROGRA~1/R/R-34~1.0/bin/x64/R CMD SHLIB file261042c44b7c.cpp 2> file261042c44b7c.cpp.err.txt' had status 1

Ben Goodrich

unread,
Apr 26, 2017, 10:30:50 PM4/26/17
to Stan users mailing list
Whatever

system('g++ -v')

says, you have to get the BINPREF environment variable pointing to that directory.

Reply all
Reply to author
Forward
0 new messages