RcppCore / RcppEigen

Rcpp integration for the Eigen templated linear algebra library
Other
110 stars 40 forks source link

no member named 'Rlog1p' in namespace 'std' #122

Closed gangcai closed 1 year ago

gangcai commented 1 year ago
../inst/include/Eigen/src/Core/MathFunctions.h:487:16: error: no member named 'Rlog1p' in namespace 'std'; did you mean 'log1p'?
    using std::log1p;
          ~~~~~^~~~~
               log1p
gangcai commented 1 year ago

More information about the environment: Apple M1 Max, R 4.2.2 installed through conda

eddelbuettel commented 1 year ago

Note the leading R. Why were you expecting this is in the std:: namespace? (Oh I see now that you quoted the compiler error message -- line wrapping hit most of it).

Can you provide a complete example of what you tried to do? It is not clear right now what any of this has to do with the RcppEigen package. We never call, reference, or provide Rlog1p:

~/git/rcppeigen(master)$ ag Rlog1p       # ag is from https://github.com/ggreer/the_silver_searcher
~/git/rcppeigen(master)$                  
gangcai commented 1 year ago

The error occurs when installing this package:

> install.packages("RcppEigen")
trying URL 'https://cran.rstudio.com/src/contrib/RcppEigen_0.3.3.9.3.tar.gz'
Content type 'application/x-gzip' length 1470790 bytes (1.4 MB)
==================================================
downloaded 1.4 MB

* installing *source* package ‘RcppEigen’ ...
** package ‘RcppEigen’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
arm64-apple-darwin20.0.0-clang++ -std=gnu++14 -I"/Users/gangcai/miniconda3/envs/seurat_V5/lib/R/include" -DNDEBUG  -I'/Users/gangcai/miniconda3/envs/Seurat_V5/lib/R/library/Rcpp/include' -D_FORTIFY_SOURCE=2 -isystem /Users/gangcai/miniconda3/envs/seurat_V5/include -mmacosx-version-min=11.0 -I/Users/gangcai/miniconda3/envs/seurat_V5/include  -I../inst/include -fPIC  -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /Users/gangcai/miniconda3/envs/seurat_V5/include -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/r-base-split_1671440540120/work=/usr/local/src/conda/r-base-4.2.2 -fdebug-prefix-map=/Users/gangcai/miniconda3/envs/seurat_V5=/usr/local/src/conda-prefix  -c RcppEigen.cpp -o RcppEigen.o
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:1:
In file included from ../inst/include/Eigen/Core:374:
../inst/include/Eigen/src/Core/MathFunctions.h:487:16: error: no member named 'Rlog1p' in namespace 'std'; did you mean 'log1p'?
    using std::log1p;
          ~~~~~^~~~~
               log1p
/Users/gangcai/miniconda3/envs/seurat_V5/lib/R/include/Rmath.h:73:15: note: expanded from macro 'log1p'
#define log1p Rlog1p
              ^
/Users/gangcai/miniconda3/envs/seurat_V5/bin/../include/c++/v1/cmath:448:9: note: 'log1p' declared here
using ::log1p _LIBCPP_USING_IF_EXISTS;
        ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:1:
In file included from ../inst/include/Eigen/Core:540:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:2:
In file included from ../inst/include/Eigen/LU:47:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:3:
In file included from ../inst/include/Eigen/Cholesky:12:
In file included from ../inst/include/Eigen/Jacobi:29:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:3:
In file included from ../inst/include/Eigen/Cholesky:43:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:4:
In file included from ../inst/include/Eigen/QR:15:
In file included from ../inst/include/Eigen/Householder:27:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:4:
In file included from ../inst/include/Eigen/QR:48:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:5:
In file included from ../inst/include/Eigen/SVD:48:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:6:
In file included from ../inst/include/Eigen/Geometry:58:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:7:
In file included from ../inst/include/Eigen/Eigenvalues:58:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:26:
In file included from ../inst/include/Eigen/SparseCore:66:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:27:
In file included from ../inst/include/Eigen/OrderingMethods:71:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:29:
In file included from ../inst/include/Eigen/SparseCholesky:43:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:32:
In file included from ../inst/include/Eigen/SparseQR:34:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:33:
In file included from ../inst/include/Eigen/IterativeLinearSolvers:46:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:32:
In file included from ../inst/include/Eigen/CholmodSupport:45:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:35:
In file included from ../inst/include/unsupported/Eigen/KroneckerProduct:34:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:39:
In file included from ../inst/include/unsupported/Eigen/Polynomials:135:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:40:
In file included from ../inst/include/unsupported/Eigen/SparseExtra:51:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:14:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
18 warnings and 1 error generated.
make: *** [/Users/gangcai/miniconda3/envs/seurat_V5/lib/R/etc/Makeconf:178: RcppEigen.o] Error 1
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/Users/gangcai/miniconda3/envs/Seurat_V5/lib/R/library/RcppEigen’
* restoring previous ‘/Users/gangcai/miniconda3/envs/Seurat_V5/lib/R/library/RcppEigen’
Warning in install.packages :
  installation of package ‘RcppEigen’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/y5/bgmbpw2n2v521ymqw323ntbw0000gn/T/RtmpzftLm7/downloaded_packages’
