title: Install and build an R package in windows from a tar.gz
body: <p>I have built an R package in Linux, it compiles perfectly, and generates a tar.gz file, installable and executable.</p>
  
  <p>Now I am trying to build the windows version of my library with the RTools (last version) following the instructions of this page:</p>
  
  <p><a href="https://www.biostat.wisc.edu/~kbroman/Rintro/Rwinpack.html" rel="nofollow">https://www.biostat.wisc.edu/~kbroman/Rintro/Rwinpack.html</a></p>
  
  <p>When I execute the following command:</p>
  
  <pre><code>R CMD INSTALL --build --compile-both mypackage.tar.gz
  </code></pre>
  
  <p>I got the error:</p>
  
  <pre><code>Warning in untar2(tarfile, files, list, exdir, restore_times) :
    failed to copy 'rbdd/libs/libbuddy.so.0.0.0' to 'rbdd/libs/libbuddy.so'
  Warning in untar2(tarfile, files, list, exdir, restore_times) :
    restoring symbolic link as a file copy
  * installing to library 'C:/Users/Sergio/Documents/R/win-library/3.3'
  * installing *binary* package 'mypackage' ...
  cp: unknown option -- )
  Try '/usr/bin/cp --help' for more information.
  Warning: executed command 'cp -R . "C:/Users/Sergio/Documents/R/win-library/3.3/mypackage" || ( tar cd - .| (cd "C:/Users/Sergio/Documents/R/win-library/3.3/mypackage" &amp;&amp; tar -xf -))' has status 1
  ERROR: installing binary package failed
  * removing 'C:/Users/Sergio/Documents/R/win-library/3.3/mypackage'
  </code></pre>
  
  <p>I have configured my Path variable as follows:</p>
  
  <pre><code>PATH:C:\Rtools\bin;C:\Rtools\mingw_32\bin;C:\Program Files\R\R-3.3.0\bin\x64\;...;C:\Windows\system32;...
  </code></pre>
  
  <p>What can be the problem?</p>