How to update a package that has StanHeaders and rstan in its LinkingTo

I also just spotted that trialr is failing to build on Solaris. The problem there is:

inline bool size_zero(T& x, Ts&&... xs) {
         ^

The entire build thread is available at:

https://www.r-project.org/nosvn/R.check/r-patched-solaris-x86/trialr-00check.html

Am I right in thinking this is out of my control?

Should I proceed with CRAN submission despite the Solaris problem and risk receiving one of Brian’s motivational missives?

Kristian

Travis can be made viable for some people

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.

Hi,

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
  1. I followed instructions from the first post, and my Makevars and Makevars.win contain
    CXX_STD = CXX14
  2. My path contains c:\Rtools\bin;C:\Rtools\mingw_64\bin
    So, no 32-bit code.
  3. I have created environment variables
    BINPREF=C:\Rtools\mingw_64\bin
    R_MAKEVARS_USER=C:\Users\slawek\Documents.R\Makevars
  4. I followed https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows#configuration, my C:\Users\slawek\Documents.R\Makevars is as follows
    CXX14FLAGS=-O3 -Wno-unused-variable -Wno-unused-function
    CXX14 = (BINPREF)g++ -m(WIN) -std=c++1y
    CXX11FLAGS=-O3 -Wno-unused-variable -Wno-unused-function

So, what else can I do?
Regards,
Slawek

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.

Hi,

Please find below link to our repo:

Thank you!
Slawek

This is building and running for me when I clone it on Linux. In your above post,

that might be a mistake or just a typo. It should be
C:\Users\slawek\Documents\.R\Makevars

Also, what is

pkgbuild::has_build_tools(debug = TRUE)

?

Hi,

  1. Yes, it does work on Linux, but I am trying to build under Windows.
  2. Yes, C:\Users\slawek\Documents.R\Makevars is a typo, the correct one is C:\Users\slawek\Documents.R\Makevars
  3. Where did you find
    pkgbuild::has_build_tools(debug = TRUE) ?

Regards,
Slawek

Hi,
Actually, it was not typo, it is just how the correct string, with slash before dot, is displayed (or rather not displayed :-))

Regards,
Slawek

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:

library(pkgbuild)
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.4.0.1964
Found compatible gcc from R CMD config CC
[1] TRUE

Regards,
Slawek

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

Regards,
Slawek

OK. That is weird, but I would still try with Rtools 3.5.

OK, thanks, I will try.

Slawek

HI,
I tried: installed Rtools35 into c:\rtools, then followed
Home · stan-dev/rstan Wiki · GitHub,
reinstalled for good measure pkgbuild:

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++.

Regards,
Slawek

What does your ~/.R/Makevars file have in it now?

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

Regards,
Slawek

And what is Sys.getenv("BINPREF")?

Hi,

Sys.getenv(“BINPREF”)
[1] “C:\\Rtools\\mingw_64\\bin\\”

At the operating sys level, there are single slashes.

Regards,
Slawek