0
votes

I am trying to get the eigenvalues with Rcpparmadillo as in this example: [http://gallery.rcpp.org/articles/armadillo-eigenvalues]

When I made it through the cppFunction it’s work fine. However, when I made a .cpp file and try to incorporate it in my package I have the following error during the compilation process:

C:/Users/Administrator/Documents/R/win-library/3.4/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:474:96: note: #pragma message: WARNING: use of OpenMP disabled; this compiler doesn't support OpenMP 3.0+ #pragma message ("WARNING: use of OpenMP disabled; this compiler doesn't support OpenMP 3.0+") ^ C:/RBuildTools/3.4/mingw_64/bin/g++ -shared -s -static-libgcc -o test.dll tmp.def RcppExports.o binarize_matrix.o char_uniqueC.o colSumsBinaryC.o colSumsC.o df_to_gbi1.o df_to_gbi_focal.o dimC.o edgelist_to_matrix.o ei.o empty_gbi.o equal_0.o extract_charcterVector_elements.o extract_col.o extract_numericVector_elements.o extract_row.o extract_value_from_id.o filtering_matrix.o find_col.o find_matrix_zero.o find_row.o get_association_matrix.o intersectC.o is_squareC.o lapplyC.o levelsC.o matchC.o perm_for_data_stream1C.o perm_for_data_stream_Control_factor.o randomization_vetor.o rcpp_hello.o rcpp_hello_world.o reachC.o reachC2.o rowSumsBinaryC.o rowSumsC.o strengthC.o strengthSymC.o sumC.o sup_0.o unmatchC.o vector_multiplication.o -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-34~1.1/bin/x64 -lR ei.o:ei.cpp:(.text$_ZN4arma6auxlib7eig_symIdNS_3MatIdEEEEbRNS_3ColIT_EERKNS_4BaseIS5_T0_EE[_ZN4arma6auxlib7eig_symIdNS_3MatIdEEEEbRNS_3ColIT_EERKNS_4BaseIS5_T0_EE]+0x5fa): undefined reference to `dsyev_' collect2.exe: error: ld returned 1 exit status no DLL was created

Edit 1 I am using the same code as the one on the url:

#include <RcppArmadillo.h>

// [[Rcpp::depends(RcppArmadillo)]]

// [[Rcpp::export]]
arma::vec ei(arma::mat M) {
return arma::eig_sym(M);
}

I am on windows 10, Rstudio and R-3.4.1, RcppArmadillo 0.7.960.1.2, Rcpp 0.12.12

Edit2

Sorry. The error appear only when I add this function. This seem to be the error:

ei.o:ei.cpp:(.text$_ZN4arma6auxlib7eig_symIdNS_3MatIdEEEEbRNS_3ColIT_EERKNS_4BaseIS5_T0_EE[_ZN4arma6auxlib7eig_symIdNS_3MatIdEEEEbRNS_3ColIT_EERKNS_4BaseIS5_T0_EE]+0x5fa): undefined reference to `dsyev_' collect2.exe: error: ld returned 1 exit status no DLL was created ERROR: compilation failed for package 'test'

It seems to be related to the compiler, as before that I have this:

C:/Users/Administrator/Documents/R/win-library/3.4/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:474:96: note: #pragma message: WARNING: use of OpenMP disabled; this compiler doesn't support OpenMP 3.0+ #pragma message ("WARNING: use of OpenMP disabled; this compiler doesn't support OpenMP 3.0+")

Could someone help me please?

Thanks in advance for your help

1
Not reproducible, incomplete, poorly formatted, Make it easier for us to help you. – Dirk Eddelbuettel
Hi Dirk Eddelbuettel, I updated my post, I am ready to give extra detail if require. – Bas
Come on now---the error message lists dozen of files, yet you talk about notbeing able to replicate the Gallery post. These are not the same thing so don't pretend they are. And your error message is still unreadable. Don't use markdown quote on it. – Dirk Eddelbuettel

1 Answers

0
votes

You seem to misunderstand something. When R source such a file via Rcpp, it links to the LAPACK / BLAS libraries it uses so that error can only arise if you (wrongly) assume to build a main() program or something.

Here is a shorter but fully equivalent version of the code, shown as compiled, linked, loaded and executed in four lines of an R session:

> library(Rcpp)     # load Rcpp just in case
> cppFunction("arma::vec ei(arma::mat M) { return arma::eig_sym(M); }", 
+              depends="RcppArmadillo")      # linebreak for exposition
> ei(matrix(c(2.0, 0, 0, 1.0), 2, 2))
     [,1]
[1,]    1
[2,]    2
> 

Please try those four lines, and only those four lines. Methinks you have a different problem.