xtensor-stack / Xtensor.R

R package for xtensor-r
http://quantstack.net/xtensor
Other
17 stars 7 forks source link

CRAN package installation failure #21

Closed DavisVaughan closed 5 years ago

DavisVaughan commented 5 years ago

I've tried to install both the dev and CRAN versions of xtensor on a cloud based Linux machine we have that runs RStudio. It has gcc 4.9.2 so I thought all would be well, but I get this message when trying to install. Any ideas? Googling doesn't get me much besides this:

https://stackoverflow.com/questions/11302981/c11-declaring-non-static-data-members-as-auto

g++  -I"/opt/R/3.6.0/lib64/R/include" -DNDEBUG  -I"/home/davis/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I/usr/local/include -I../inst/include --std=c++14 -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
In file included from ../inst/include/xtensor/xaccumulator.hpp:17:0,
                 from ../inst/include/xtensor/xmath.hpp:25,
                 from ../inst/include/xtensor/xcontainer.hpp:23,
                 from ../inst/include/xtensor-r/rcontainer.hpp:17,
                 from ../inst/include/xtensor.h:1,
                 from RcppExports.cpp:4:
../inst/include/xtensor/xexpression.hpp:76:53: error: non-static data member declared ‘auto’
         friend auto make_xshared<D>(xexpression<D>&&);
                                                     ^
SylvainCorlay commented 5 years ago

That looks like a compiler bug to me since make_xshared is not a data member.

I wonder if there is a parsing error and if it is considered a member at this point of the compilation. Can you try disambiguating it with an inline statement?

DavisVaughan commented 5 years ago

so you want me to do friend inline auto make_xshared<D>(xexpression<D>&&);?

SylvainCorlay commented 5 years ago

yep.

DavisVaughan commented 5 years ago
g++ -std=c++14 -I"/opt/R/3.6.0/lib64/R/include" -DNDEBUG  -I"/home/davis/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I/usr/local/include -I../inst/include    -c RcppExports.cpp -o RcppExports.o
In file included from ../inst/include/xtensor/xaccumulator.hpp:17:0,
                 from ../inst/include/xtensor/xmath.hpp:25,
                 from ../inst/include/xtensor/xcontainer.hpp:23,
                 from ../inst/include/xtensor-r/rcontainer.hpp:17,
                 from ../inst/include/xtensor.h:1,
                 from RcppExports.cpp:4:
../inst/include/xtensor/xexpression.hpp:76:60: error: non-static data member declared ‘auto’
         friend inline auto make_xshared<D>(xexpression<D>&&);
                                                            ^

same issue

SylvainCorlay commented 5 years ago

and replacing auto with xshared_expression<E>?

DavisVaughan commented 5 years ago

D? I assume, not E?

SylvainCorlay commented 5 years ago

yep

DavisVaughan commented 5 years ago

This worked, I was able to compile the xtensor R package and rray https://github.com/QuantStack/xtensor/compare/master...DavisVaughan:inline-xshared

SylvainCorlay commented 5 years ago

Great! So even though it is clearly a compiler bug, I think it is worth adding the return type in xtensor.