问题
I'm trying to install rpy2 on Mac Mountain Lion (10.8.5) with pip:
sudo pip install rpy2
and get the following error message:
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'clang' failed with exit status 1
My python version is 2.7.2, R version is 3.2.1.
In some posts I've read that I need to install Xcode and command line tools to solve the problem, but I had both already installed (Xcode 5.1.1).
(The following is added after a suggestion by Eric Appelt, to whom I'm very thankful:)
I have also tried to set the ARCHFLAGS in order to disable the error message:
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install rpy2
but now I got the following error message:
clang: warning: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: warning: argument unused during compilation: '-mno-fused-madd'
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;
^
./rpy/rinterface/embeddedr.c:48:12: warning: unused variable 'res' [-Wunused-variable]
SEXP res = rpy_remove(Rf_mkString(name_buf),
^
In file included from ./rpy/rinterface/_rinterface.c:125:
./rpy/rinterface/sexp.c:738:13: warning: unused variable 'copy' [-Wunused-variable]
PyObject *copy = Py_True;
^
In file included from ./rpy/rinterface/_rinterface.c:129:
./rpy/rinterface/sequence.c:267:30: warning: implicit conversion loses integer precision: 'long' to 'R_len_t' (aka 'int') [-Wshorten-64-to-32]
R_len_t slice_len = ihigh-ilow;
~~~~~~~~~ ~~~~~^~~~~
./rpy/rinterface/sequence.c:522:30: warning: implicit conversion loses integer precision: 'long' to 'R_len_t' (aka 'int') [-Wshorten-64-to-32]
R_len_t slice_len = ihigh-ilow;
~~~~~~~~~ ~~~~~^~~~~
./rpy/rinterface/_rinterface.c:390:3: warning: variable 'consolecallback' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
./rpy/rinterface/_rinterface.c:416:7: note: uninitialized use occurs here
if (consolecallback == NULL) {
^~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:382:24: note: initialize the variable 'consolecallback' to silence this warning
void *consolecallback;
^
= NULL
./rpy/rinterface/_rinterface.c:625:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int l=strlen(input_str);
~ ^~~~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:832:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int l=strlen(path_str);
~ ^~~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:1338:28: warning: implicit conversion loses integer precision: 'const Py_ssize_t' (aka 'const long') to 'int' [-Wshorten-64-to-32]
status = Rf_initialize_R(n_args, options);
~~~~~~~~~~~~~~~ ^~~~~~
./rpy/rinterface/_rinterface.c:1730:13: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
nparams = PySequence_Length(params);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:1065:27: note: expanded from macro 'PySequence_Length'
#define PySequence_Length PySequence_Size
^
In file included from ./rpy/rinterface/_rinterface.c:129:
./rpy/rinterface/sequence.c:2174:1: warning: unused function 'ComplexVectorSexp_AsSexp' [-Wunused-function]
ComplexVectorSexp_AsSexp(PyObject *pyfloat) {
^
14 warnings generated.
clang -bundle -undefined dynamic_lookup -Wl,-F. -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future build/temp.macosx-10.8-x86_64-2.7/./rpy/rinterface/_rinterface.o -lpcre -llzma -licucore -lm -liconv -o build/lib.macosx-10.8-x86_64-2.7/rpy2/rinterface/_rinterface.so -F/Library/Frameworks/R.framework/.. -framework R
ld: library not found for -llzma
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
Any help will be tremendously appreciated!
来源:https://stackoverflow.com/questions/31099748/installing-rpy2-on-mac-osx-10-8-5