Can't compile on current version_2.4.x (488383323eca)

Issue #160 resolved
Dav Clark created an issue

Building on llvm-gcc or clang (the two default compilers available now in OS X Mountain Lion / 10.8.5, "classic" gcc is no longer supported), I get fatal errors. They seem like legit errors, but I'm wondering if some subtle semantics have changed. I'm wondering if this is also potentially a change going to R 3 (I'm running 3.0.2)?

Sorry I don't know more about the details of this (yet) - but I'm afraid to just go mucking about adding semicolons, deleting consts, tracking down the right way to include the definition of sexp, etc.

More on versions: - clang: Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn) - llvm-gcc: 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) - R: 3.0.2

Errors (and related messages) with clang compilation:

"/Library/Frameworks/R.framework/Resources/bin/R" CMD config LAPACK_LIBS

returned an empty string.

"/Library/Frameworks/R.framework/Resources/bin/R" CMD config BLAS_LIBS

returned an empty string.

Configuration for R as a library:
  include_dirs: ('/Library/Frameworks/R.framework/Resources/include',)
  libraries: ()
  library_dirs: ('/Library/Frameworks/R.framework/Resources/lib',)
  extra_link_args: ('-framework R', '-F/Library/Frameworks/R.framework/..')
 # OSX-specific (included in extra_link_args)
  framework_dirs: ('-F/Library/Frameworks/R.framework/..',)
  frameworks: ('-framework R',)
building 'rpy2.rinterface._rinterface' extension
creating build/temp.macosx-10.5-x86_64-2.7
creating build/temp.macosx-10.5-x86_64-2.7/rpy
creating build/temp.macosx-10.5-x86_64-2.7/rpy/rinterface
/usr/bin/clang -fno-strict-aliasing -I/Users/davclark/anaconda/envs/rpy2-devel/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DRIF_HAS_RSIGHAND=1 -DCSTACK_DEFNS=1 -DHAS_READLINE=1 -I./rpy/rinterface -I/Users/davclark/anaconda/envs/rpy2-devel/include/python2.7 -I/Library/Frameworks/R.framework/Resources/include -c ./rpy/rinterface/_rinterface.c -o build/temp.macosx-10.5-x86_64-2.7/./rpy/rinterface/_rinterface.o
In file included from ./rpy/rinterface/_rinterface.c:104:
./rpy/rinterface/embeddedr.h:6:27: warning: duplicate 'const' declaration
      specifier [-Wduplicate-decl-specifier]
extern const unsigned int const RPY_R_INITIALIZED;
                          ^
./rpy/rinterface/embeddedr.h:7:27: warning: duplicate 'const' declaration
      specifier [-Wduplicate-decl-specifier]
extern const unsigned int const RPY_R_BUSY;
                          ^
In file included from ./rpy/rinterface/_rinterface.c:122:
./rpy/rinterface/embeddedr.c:5:20: warning: duplicate 'const' declaration
      specifier [-Wduplicate-decl-specifier]
const unsigned int const RPY_R_INITIALIZED = 0x01;
                   ^
./rpy/rinterface/embeddedr.c:6:20: warning: duplicate 'const' declaration
      specifier [-Wduplicate-decl-specifier]
const unsigned int const RPY_R_BUSY = 0x02;
                   ^
In file included from ./rpy/rinterface/_rinterface.c:125:
./rpy/rinterface/sexp.c:397:12: warning: incompatible pointer to integer
      conversion returning 'void *' from a function with result type 'int'
      [-Wint-conversion]
    return NULL;
           ^~~~
/usr/bin/../lib/clang/4.2/include/stddef.h:52:16: note: expanded from macro
      'NULL'
#  define NULL ((void*)0)
               ^~~~~~~~~~
In file included from ./rpy/rinterface/_rinterface.c:125:
./rpy/rinterface/sexp.c:739:13: warning: unused variable 'copy'
      [-Wunused-variable]
  PyObject *copy = Py_True;
            ^
In file included from ./rpy/rinterface/_rinterface.c:129:
./rpy/rinterface/sequence.c:210:43: warning: incompatible pointer types passing
      'SEXP' (aka 'struct SEXPREC *') to parameter of type 'const char *'
      [-Wincompatible-pointer-types]
      SET_STRING_ELT(sexp_name, i, mkChar(TAG(tmp)));
                                          ^~~~~~~~
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:690:28: note: 
      passing argument to parameter here
