Replies are inline.<br><br><div class="gmail_quote">On Thu, Jan 19, 2012 at 2:31 PM, Dirk Eddelbuettel <span dir="ltr">&lt;<a href="mailto:edd@debian.org">edd@debian.org</a>&gt;</span> wrote:<br><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
<br>
Jared,<br>
<br>
Welcome to the list.<br>
<div class="im"><br>
On 19 January 2012 at 13:54, Jared Lander wrote:<br>
| After checking the archives of this mail list I have still not found my<br>
| problem, but please excuse me if I am repeating anything already solved.<br>
|<br>
|  <br>
|<br>
| I can use R CMD SHLIB to compile files such as those in the Rcpp master class<br>
| examples part1 up to and including modEx2.cpp.  But I am unable to compile<br>
| other files such as those created by Rcpp.package.skeleton(&quot;mypackage&quot;).<br>
<br>
</div>You do understand that Rcpp.package.skeleton() output is meant to be used as<br>
a /package/ so you should think in terms of R CMD INSTALL.<br>
<br>
Also, Rcpp is used by 50+ packages on CRAN.  You can always look at some of<br>
those in terms of setup and tricks.<br>
<br>
Lastly, the very question &#39;how do I use &quot;R CMD SHLIB&quot;&#39; has its own entry in<br>
the Rcpp-FAQ vignette.<br></blockquote><div><font color="#3366ff">I get that package skeleton is meant for R CMD INSTALL.  But while testing individual files I use R CMD SHLIB, which depending on the directory I am calling it from sometimes works and sometimes doesn&#39;t.  And this isn&#39;t a path issue as I the problem occurs based on how deep in subdirectories I go.</font> </div>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
<div class="im"><br>
|<br>
| Running &quot;R CMD SHLIB rcpp_hello_world.cpp&quot; results in the error below (sorry<br>
| for the long message):<br>
|<br>
| x86_64-w64-mingw32-g++  -I&quot;c:/Users/Jared/Documents/R/R-2.14.1/include&quot; -IC:/<br>
| Users/Jared/Documents/R/win-library/2.14/Rc<br>
| pp/include    -I&quot;d:/RCompile/CRANpkg/extralibs64/local/include&quot;     -O2<br>
| -Wall  -mtune=core2 -c rcpp_hello_world.cpp -o r<br>
| cpp_hello_world.o<br>
| &quot;The filename, directory name, or volume label syntax is incorrect.&quot;<br>
<br>
</div>Never seen this &quot;The filename, directory name, or volume label syntax is incorrect.&quot;<br>
Where does it come from?<br></blockquote><div> <font color="#3366ff">No clue where that is coming from.  That&#39;s the error given when trying to run R CMD SHLIB.</font></div><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">