eddelbuettel commented 1 year ago

Hm, why do you have -I/Users/gangcai/miniconda3/envs/seurat_V5/include and who added that?

Can you get a Conda binary for your platform?

Otherwise, this is between you and Conda and you may have rely on Conda experts -- I do not use it, neither does CRAN, and RcppEigen compiles just fine there as it has for a decade:

image

The package is also fairly stable, has not changed recently, and built with many compilers.

gangcai commented 1 year ago

The R was installed under conda environment named "seurat_V5".

eddelbuettel commented 1 year ago

Got it. In any event, this seems more like an issue with your environment. First, maybe try to simplify and remove the (large and impressive) Seurat package from the equation.

So try to install just RcppEigen (and Rcpp and Matrix) in another Conda env. Let us know how that goes. The error may be spillover. Sometimes the include order of header files matters.

gangcai commented 1 year ago

Here is the sessionInfo(), seurat package was not installed yet.

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20.0.0 (64-bit)
Running under: macOS Ventura 13.1

Matrix products: default
LAPACK: /Users/gangcai/miniconda3/envs/Seurat_V5/lib/R/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.2.2 tools_4.2.2   
eddelbuettel commented 1 year ago

Also per the last comment: Anaconda has no issue with RcppEigen, see https://anaconda.org/conda-forge/r-rcppeigen (though it seems they are not current: 0.3.3.9.1 is two behind CRAN).

gangcai commented 1 year ago

Thanks for reminding to install directly from conda, it seems that it works.

(seurat_V5) gangcai@GangcaiMacPro ~ % conda install -c conda-forge r-rcppeigen
Collecting package metadata (current_repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
  current version: 22.11.1
  latest version: 23.3.1

Please update conda by running

    $ conda update -n base -c defaults conda

Or to minimize the number of packages updated during conda update use

     conda install conda=23.3.1

## Package Plan ##

  environment location: /Users/gangcai/miniconda3/envs/seurat_V5

  added / updated specs:
    - r-rcppeigen

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    r-lattice-0.21_8           |    r42h5d63f41_0         1.3 MB  conda-forge
    r-matrix-1.5_4             |    r42hb228a35_0         3.7 MB  conda-forge
    r-rcpp-1.0.10              |    r42h9a38a31_0         1.9 MB  conda-forge
    r-rcppeigen-0.3.3.9.3      |    r42h55306a0_0         1.3 MB  conda-forge
    ------------------------------------------------------------
                                           Total:         8.2 MB

The following NEW packages will be INSTALLED:

  r-lattice          conda-forge/osx-arm64::r-lattice-0.21_8-r42h5d63f41_0 
  r-matrix           conda-forge/osx-arm64::r-matrix-1.5_4-r42hb228a35_0 
  r-rcpp             conda-forge/osx-arm64::r-rcpp-1.0.10-r42h9a38a31_0 
  r-rcppeigen        conda-forge/osx-arm64::r-rcppeigen-0.3.3.9.3-r42h55306a0_0 

Proceed ([y]/n)? y

Downloading and Extracting Packages

Preparing transaction: done                                                                                         
Verifying transaction: done                                                                                         
Executing transaction: done                                                                                         
(seurat_V5) gangcai@GangcaiMacPro ~ % R

R version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20.0.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RcppEigen)
> 
eddelbuettel commented 1 year ago

Awesome.

I am not too familiar with the feedstock recipes and all that but in case you are maybe you can check if 0.3.3.9.3 would work with their instructions too? The repo is here: https://github.com/conda-forge/r-rcppeigen-feedstock

Can you maybe get in touch? And ok if we close this here as there seems to be no issue with RcppEigen per se.

gangcai commented 1 year ago

Sure