Solomon Messing
2011-Mar-15 06:26 UTC
[R] How to make sure R's g++ compiler uses certain C++ flags when making a package
I am trying to use some code from opencv in an r package, using Rcpp to build the package. When I compile the c code on my machine, it works fine. However, when I try to include it in my package, it gives me a bunch of error messages like: "error: opencv2/core/operations.hpp: No such file or directory" Does anyone know how to get R to compile the C code as my command line g++ compiler does? For example, I am using the the following syntax to compile the facedetect.cpp code: g++ -bind_at_load `pkg-config --cflags opencv` facedetect.cpp -o facedetect `pkg-config --libs opencv` The key are the flags that point the compiler to the opencv package. How can I get R to use those same flags when it compiles the C code? Unfortunately I could not find the answer via google or the Writing R Extensions manual. My apologies if I missed something obvious. Thank you -Solomon [[alternative HTML version deleted]]
solomon.messing at gmail.com
2011-Mar-16 20:50 UTC
[R] How to make sure R's g++ compiler uses certain C++ flags when making a package
Looks like the problem may be that R is automatically passing this flag to the g++ compiler: "-arch x86_64" which appears to be causing trouble for opencv. Does anyone know how to suppress this flag? -- View this message in context: http://r.789695.n4.nabble.com/How-to-make-sure-R-s-g-compiler-uses-certain-C-flags-when-making-a-package-tp3355924p3382992.html Sent from the R help mailing list archive at Nabble.com.