On 21 March 2012 at 20:46, Ariful Azad wrote: | Hi, | | I created a package using Rcpp (using Rcpp.package.skeleton()). | Now I need to access a piece of R code from the cpp code in the package. | I am trying to use RInside.
Then you do /not/ start with the package skeleton generator, which is for use with _packages loaded into R_. RInside extends standalone C++ program with their own main() function. If what you want is to call back into R from a loadable package, do not look at RInside but rather look at the examples/ directory of Rcpp, particularly callbackFunctions/ which has a working example. | I am using Mac 64 bit machine. I can't speak to that, but folks have used Rcpp and RInside merrily on OS X in both 32 and 64 bit. Then again, maybe you don;t even want RInside. | When I installed RInside I found the shared libraries in two places | 1. /Library/Frameworks/R. | framework/Versions/2.14/Resources/library/RInside/lib | and in | 2. /Library/Frameworks/R.framework/Versions/2.14/Resources/library/RInside/libs | | in the first directory I have one subfolder named i386 that contains two files | libRInside.a libRInside.dylib | | but in the second directory I have three subfolders namely , | a) i386 with files libRInside.a libRInside.dylib | b) x86_64 with files RInside.so RInside.so.dSYM | c)ppc with files RInside.so RInside.so.dSYM | | | In my DESCRIPTION file I addedd | LinkingTo: Rcpp, RInside No, that is not how it used. You misunderstand. Look at the Rcpp examples. Dirk | In my MakeVars I added | PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` `$(R_HOME)/bin/Rscript | -e "RInside:::LdFlags()"` | | Now when I install the package using R CMD install , it installs both 32 bit | and 64 bit version. | However, I am getting error for the 64 bit version , probably because | RInside.so is not for mac ? (Please see below the outputs). | | By the way how can I modify architecture specific compile option in Makevars | file for (for example I want to pass different libraries to different versions | directed fro 32 or 64 bit architectures ) ? Normall R takes care of that. | | Output from R CMD install pkg | ---------------------------- | | * installing to library ‘/Library/Frameworks/R.framework/Versions/2.14/ | Resources/library’ | * installing *source* package ‘flowMatch’ ... | ** libs | *** arch - i386 | g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/ | Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -I"/ | Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" | -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RInside/ | include" -fPIC -g -O2 -c BipartiteGraph.cpp -o BipartiteGraph.o | BipartiteGraph.cpp:28: warning: division by zero in ‘1.0e+0 / 0.’ | g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/ | Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -I"/ | Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" | -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RInside/ | include" -fPIC -g -O2 -c MinWghtEdgCoverBipartite.cpp -o | MinWghtEdgCoverBipartite.o | g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/ | Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -I"/ | Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" | -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RInside/ | include" -fPIC -g -O2 -c rcpp_hello_world.cpp -o rcpp_hello_world.o | g++ -arch i386 -dynamiclib -Wl,-headerpad_max_install_names -undefined | dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o | flowMatch.so BipartiteGraph.o MinWghtEdgCoverBipartite.o rcpp_hello_world.o / | Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/lib/i386/ | libRcpp.a /Library/Frameworks/R.framework/Versions/2.14/Resources/library/ | RInside/lib/i386/libRInside.a -F/Library/Frameworks/R.framework/.. -framework R | -Wl,-framework -Wl,CoreFoundation | installing to /Library/Frameworks/R.framework/Versions/2.14/Resources/library/ | flowMatch/libs/i386 | *** arch - x86_64 | g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library | /Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include -I"/ | Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" | -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RInside/ | include" -fPIC -g -O2 -c BipartiteGraph.cpp -o BipartiteGraph.o | BipartiteGraph.cpp:28: warning: division by zero in ‘1.0e+0 / 0.’ | g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library | /Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include -I"/ | Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" | -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RInside/ | include" -fPIC -g -O2 -c MinWghtEdgCoverBipartite.cpp -o | MinWghtEdgCoverBipartite.o | g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library | /Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include -I"/ | Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" | -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RInside/ | include" -fPIC -g -O2 -c rcpp_hello_world.cpp -o rcpp_hello_world.o | g++ -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined | dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o | flowMatch.so BipartiteGraph.o MinWghtEdgCoverBipartite.o rcpp_hello_world.o / | Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/lib/x86_64/ | libRcpp.a /libRInside.a -F/Library/Frameworks/R.framework/.. -framework R | -Wl,-framework -Wl,CoreFoundation | i686-apple-darwin11-llvm-g++-4.2: /libRInside.a: No such file or directory | make: *** [flowMatch.so] Error 1 | ERROR: compilation failed for package ‘flowMatch’ | | | ------------- | | | thanks | | -- Ariful | | ---------------------------------------------------------------------- | _______________________________________________ | Rcpp-devel mailing list | [email protected] | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel -- "Outside of a dog, a book is a man's best friend. Inside of a dog, it is too dark to read." -- Groucho Marx _______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
