Skip to content

[Rcpp-devel] Compilation ERROR

6 messages · Sedat Sen, Kevin Ushey, Dirk Eddelbuettel

#
Dear list,

I am planning to use Stan through R which requires using Rcpp package and
C++ compiler. I am not familiar with C++. I have been trying to install
necessary packages and tools. I followed the steps given at this website:
http://tonybreyal.wordpress.com/2011/12/07/installing-rcpp-on-windows-7-for-r-and-c-integration/

There is an example code on that website. I tried to run it many times. I
failed at each attempts. I have spent hours and googled but could not get
it run. Could you please help me solve this problem based on the code and
error below.

# install packages
install.packages(c("Rcpp", "rbenchmark", "inline", "RUnit"))

# load main two packages
library(Rcpp)
library(inline)

# do something with Rcpp to quickly check that it works
body <- '
NumericVector xx(x);
return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));'

add <- cxxfunction(signature(x = "numeric"), body, plugin = "Rcpp")

*ERROR:*


cygwin warning:
  MS-DOS style path detected: C:/R/etc/x64/Makeconf
  Preferred POSIX equivalent is: /cygdrive/c/R/etc/x64/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
filee3865715ed2.cpp:1: sorry, unimplemented: 64-bit mode not compiled in
filee3865715ed2.cpp:1: error: bad value (core2) for -mtune= switch
make: *** [filee3865715ed2.o] Error 1

ERROR(s) during compilation: source code errors or compiler configuration
errors!

Program source:
  1:
  2: // includes from the plugin
  3:
  4: #include <Rcpp.h>
  5:
  6:
  7: #ifndef BEGIN_RCPP
  8: #define BEGIN_RCPP
  9: #endif
 10:
 11: #ifndef END_RCPP
 12: #define END_RCPP
 13: #endif
 14:
 15: using namespace Rcpp;
 16:
 17:
 18: // user includes
 19:
 20:
 21: // declarations
 22: extern "C" {
 23: SEXP filee3865715ed2( SEXP x) ;
 24: }
 25:
 26: // definition
 27:
 28: SEXP filee3865715ed2( SEXP x ){
 29: BEGIN_RCPP
 30:
 31: NumericVector xx(x);
 32: return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));
 33: END_RCPP
 34: }
 35:
 36:
Error in compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created! cygwin warning:
  MS-DOS style path detected: C:/R/etc/x64/Makeconf
  Preferred POSIX equivalent is: /cygdrive/c/R/etc/x64/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
filee3865715ed2.cpp:1: sorry, unimplemented: 64-bit mode not compiled in
filee3865715ed2.cpp:1: error: bad value (core2) for -mtune= switch
make: *** [filee3865715ed2.o] Error 1
In addition: Warning message:
running command 'C:/R/bin/x64/R CMD SHLIB filee3865715ed2.cpp 2>
filee3865715ed2.cpp.err.txt' had status 1
I am using Windows-64 bit. On my previous run, I also got an error
like *"Cygwin1.dll
Not Found". *In order to fix this I reinstalled the Cygwin but it did not
work. Now I am getting the long error listed above.


I am also adding what seems on my PATH
C:\R\batchfiles_0.6-6;C:\R\Rtools\bin;C:\R\Rtools\MinGW\bin;C:\cygwin\bin


Any suggestion?
#
By default, g++.exe is installed into <Rtools_path>/gcc-<version>/bin; and
you want to make sure that folder is in your path (not just
C:\R\Rtools\bin, so I guess in your case, assuming an up-to-date version of
R/Rtools, you want to make sure C:\R\tools\gcc-4.6.3\bin is also in your
path). Note that this is done by default with the Windows installer (it
sets the system path rather than the user path). Also, ensure that you have
a version of Rtools compatible with the version of R you're using. Finally,
make sure you don't have any other (older?) versions of gcc or g++ hiding
in a path that's included before the Rtools path. If those versions are
getting called rather than the Rtools g++, that could lead to this problem.

-Kevin
On Thu, Mar 7, 2013 at 10:07 PM, Sedat Sen <sedatsen06 at gmail.com> wrote:

            
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130307/3aaf6f71/attachment-0001.html>
#
Dear Kevin,

Thanks for your quick reply and suggestions. I followed your instructions.

Here's what I did:

I removed cygwin and all related files then rebooted PC.
I also removed Rtools.
I reinstalled Rtools30.exe because I use R version 2.15.3 (2013-03-01) --
"Security Blanket"
After I adjust my PATH as below:
C:\R\batchfiles_0.6-6;C:\R\Rtools\bin;C:\R\Rtools\gcc-4.6.3\bin

based on your suggestion, I ran the same code but still getting errors. I
restarted my PC  but it did not change anything.  It looks like I am
getting a different error this time but it seems to be related to CYGWIN.
Please see the below for new error.
+ NumericVector xx(x);
+ return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));'
*cygwin warning:*
*  MS-DOS style path detected: C:/R/etc/x64/Makeconf*
*  Preferred POSIX equivalent is: /cygdrive/c/R/etc/x64/Makeconf*
*  CYGWIN environment variable option "nodosfilewarning" turns off this
warning.*
*  Consult the user's guide for more details about POSIX paths:*
*    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames*
Am I missing something?

Thanks for your time.

Sedat
On Fri, Mar 8, 2013 at 1:24 AM, Kevin Ushey <kevinushey at gmail.com> wrote:

            

  
    
#
Sorry it was not en error but warning! I could get the same results as in
that website.
+ NumericVector xx(x);
+ return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));'
cygwin warning:
  MS-DOS style path detected: C:/R/etc/x64/Makeconf
  Preferred POSIX equivalent is: /cygdrive/c/R/etc/x64/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
[1] 3


Do you think this warning is a problem and should be fixed/can be fixed?

Best,

Sedat
On Fri, Mar 8, 2013 at 2:13 AM, Sedat Sen <sedatsen06 at gmail.com> wrote:

            

  
    
#
On 8 March 2013 at 02:18, Sedat Sen wrote:
| Sorry it was not en error but warning! I could get the same results as in that
| website.?
| 
| > # do something with Rcpp to quickly check that it works
| > body <- '
| + NumericVector xx(x);
| + return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));'
| >?
| > add <- cxxfunction(signature(x = "numeric"), body, plugin = "Rcpp")
| cygwin warning:
| ? MS-DOS style path detected: C:/R/etc/x64/Makeconf
| ? Preferred POSIX equivalent is: /cygdrive/c/R/etc/x64/Makeconf
| ? CYGWIN environment variable option "nodosfilewarning" turns off this warning.
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ? Consult the user's guide for more details about POSIX paths:
| ? ? http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
| >?
| > x <- 1
| > y <- 2
| > res <- add(c(x, y))
| > res
| [1] 3
| 
| 
| Do you think this warning is a problem and should be fixed/can be fixed?

Yes. Read the text I underlined and set the environment variable it asks for.

Dirk
#
It fixed the warning. Thanks! After hours of trying, I could install rstan
package and start doing analyses finally;)

Best,

Sedat
On Fri, Mar 8, 2013 at 7:21 AM, Dirk Eddelbuettel <edd at debian.org> wrote: