If you have CXX_STD=CXX14 in src/Makevars then you will get different errors on Solaris pertaining to numerical integration routines in Boost that no one is even using yet, which is a Boost bug ( https://github.com/boostorg/math/issues/134 ) that I worked around but CRAN won’t accept.
I have problems building rstan-dependent package after upgrading to StanHeaders 2.18 and rstan 2.18.1 on Windows 10 (rtools 3.4.0.1964)
When building my package:
Re-compiling Rlgt
Running “C:/R/R-3.4.4/bin/x64/Rcmd.exe” INSTALL “E:/progs/rlgt/Rlgt”
“–library=C:\Users\slawek\AppData\Local\Temp\RtmpErzXzL\devtools_install_2f4825b13d1c”
–no-R --no-data --no-help --no-demo --no-inst --no-docs --no-exec
–no-multiarch --no-test-load --preclean
installing source package ‘Rlgt’ …
** libs
Error in .shlib_internal(args) :
C++14 standard requested but CXX14 is not defined
I followed instructions from the first post, and my Makevars and Makevars.win contain
CXX_STD = CXX14
My path contains c:\Rtools\bin;C:\Rtools\mingw_64\bin
So, no 32-bit code.
I have created environment variables
BINPREF=C:\Rtools\mingw_64\bin
R_MAKEVARS_USER=C:\Users\slawek\Documents.R\Makevars
Do you have a link to your package’s repository? It looks as if you followed the right procedure, but the conscious uncoupling of the devtools package presents an additional complication in practice.
What do you mean where did I find pkgbuild::has_build_tools(debug = TRUE) ? The pkgbuild package is imported by rstan so you should have it on your Windows machine. If not, just do install.packages("pkgbuild"). Either way, what is the output of that command?
Hi,
Thank you very much for your help. I misunderstood you, I thought that you found pkgbuild::has_build_tools(debug = TRUE)
somewhere in the package files and are puzzled what it is for :-)
OK, so executing:
Scanning R CMD config CC…
cc_path: c:/Rtools/mingw_64/bin/gcc
install_path: c:/Rtools
VERSION.txt
Rtools version 3.4.0.1964
Found compatible gcc from R CMD config CC
[1] TRUE
OK. That is helpful. It says it found a Rtools 3.4 . I don’t know what the problem is but Rtools 3.5 seems to work for more people than 3.4 does, although my 3.4 was working when no one else’s was. So, I would say to try uninstalling Rtools 3.4 and then take it from the top with https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows#toolchain
Hi,
I am not sure if this is important, but executing
pkgbuild::has_build_tools(debug = TRUE)
without calling before
library(pkgbuild)
causes a bit different result:
Scanning R CMD config CC…
cc_path: C:Rtoolsmingw_64bingcc
‘C:Rtoolsmingw_64bingcc.exe’ does not exist
Scanning path…
ls: c:\Rtools\bin\ls.exe
gcc_path: C:\Rtools\mingw_64\bin\gcc.exe
VERSION.txt
Rtools version 3.4.0.1964
Version: 3.4
Found compatible gcc on path
pkgbuild::has_build_tools(debug = TRUE)
Scanning R CMD config CC…
cc_path: C:\Rtools\mingw_64\bin\gcc
install_path: C:/Rtools
VERSION.txt
Rtools version 3.5.0.4
Found compatible gcc from R CMD config CC
[1] TRUE
But I have failure at the next step:
fx ← inline::cxxfunction( signature(x = “integer”, y = “numeric” ) , ’
return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
’ )
sh: C:Rtoolsmingw_64bing++: command not found
make: *** [C:/R/R-34~1.4/etc/x64/Makeconf:215: file49681234cb2.o] Error 127
Warning message:
running command ‘make -f “C:/R/R-34~1.4/etc/x64/Makeconf” -f “C:/R/R-34~1.4/share/make/winshlib.mk” -f “C:\Users\slawek\Documents.R\Makevars” SHLIB_LDFLAGS=’(SHLIB_CXXLDFLAGS)' SHLIB_LD='(SHLIB_CXXLD)’ SHLIB=“file49681234cb2.dll” WIN=64 TCLBIN=64 OBJECTS=“file49681234cb2.o”’ had status 2
ERROR(s) during compilation: source code errors or compiler configuration errors!
Program source:
1:
2: // includes from the plugin
3: #include <R.h>
4: #include <Rdefines.h>
5: #include <R_ext/Error.h>
6:
7:
8: // user includes
9:
10:
11: // declarations
12: extern “C” {
13: SEXP file49681234cb2( SEXP x, SEXP y) ;
14: }
15:
16: // definition
17:
18: SEXP file49681234cb2( SEXP x, SEXP y ){
19:
20: return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
21:
22: Rf_warning(“your C++ program does not return anything”);
23: return R_NilValue ;
24: }
25:
26:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! sh: C:Rtoolsmingw_64bing++: command not found
make: *** [C:/R/R-34~1.4/etc/x64/Makeconf:215: file49681234cb2.o] Error 127
Warning message:
running command ‘make -f “C:/R/R-34~1.4/etc/x64/Makeconf” -f “C:/R/R-34~1.4/share/make/winshlib.mk” -f “C:\Users\slawek\Documents.R\Makevars” SHLIB_LDFLAGS=’(SHLIB_CXXLDFLAGS)' SHLIB_LD='(SHLIB_CXXLD)’ SHLIB=“file49681234cb2.dll” WIN=64 TCLBIN=64 OBJECTS=“file49681234cb2.o”’ had status 2
In addition: Warning message:
running command ‘C:/R/R-3.4.4/bin/x64/R CMD SHLIB file49681234cb2.cpp 2> file49681234cb2.cpp.err.txt’ had status 1
There are missing separators in the invocation to g++.
Hi,
Same as before, I did not change it:
CXX14FLAGS=-O3 -Wno-unused-variable -Wno-unused-function
CXX14 = $(BINPREF)g++ -m$(WIN) -std=c++1y
CXX11FLAGS=-O3 -Wno-unused-variable -Wno-unused-function