[Rcpp-devel] Compilation and Build Error with R CMD SHLIB and R CMD check
Dirk Eddelbuettel
edd at debian.org
Thu Jan 19 20:31:52 CET 2012
Jared,
Welcome to the list.
On 19 January 2012 at 13:54, Jared Lander wrote:
| After checking the archives of this mail list I have still not found my
| problem, but please excuse me if I am repeating anything already solved.
|
|
|
| I can use R CMD SHLIB to compile files such as those in the Rcpp master class
| examples part1 up to and including modEx2.cpp. But I am unable to compile
| other files such as those created by Rcpp.package.skeleton("mypackage").
You do understand that Rcpp.package.skeleton() output is meant to be used as
a /package/ so you should think in terms of R CMD INSTALL.
Also, Rcpp is used by 50+ packages on CRAN. You can always look at some of
those in terms of setup and tricks.
Lastly, the very question 'how do I use "R CMD SHLIB"' has its own entry in
the Rcpp-FAQ vignette.
|
| Running "R CMD SHLIB rcpp_hello_world.cpp" results in the error below (sorry
| for the long message):
|
| x86_64-w64-mingw32-g++ -I"c:/Users/Jared/Documents/R/R-2.14.1/include" -IC:/
| Users/Jared/Documents/R/win-library/2.14/Rc
| pp/include -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2
| -Wall -mtune=core2 -c rcpp_hello_world.cpp -o r
| cpp_hello_world.o
| "The filename, directory name, or volume label syntax is incorrect."
Never seen this "The filename, directory name, or volume label syntax is incorrect."
Where does it come from?
| The filename, directory name, or volume label syntax is incorrect.
| The filename, directory name, or volume label syntax is incorrect.
| The filename, directory name, or volume label syntax is incorrect.
| The filename, directory name, or volume label syntax is incorrect.
| The filename, directory name, or volume label syntax is incorrect.
| x86_64-w64-mingw32-g++ -shared -s -static-libgcc -o rcpp_hello_world.dll
| tmp.def rcpp_hello_world.o -Ld:/RCompile/CRANpk
| g/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -Lc:/
| Users/Jared/Documents/R/R-2.14.1/bin/x64 -l
| R
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0xd7): undefined reference to
| `Rcpp::RObject::setSEXP(SEXPREC*)'
The linker tells you it doesn't find the Rcpp library.
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0xe4): undefined reference to
| `void Rcpp::internal::r_init_vector<16>(SEX
| PREC*)'
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x23e): undefined reference to
| `Rcpp::RObject::setSEXP(SEXPREC*)'
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x2bc): undefined reference to
| `Rcpp::RObject::setSEXP(SEXPREC*)'
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x2c9): undefined reference to
| `void Rcpp::internal::r_init_vector<19>(SE
| XPREC*)'
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x33d): undefined reference to
| `Rcpp::RObject::~RObject()'
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x361): undefined reference to
| `Rcpp::RObject::~RObject()'
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x385): undefined reference to
| `Rcpp::RObject::~RObject()'
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x44f): undefined reference to
| `Rcpp::RObject::~RObject()'
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x47d): undefined reference to
| `Rcpp::RObject::~RObject()'
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x4ab): more undefined
| references to `Rcpp::RObject::~RObject()' follow
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text$_ZN4Rcpp6VectorILi14EE6updateEv
| [Rcpp::Vector<14>::update()]+0xd): undefin
| ed reference to `double* Rcpp::internal::r_vector_start<14, double>(SEXPREC*)'
| rcpp_hello_world.o:rcpp_hello_world.cpp:
| (.text$_ZN4Rcpp8internal13r_init_vectorILi14EEEvP7SEXPREC[void
| Rcpp::internal::r
| _init_vector<14>(SEXPREC*)]+0xa): undefined reference to `double*
| Rcpp::internal::r_vector_start<14, double>(SEXPREC*)'
| collect2: ld returned 1 exit status
|
|
|
| Similarly, running R CMD check mypackage yields the following error file:
|
| * installing *source* package 'mypackage' ...
| ** libs
|
| *** arch - i386
| g++ -shared -s -static-libgcc -o mypackage.dll tmp.def rcpp_hello_world.o -Ld:/
| RCompile/CRANpkg/extralibs/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs/local
| /lib C:/Users/Jared/Documents/R/win-library/2.14/Rcpp/lib/i386/libRcpp.a -Lc:/
| Users/Jared/DOCUME~1/R/R-214~1.1/bin/i386 -lR
| c:/rtools/gcc-4.5.4/bin64/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../
| x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/Users/Jared/DOCUME~1/R/
| R-214~1.1/bin/i386/R.dll when searching for -lR
| c:/rtools/gcc-4.5.4/bin64/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../
| x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/Users/Jared/DOCUME~1/R/
| R-214~1.1/bin/i386/R.dll when searching for -lR
| c:/rtools/gcc-4.5.4/bin64/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../
| x86_64-w64-mingw32/bin/ld.exe: cannot find -lR
| collect2: ld returned 1 exit status
| ERROR: compilation failed for package 'mypackage'
| * removing 'c:/Users/Jared/mypackage.Rcheck/mypackage'
|
|
| I am running Windows 7, R 2.14.1, with RTools and gcc-4.5.4, with all the
| apropriate programs in the path.
Just a few weeks ago, I re-setup all that on two Windows computers. It does
work for me, CRAN, win-builder and a number of users.
The first test always is 'R CMD INSTALL somePackage_1.2-3.tar.gz'. You could
try with RcpoArmadillo or something even smaller.
You can also create a source archive and submit it to win-builder yourself to
check whether it is your sources, or your compiler setup. See
http://win-builder.r-project.org for more.
Dirk
| Thank you for any insight you can provide.
|
| Jared
|
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| 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
More information about the Rcpp-devel
mailing list