SEXP Rf_mkChar(const char *);
                           ^
./rpy/rinterface/_rinterface.c:2434:29: error: use of undeclared identifier
      'sexp'; did you mean 'exp'?
    sexp_item = STRING_ELT(*sexp, i_R);
                            ^~~~
                            exp
/usr/include/math.h:368:15: note: 'exp' declared here
extern double exp(double);
              ^
./rpy/rinterface/_rinterface.c:2434:35: error: use of undeclared identifier
      'i_R'
    sexp_item = STRING_ELT(*sexp, i_R);
                                  ^
./rpy/rinterface/_rinterface.c:2471:9: error: too many arguments provided to
      function-like macro invocation
        "rpy2.rinterface.SexpEnvironment",   /*tp_name*/
        ^
./rpy/rinterface/_rinterface.c:2435:5: error: use of undeclared identifier
      'PyTuple_SET_ITEM'
    PyTuple_SET_ITEM(keys, i, 
    ^
./rpy/rinterface/_rinterface.c:2514:1: error: function declared in block scope
      cannot have 'static' storage class
static int
^
./rpy/rinterface/_rinterface.c:2515:69: error: expected ';' at end of
      declaration
EnvironmentSexp_init(PyObject *self, PyObject *args, PyObject *kwds)
                                                                    ^
                                                                    ;
./rpy/rinterface/_rinterface.c:2588:9: error: use of undeclared identifier
      'S4Sexp_Type_doc'; did you mean 'S4Sexp_Type'?
        S4Sexp_Type_doc,                      /*tp_doc*/
        ^~~~~~~~~~~~~~~
        S4Sexp_Type
./rpy/rinterface/_rinterface.c:2559:21: note: 'S4Sexp_Type' declared here
static PyTypeObject S4Sexp_Type = {
                    ^
./rpy/rinterface/_rinterface.c:2588:9: error: initializing 'const char *' with
      an expression of incompatible type 'PyTypeObject' (aka
      'struct _typeobject')
        S4Sexp_Type_doc,                      /*tp_doc*/
        ^~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:2676:1: error: function declared in block scope
      cannot have 'static' storage class
static PySexpObject*
^
./rpy/rinterface/_rinterface.c:2677:35: error: expected ';' at end of
      declaration
  newPySexpObject(const SEXP sexp)
                                  ^
                                  ;
./rpy/rinterface/_rinterface.c:3141:1: error: function declared in block scope
      cannot have 'static' storage class
static SEXP
^
./rpy/rinterface/_rinterface.c:3142:26: error: expected ';' at end of
      declaration
mkPyObject(PyObject* pyo)
                         ^
                         ;
./rpy/rinterface/_rinterface.c:3294:22: error: expected ';' at end of
      declaration
init_rinterface(void)
                     ^
                     ;
./rpy/rinterface/_rinterface.c:3820:2: error: expected '}'
}
 ^
./rpy/rinterface/_rinterface.c:2413:1: note: to match this '{'
{
^
7 warnings and 14 errors generated.
error: command '/usr/bin/clang' failed with exit status 1

Errors (and related messages) with llvm-gcc:

"/Library/Frameworks/R.framework/Resources/bin/R" CMD config LAPACK_LIBS

returned an empty string.

"/Library/Frameworks/R.framework/Resources/bin/R" CMD config BLAS_LIBS

returned an empty string.

Configuration for R as a library:
  include_dirs: ('/Library/Frameworks/R.framework/Resources/include',)
  libraries: ()
  library_dirs: ('/Library/Frameworks/R.framework/Resources/lib',)
  extra_link_args: ('-framework R', '-F/Library/Frameworks/R.framework/..')
 # OSX-specific (included in extra_link_args)
  framework_dirs: ('-F/Library/Frameworks/R.framework/..',)
  frameworks: ('-framework R',)
building 'rpy2.rinterface._rinterface' extension
gcc -fno-strict-aliasing -I/Users/davclark/anaconda/envs/rpy2-devel/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DRIF_HAS_RSIGHAND=1 -DCSTACK_DEFNS=1 -DHAS_READLINE=1 -I./rpy/rinterface -I/Users/davclark/anaconda/envs/rpy2-devel/include/python2.7 -I/Library/Frameworks/R.framework/Resources/include -c ./rpy/rinterface/_rinterface.c -o build/temp.macosx-10.5-x86_64-2.7/./rpy/rinterface/_rinterface.o
In file included from /Library/Frameworks/R.framework/Resources/include/R.h:40,
                 from ./rpy/rinterface/_rinterface.h:8,
                 from ./rpy/rinterface/_rinterface.c:58:
/Library/Frameworks/R.framework/Resources/include/R_ext/Memory.h:40: warning: function declaration isnt a prototype
In file included from ./rpy/rinterface/_rinterface.h:9,
                 from ./rpy/rinterface/_rinterface.c:58:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:719: warning: function declaration isnt a prototype
In file included from ./rpy/rinterface/_rinterface.c:70:
/Library/Frameworks/R.framework/Resources/include/Rinterface.h:129: warning: function declaration isnt a prototype
In file included from ./rpy/rinterface/_rinterface.c:79:
/Library/Frameworks/R.framework/Resources/include/R_ext/Rdynload.h:32: warning: function declaration isnt a prototype
In file included from /Users/davclark/anaconda/envs/rpy2-devel/include/readline/readline.h:36,
                 from ./rpy/rinterface/_rinterface.c:86:
/Users/davclark/anaconda/envs/rpy2-devel/include/readline/rltypedefs.h:34: warning: function declaration isnt a prototype
/Users/davclark/anaconda/envs/rpy2-devel/include/readline/rltypedefs.h:35: warning: function declaration isnt a prototype
/Users/davclark/anaconda/envs/rpy2-devel/include/readline/rltypedefs.h:36: warning: function declaration isnt a prototype
/Users/davclark/anaconda/envs/rpy2-devel/include/readline/rltypedefs.h:37: warning: function declaration isnt a prototype
In file included from ./rpy/rinterface/_rinterface.c:86:
/Users/davclark/anaconda/envs/rpy2-devel/include/readline/readline.h:381: warning: function declaration isnt a prototype
In file included from ./rpy/rinterface/_rinterface.c:125:
./rpy/rinterface/sexp.c: In function Sexp_rclass_set:
./rpy/rinterface/sexp.c:397: warning: return makes integer from pointer without a cast
./rpy/rinterface/sexp.c: In function Sexp_init:
./rpy/rinterface/sexp.c:739: warning: unused variable copy
In file included from ./rpy/rinterface/_rinterface.c:129:
./rpy/rinterface/sequence.c: In function VectorSexp_item:
./rpy/rinterface/sequence.c:210: warning: passing argument 1 of Rf_mkChar from incompatible pointer type
./rpy/rinterface/_rinterface.c: In function EnvironmentSexp_keys:
./rpy/rinterface/_rinterface.c:2434: error: sexp undeclared (first use in this function)
./rpy/rinterface/_rinterface.c:2434: error: (Each undeclared identifier is reported only once
./rpy/rinterface/_rinterface.c:2434: error: for each function it appears in.)
./rpy/rinterface/_rinterface.c:2434: error: i_R undeclared (first use in this function)
./rpy/rinterface/_rinterface.c:3820:1: error: unterminated argument list invoking macro "PyTuple_SET_ITEM"
./rpy/rinterface/_rinterface.c:2435: error: PyTuple_SET_ITEM undeclared (first use in this function)
./rpy/rinterface/_rinterface.c:2435: error: expected ; at end of input
./rpy/rinterface/_rinterface.c:2435: error: expected declaration or statement at end of input
./rpy/rinterface/_rinterface.c:2435: error: expected declaration or statement at end of input
./rpy/rinterface/_rinterface.c:2431: warning: unused variable val
./rpy/rinterface/_rinterface.c:2430: warning: unused variable keys
error: command 'gcc' failed with exit status 1

Comments (5)

  1. Laurent Gautier

    Ouch.

    It looks like something went wrong over here. C source still WIP was committed - I missed it because the build/ cache was not empty (not everything was rebuilt when I checked).

    I am looking into it

  2. Laurent Gautier

    Half-complete code made it to the main repository. An accident.

    I have just pushed an emergency fix that should get you going: 6362cbee0b4a (it is building from scratch, and passing unittests here on Python 2.7.5 and R-3.0.2 compiled with gcc-4.8.1).

  3. Log in to comment