<div class="im"><br>
| The filename, directory name, or volume label syntax is incorrect.<br>
| The filename, directory name, or volume label syntax is incorrect.<br>
| The filename, directory name, or volume label syntax is incorrect.<br>
| The filename, directory name, or volume label syntax is incorrect.<br>
| The filename, directory name, or volume label syntax is incorrect.<br>
| x86_64-w64-mingw32-g++ -shared -s -static-libgcc -o rcpp_hello_world.dll<br>
| tmp.def rcpp_hello_world.o -Ld:/RCompile/CRANpk<br>
| g/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -Lc:/<br>
| Users/Jared/Documents/R/R-2.14.1/bin/x64 -l<br>
| R<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0xd7): undefined reference to<br>
| `Rcpp::RObject::setSEXP(SEXPREC*)&#39;<br>
<br>
</div>The linker tells you it doesn&#39;t find the Rcpp library.<br></blockquote><div><font color="#3366ff">What could be causing that?  I did export PKG_LIBS=`Rscript -e &quot;RCPP:::LdFlags()&quot;` and export PKG_CXXFLAGS=`Rscript -e &quot;Rcpp:::CxxFlags()&quot;`.</font></div>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
<div><div class="h5"><br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0xe4): undefined reference to<br>
| `void Rcpp::internal::r_init_vector&lt;16&gt;(SEX<br>
| PREC*)&#39;<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x23e): undefined reference to<br>
| `Rcpp::RObject::setSEXP(SEXPREC*)&#39;<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x2bc): undefined reference to<br>
| `Rcpp::RObject::setSEXP(SEXPREC*)&#39;<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x2c9): undefined reference to<br>
| `void Rcpp::internal::r_init_vector&lt;19&gt;(SE<br>
| XPREC*)&#39;<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x33d): undefined reference to<br>
| `Rcpp::RObject::~RObject()&#39;<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x361): undefined reference to<br>
| `Rcpp::RObject::~RObject()&#39;<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x385): undefined reference to<br>
| `Rcpp::RObject::~RObject()&#39;<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x44f): undefined reference to<br>
| `Rcpp::RObject::~RObject()&#39;<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x47d): undefined reference to<br>
| `Rcpp::RObject::~RObject()&#39;<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x4ab): more undefined<br>
| references to `Rcpp::RObject::~RObject()&#39; follow<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:(.text$_ZN4Rcpp6VectorILi14EE6updateEv<br>
| [Rcpp::Vector&lt;14&gt;::update()]+0xd): undefin<br>
| ed reference to `double* Rcpp::internal::r_vector_start&lt;14, double&gt;(SEXPREC*)&#39;<br>
| rcpp_hello_world.o:rcpp_hello_world.cpp:<br>
| (.text$_ZN4Rcpp8internal13r_init_vectorILi14EEEvP7SEXPREC[void<br>
| Rcpp::internal::r<br>
| _init_vector&lt;14&gt;(SEXPREC*)]+0xa): undefined reference to `double*<br>
| Rcpp::internal::r_vector_start&lt;14, double&gt;(SEXPREC*)&#39;<br>
| collect2: ld returned 1 exit status<br>
|<br>
|  <br>
|<br>
| Similarly, running R CMD check mypackage yields the following error file:<br>
|<br>
| * installing *source* package &#39;mypackage&#39; ...<br>
| ** libs<br>
|<br>
| *** arch - i386<br>
| g++ -shared -s -static-libgcc -o mypackage.dll tmp.def rcpp_hello_world.o -Ld:/<br>
| RCompile/CRANpkg/extralibs/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs/local<br>
| /lib C:/Users/Jared/Documents/R/win-library/2.14/Rcpp/lib/i386/libRcpp.a -Lc:/<br>
| Users/Jared/DOCUME~1/R/R-214~1.1/bin/i386 -lR<br>
| c:/rtools/gcc-4.5.4/bin64/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../<br>
| x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/Users/Jared/DOCUME~1/R/<br>
| R-214~1.1/bin/i386/R.dll when searching for -lR<br>
| c:/rtools/gcc-4.5.4/bin64/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../<br>
| x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/Users/Jared/DOCUME~1/R/<br>
| R-214~1.1/bin/i386/R.dll when searching for -lR<br>
| c:/rtools/gcc-4.5.4/bin64/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../<br>
</div></div><div class="im">| x86_64-w64-mingw32/bin/ld.exe: cannot find -lR<br>
| collect2: ld returned 1 exit status<br>
| ERROR: compilation failed for package &#39;mypackage&#39;<br>
| * removing &#39;c:/Users/Jared/mypackage.Rcheck/mypackage&#39;<br>
|<br>
|<br>
| I am running Windows 7, R 2.14.1, with RTools and gcc-4.5.4, with all the<br>
| apropriate programs in the path.<br>
<br>
</div>Just a few weeks ago, I re-setup all that on two Windows computers. It does<br>
work for me, CRAN, win-builder and a number of users.<br>
<br>
The first test always is &#39;R CMD INSTALL somePackage_1.2-3.tar.gz&#39;.  You could<br>
try with RcpoArmadillo or something even smaller.<br>
<br>
You can also create a source archive and submit it to win-builder yourself to<br>
check whether it is your sources, or your compiler setup. See<br>
<a href="http://win-builder.r-project.org" target="_blank">http://win-builder.r-project.org</a> for more.<br></blockquote><div><font color="#3366ff">I will try again with another package and try on a Mac I have to see if that helps me out.</font></div>
<div> </div><div><font color="#3366ff">Thanks for the help.</font> </div><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">

<br>
Dirk<br>
<div class="im"><br>
| Thank you for any insight you can provide.<br>
|  <br>
| Jared<br>
|<br>
</div>| ----------------------------------------------------------------------<br>
| _______________________________________________<br>
| Rcpp-devel mailing list<br>
| <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
<span class="HOEnZb"><font color="#888888">--<br>
&quot;Outside of a dog, a book is a man&#39;s best friend. Inside of a dog, it is too<br>
dark to read.&quot; -- Groucho Marx<br>
</font></span></blockquote></div><br>