[Rcpp-devel] Errors while compiling a script (seems to be related to Fortran)

Xiao He praguewatermelon at gmail.com
Wed Sep 3 19:15:00 CEST 2014


Hi all,

I tried to compile a script using the code below:

============================================================
Rscript compiler.R '/Users/xiaohe/WRScpp/src/test.cpp'
============================================================

And I got 7 error messages in total as shown below. I am on a Mac (OX
10.9.4), my R is 3.1.1, and I have the latest Xcode as well as the latest
Rcpp and RcppArmadillo installed.

A minimally reproducible script (test.cpp) is here:
https://www.dropbox.com/s/dpipxzmawet0e8y/test.cpp?dl=0

And the compiler.R file I used is in this link:
https://www.dropbox.com/s/4vadide49zd6hwi/compiler.R?dl=0

I would be grateful if someone could point me to the right direction
regarding the causes of the errors. Thank you in advance!


============================================================
Loading required package: RcppArmadillo
clang++ -I/Library/Frameworks/R.framework/Resources/include -DDEBUG
-I/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include
-I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include"
-I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include
 -fPIC  -mtune=core2 -g -O0    -c /Users/xiaohe/WRScpp/src/test.cpp -o
/Users/xiaohe/WRScpp/src/test.o
In file included from /Users/xiaohe/WRScpp/src/test.cpp:7:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:30:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:37:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo:131:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/blas_bones.hpp:62:10:
error: conflicting types for 'ddot_'
  double arma_fortran(arma_ddot)(blas_int* n, const double* x, blas_int*
incx, const double* y, blas_int* incy);
         ^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:36:34:
note: expanded from macro 'arma_fortran'
  #define arma_fortran(function) arma_fortran2_noprefix(function)
                                 ^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:25:44:
note: expanded from macro 'arma_fortran2_noprefix'
  #define arma_fortran2_noprefix(function) function##_
                                           ^
