0

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

Sosa
  • 141
  • 9
  • 1
    Not reproducible, incomplete, poorly formatted, Make it easier for us to help you. – Dirk Eddelbuettel Sep 14 '17 at 13:10
  • Hi Dirk Eddelbuettel, I updated my post, I am ready to give extra detail if require. – Sosa Sep 14 '17 at 13:21
  • 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 Sep 14 '17 at 13:22

1 Answers1

1

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.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Of course it does. But does that mean you can just copy this into your own code and completely ignore build instructions? No, it does not. – Dirk Eddelbuettel Sep 14 '17 at 14:09
  • I have the following error: Error in .Primitive(".Call")(, M) : NULL value passed as symbol address – Sosa Sep 14 '17 at 14:24
  • You still refuse to show your code, and your build instructions. You continue to point to known working code, and saying it does not work for you _without giving us the ability to help you_. This will go nowhere. – Dirk Eddelbuettel Sep 14 '17 at 17:53
  • Dear Dirk Eddelbuettel, I am sorry, I am not familiar with compilation errors if they are not related to coding error in the function. I will check by my own and come back when I acquire enough knowledge about compilation processes. I would like to thank you and I am sorry to make you lose your time. – Sosa Sep 15 '17 at 11:57
  • See [this on how to form an effective post](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on StackOverflow. – Dirk Eddelbuettel Sep 15 '17 at 11:59