[Rcpp-devel] Compilation and Build Error with R CMD SHLIB and R CMD check

Jared Lander info at jaredlander.com
Thu Jan 19 19:54:51 CET 2012


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").



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.
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*)'
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.


Thank you for any insight you can provide.

Jared
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20120119/ea78b89c/attachment.htm>


More information about the Rcpp-devel mailing list