<scratch space>:539:1: note: expanded from here
ddot_
^
/Library/Frameworks/R.framework/Resources/include/R_ext/BLAS.h:58:1: note:
previous declaration is here
F77_NAME(ddot)(const int *n, const double *dx, const int *incx,
^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:86:24: note:
expanded from macro 'F77_NAME'
#define F77_NAME(x)    F77_CALL(x)
                       ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:82:22: note:
expanded from macro 'F77_CALL'
# define F77_CALL(x)    x ## _
                        ^
<scratch space>:181:1: note: expanded from here
ddot_
^
In file included from /Users/xiaohe/WRScpp/src/test.cpp:7:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:30:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:37:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo:131:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/blas_bones.hpp:67:8:
error: conflicting types for 'zgemv_'
  void arma_fortran(arma_zgemv)(const char* transA, const blas_int* m,
const blas_int* n, const void*   alpha, const void*   A, const blas_int*
ldA, const void*   x, const blas_int* incx, con...
       ^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:36:34:
note: expanded from macro 'arma_fortran'
  #define arma_fortran(function) arma_fortran2_noprefix(function)
                                 ^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:25:44:
note: expanded from macro 'arma_fortran2_noprefix'
  #define arma_fortran2_noprefix(function) function##_
                                           ^
<scratch space>:539:1: note: expanded from here
zgemv_
^
/Library/Frameworks/R.framework/Resources/include/R_ext/BLAS.h:287:5: note:
previous declaration is here
    F77_NAME(zgemv)(char *trans, int *m, int *n, Rcomplex *alpha,
    ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:86:24: note:
expanded from macro 'F77_NAME'
#define F77_NAME(x)    F77_CALL(x)
                       ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:82:22: note:
expanded from macro 'F77_CALL'
# define F77_CALL(x)    x ## _
                        ^
<scratch space>:3:1: note: expanded from here
zgemv_
^
In file included from /Users/xiaohe/WRScpp/src/test.cpp:7:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:30:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:37:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo:131:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/blas_bones.hpp:72:8:
error: conflicting types for 'zgemm_'
  void arma_fortran(arma_zgemm)(const char* transA, const char* transB,
const blas_int* m, const blas_int* n, const blas_int* k, const void*
alpha, const void*   A, const blas_int* ldA, con...
       ^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:36:34:
note: expanded from macro 'arma_fortran'
  #define arma_fortran(function) arma_fortran2_noprefix(function)
                                 ^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:25:44:
note: expanded from macro 'arma_fortran2_noprefix'
  #define arma_fortran2_noprefix(function) function##_
                                           ^
<scratch space>:539:1: note: expanded from here
zgemm_
^
/Library/Frameworks/R.framework/Resources/include/R_ext/BLAS.h:281:5: note:
previous declaration is here
    F77_NAME(zgemm)(const char *transa, const char *transb, const int *m,
    ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:86:24: note:
expanded from macro 'F77_NAME'
#define F77_NAME(x)    F77_CALL(x)
                       ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:82:22: note:
expanded from macro 'F77_CALL'
# define F77_CALL(x)    x ## _
                        ^
<scratch space>:2:1: note: expanded from here
zgemm_
^
In file included from /Users/xiaohe/WRScpp/src/test.cpp:7:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:30:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:37:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo:131:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/blas_bones.hpp:78:8:
error: conflicting types for 'zherk_'
  void arma_fortran(arma_zherk)(const char* uplo, const char* transA, const
blas_int* n, const blas_int* k, const double* alpha, const   void* A, const
blas_int* ldA, const double* beta,   vo...
       ^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:36:34:
note: expanded from macro 'arma_fortran'
  #define arma_fortran(function) arma_fortran2_noprefix(function)
                                 ^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:25:44:
note: expanded from macro 'arma_fortran2_noprefix'
  #define arma_fortran2_noprefix(function) function##_
                                           ^
<scratch space>:539:1: note: expanded from here
zherk_
^
/Library/Frameworks/R.framework/Resources/include/R_ext/BLAS.h:319:5: note:
previous declaration is here
    F77_NAME(zherk)(char *uplo, char *trans, int *n, int *k,
    ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:86:24: note:
expanded from macro 'F77_NAME'
#define F77_NAME(x)    F77_CALL(x)
                       ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:82:22: note:
expanded from macro 'F77_CALL'
# define F77_CALL(x)    x ## _
                        ^
<scratch space>:12:1: note: expanded from here
zherk_
^
In file included from /Users/xiaohe/WRScpp/src/test.cpp:7:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:30:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:37:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo:137:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/blas_wrapper.hpp:46:7:
error: no matching function for call to 'zgemv_'
      arma_fortran(arma_zgemv)(transA, m, n, (const T*)alpha, (const T*)A,
ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy);
      ^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:36:34:
note: expanded from macro 'arma_fortran'
  #define arma_fortran(function) arma_fortran2_noprefix(function)
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:25:44:
note: expanded from macro 'arma_fortran2_noprefix'
  #define arma_fortran2_noprefix(function) function##_
                                           ^~~~~~~~~~~
<scratch space>:25:1: note: expanded from here
zgemv_
^~~~~~
/Library/Frameworks/R.framework/Resources/include/R_ext/BLAS.h:287:5: note:
candidate function not viable: 1st argument ('const char *') would lose
const qualifier
    F77_NAME(zgemv)(char *trans, int *m, int *n, Rcomplex *alpha,
    ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:86:24: note:
expanded from macro 'F77_NAME'
#define F77_NAME(x)    F77_CALL(x)
                       ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:82:22: note:
expanded from macro 'F77_CALL'
# define F77_CALL(x)    x ## _
                        ^
<scratch space>:3:1: note: expanded from here
zgemv_
^
In file included from /Users/xiaohe/WRScpp/src/test.cpp:7:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:30:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:37:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo:137:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/blas_wrapper.hpp:81:7:
error: no matching function for call to 'zgemm_'
      arma_fortran(arma_zgemm)(transA, transB, m, n, k, (const T*)alpha,
(const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC);
      ^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:36:34:
note: expanded from macro 'arma_fortran'
  #define arma_fortran(function) arma_fortran2_noprefix(function)
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:25:44:
note: expanded from macro 'arma_fortran2_noprefix'
  #define arma_fortran2_noprefix(function) function##_
                                           ^~~~~~~~~~~
<scratch space>:25:1: note: expanded from here
zgemm_
^~~~~~
/Library/Frameworks/R.framework/Resources/include/R_ext/BLAS.h:281:5: note:
candidate function not viable: no known conversion from 'const T *' (aka
'const complex<double> *') to 'const Rcomplex *'
      for 6th argument
    F77_NAME(zgemm)(const char *transa, const char *transb, const int *m,
    ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:86:24: note:
expanded from macro 'F77_NAME'
#define F77_NAME(x)    F77_CALL(x)
                       ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:82:22: note:
expanded from macro 'F77_CALL'
# define F77_CALL(x)    x ## _
                        ^
<scratch space>:2:1: note: expanded from here
zgemm_
^
In file included from /Users/xiaohe/WRScpp/src/test.cpp:7:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadillo.h:30:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:37:
In file included from
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo:137:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/blas_wrapper.hpp:130:7:
error: no matching function for call to 'zherk_'
      arma_fortran(arma_zherk)(uplo, transA, n, k, (const TT*)alpha, (const
cx_TT*)A, ldA, (const TT*)beta, (cx_TT*)C, ldC);
      ^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:36:34:
note: expanded from macro 'arma_fortran'
  #define arma_fortran(function) arma_fortran2_noprefix(function)
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:25:44:
note: expanded from macro 'arma_fortran2_noprefix'
  #define arma_fortran2_noprefix(function) function##_
                                           ^~~~~~~~~~~
<scratch space>:25:1: note: expanded from here
zherk_
^~~~~~
/Library/Frameworks/R.framework/Resources/include/R_ext/BLAS.h:319:5: note:
candidate function not viable: 1st argument ('const char *') would lose
const qualifier
    F77_NAME(zherk)(char *uplo, char *trans, int *n, int *k,
    ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:86:24: note:
expanded from macro 'F77_NAME'
#define F77_NAME(x)    F77_CALL(x)
                       ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:82:22: note:
expanded from macro 'F77_CALL'
# define F77_CALL(x)    x ## _
                        ^
<scratch space>:12:1: note: expanded from here
zherk_
^
7 errors generated.
make: *** [/Users/xiaohe/WRScpp/src/test.o] Error 1
============================================================


Best,
Xiao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140903/c0b11ab9/attachment-0001.html>


More information about the Rcpp-devel mailing list