Why do I get this error while trying to install rpy2 on Mac OSX Sierra? - rpy2

Trying to install rpy2 on Mac Sierra by entering
sudo pip install rpy2
on the command line. Getting this error:
The directory '/Users/hodor/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/hodor/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting rpy2
Downloading rpy2-2.8.5.tar.gz (184kB)
100% |████████████████████████████████| 184kB 27kB/s
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from rpy2)
Requirement already satisfied: singledispatch in /Library/Python/2.7/site-packages (from rpy2)
Installing collected packages: rpy2
Running setup.py install for rpy2 ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/private/tmp/pip-build-0H8VbG/rpy2/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-umxGfs-record/install-record.txt --single-version-externally-managed --compile:
R version 3.4.0 (2017-04-21) -- "You Stupid Darkness"
/Library/Frameworks/R.framework/Resources/bin/R CMD config --ldflags
/Library/Frameworks/R.framework/Resources/bin/R CMD config --cppflags
Compilation parameters for rpy2's C components:
include_dirs = ['/Library/Frameworks/R.framework/Resources/include']
library_dirs = ['/usr/local/lib']
libraries = ['pcre', 'lzma', 'bz2', 'z', 'icucore', 'm', 'iconv']
extra_link_args = ['-fopenmp', '-F/Library/Frameworks/R.framework/..', '-framework', 'R']
running install
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
creating build/lib.macosx-10.12-intel-2.7/rpy2
copying ./rpy/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2
copying ./rpy/rpy_classic.py -> build/lib.macosx-10.12-intel-2.7/rpy2
copying ./rpy/tests.py -> build/lib.macosx-10.12-intel-2.7/rpy2
copying ./rpy/tests_rpy_classic.py -> build/lib.macosx-10.12-intel-2.7/rpy2
creating build/lib.macosx-10.12-intel-2.7/rpy2/rlike
copying ./rpy/rlike/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rlike
copying ./rpy/rlike/container.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rlike
copying ./rpy/rlike/functional.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rlike
copying ./rpy/rlike/indexing.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rlike
creating build/lib.macosx-10.12-intel-2.7/rpy2/rlike/tests
copying ./rpy/rlike/tests/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rlike/tests
copying ./rpy/rlike/tests/test_container.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rlike/tests
copying ./rpy/rlike/tests/test_functional.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rlike/tests
copying ./rpy/rlike/tests/test_indexing.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rlike/tests
creating build/lib.macosx-10.12-intel-2.7/rpy2/rinterface
copying ./rpy/rinterface/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface
creating build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_Device.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_EmbeddedR.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_Sexp.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpClosure.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpEnvironment.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpExtPtr.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpSymbol.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpVector.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpVectorNumeric.py -> build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/tests
creating build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/constants.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/conversion.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/environments.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/functions.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/help.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/language.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/methods.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/numpy2ri.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/packages.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/packages_utils.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/pandas2ri.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/robject.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
copying ./rpy/robjects/vectors.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects
creating build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testArray.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testDataFrame.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testEnvironment.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testFormula.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testFunction.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testHelp.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testLanguage.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testMethods.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testNumpyConversions.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testPackages.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testPandasConversions.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testRObject.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testRobjects.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
copying ./rpy/robjects/tests/testVector.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/tests
creating build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib
copying ./rpy/robjects/lib/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib
copying ./rpy/robjects/lib/dplyr.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib
copying ./rpy/robjects/lib/ggplot2.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib
copying ./rpy/robjects/lib/grdevices.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib
copying ./rpy/robjects/lib/grid.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib
copying ./rpy/robjects/lib/tidyr.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib
creating build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib/tests
copying ./rpy/robjects/lib/tests/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib/tests
copying ./rpy/robjects/lib/tests/test_dplyr.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib/tests
copying ./rpy/robjects/lib/tests/test_ggplot2.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib/tests
copying ./rpy/robjects/lib/tests/test_grdevices.py -> build/lib.macosx-10.12-intel-2.7/rpy2/robjects/lib/tests
creating build/lib.macosx-10.12-intel-2.7/rpy2/interactive
copying ./rpy/interactive/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/interactive
copying ./rpy/interactive/packages.py -> build/lib.macosx-10.12-intel-2.7/rpy2/interactive
copying ./rpy/interactive/process_revents.py -> build/lib.macosx-10.12-intel-2.7/rpy2/interactive
creating build/lib.macosx-10.12-intel-2.7/rpy2/interactive/tests
copying ./rpy/interactive/tests/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/interactive/tests
creating build/lib.macosx-10.12-intel-2.7/rpy2/ipython
copying ./rpy/ipython/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/ipython
copying ./rpy/ipython/ggplot.py -> build/lib.macosx-10.12-intel-2.7/rpy2/ipython
copying ./rpy/ipython/html.py -> build/lib.macosx-10.12-intel-2.7/rpy2/ipython
copying ./rpy/ipython/rmagic.py -> build/lib.macosx-10.12-intel-2.7/rpy2/ipython
creating build/lib.macosx-10.12-intel-2.7/rpy2/ipython/tests
copying ./rpy/ipython/tests/__init__.py -> build/lib.macosx-10.12-intel-2.7/rpy2/ipython/tests
copying ./rpy/ipython/tests/test_rmagic.py -> build/lib.macosx-10.12-intel-2.7/rpy2/ipython/tests
running build_clib
building 'r_utils' library
creating build/temp.macosx-10.12-intel-2.7
creating build/temp.macosx-10.12-intel-2.7/rpy
creating build/temp.macosx-10.12-intel-2.7/rpy/rinterface
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I./rpy/rinterface -I/Library/Frameworks/R.framework/Resources/include -c ./rpy/rinterface/r_utils.c -o build/temp.macosx-10.12-intel-2.7/./rpy/rinterface/r_utils.o
./rpy/rinterface/r_utils.c:230:40: warning: implicitly declaring library function 'malloc' with type 'void *(unsigned long)' [-Wimplicit-function-declaration]
ExternallyManagedVector *extvector = malloc(sizeof(ExternallyManagedVector));
^
./rpy/rinterface/r_utils.c:230:40: note: include the header <stdlib.h> or explicitly provide a declaration for 'malloc'
1 warning generated.
./rpy/rinterface/r_utils.c:230:40: warning: implicitly declaring library function 'malloc' with type 'void *(unsigned long)' [-Wimplicit-function-declaration]
ExternallyManagedVector *extvector = malloc(sizeof(ExternallyManagedVector));
^
./rpy/rinterface/r_utils.c:230:40: note: include the header <stdlib.h> or explicitly provide a declaration for 'malloc'
1 warning generated.
ar rc build/temp.macosx-10.12-intel-2.7/libr_utils.a build/temp.macosx-10.12-intel-2.7/./rpy/rinterface/r_utils.o
ranlib build/temp.macosx-10.12-intel-2.7/libr_utils.a
running build_ext
R version 3.4.0 (2017-04-21) -- "You Stupid Darkness"
building 'rpy2.rinterface._rinterface' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DRIF_HAS_RSIGHAND=1 -DCSTACK_DEFNS=1 -DHAS_READLINE=1 -I./rpy/rinterface -I/Library/Frameworks/R.framework/Resources/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ./rpy/rinterface/_rinterface.c -o build/temp.macosx-10.12-intel-2.7/./rpy/rinterface/_rinterface.o
In file included from ./rpy/rinterface/_rinterface.c:98:
./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:116:
./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 = rpy2_remove(Rf_mkString(name_buf),
^
In file included from ./rpy/rinterface/_rinterface.c:119:
./rpy/rinterface/sexp.c:742:13: warning: unused variable 'copy' [-Wunused-variable]
PyObject *copy = Py_True;
^
In file included from ./rpy/rinterface/_rinterface.c:122:
./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:347:3: warning: variable 'consolecallback' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
./rpy/rinterface/_rinterface.c:373:7: note: uninitialized use occurs here
if (consolecallback == NULL) {
^~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:339:24: note: initialize the variable 'consolecallback' to silence this warning
void *consolecallback;
^
= NULL
./rpy/rinterface/_rinterface.c:582:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int l=strlen(input_str);
~ ^~~~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:789:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int l=strlen(path_str);
~ ^~~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:1295: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:1694: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:52:
./rpy/rinterface/_rinterface.h:203:44: warning: unused function 'PyRinterface_IsInitialized' [-Wunused-function]
static PyRinterface_IsInitialized_RETURN PyRinterface_IsInitialized PyRinterface_IsInitialized_PROTO;
^
./rpy/rinterface/_rinterface.h:204:38: warning: unused function 'PyRinterface_FindFun' [-Wunused-function]
static PyRinterface_FindFun_RETURN PyRinterface_FindFun PyRinterface_FindFun_PROTO;
^
In file included from ./rpy/rinterface/_rinterface.c:122:
./rpy/rinterface/sequence.c:2168:1: warning: unused function 'ComplexVectorSexp_AsSexp' [-Wunused-function]
ComplexVectorSexp_AsSexp(PyObject *pyfloat) {
^
16 warnings generated.
In file included from ./rpy/rinterface/_rinterface.c:52:
In file included from ./rpy/rinterface/_rinterface.h:8:
In file included from /Library/Frameworks/R.framework/Resources/include/R.h:81:
/Library/Frameworks/R.framework/Resources/include/Rconfig.h:20:9: warning: 'SIZEOF_SIZE_T' macro redefined [-Wmacro-redefined]
#define SIZEOF_SIZE_T 8
^
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:56:17: note: previous definition is here
# define SIZEOF_SIZE_T 4
^
In file included from ./rpy/rinterface/_rinterface.c:98:
./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:116:
./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 = rpy2_remove(Rf_mkString(name_buf),
^
In file included from ./rpy/rinterface/_rinterface.c:119:
./rpy/rinterface/sexp.c:742:13: warning: unused variable 'copy' [-Wunused-variable]
PyObject *copy = Py_True;
^
./rpy/rinterface/_rinterface.c:347:3: warning: variable 'consolecallback' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
./rpy/rinterface/_rinterface.c:373:7: note: uninitialized use occurs here
if (consolecallback == NULL) {
^~~~~~~~~~~~~~~
./rpy/rinterface/_rinterface.c:339:24: note: initialize the variable 'consolecallback' to silence this warning
void *consolecallback;
^
= NULL
In file included from ./rpy/rinterface/_rinterface.c:52:
./rpy/rinterface/_rinterface.h:203:44: warning: unused function 'PyRinterface_IsInitialized' [-Wunused-function]
static PyRinterface_IsInitialized_RETURN PyRinterface_IsInitialized PyRinterface_IsInitialized_PROTO;
^
./rpy/rinterface/_rinterface.h:204:38: warning: unused function 'PyRinterface_FindFun' [-Wunused-function]
static PyRinterface_FindFun_RETURN PyRinterface_FindFun PyRinterface_FindFun_PROTO;
^
In file included from ./rpy/rinterface/_rinterface.c:122:
./rpy/rinterface/sequence.c:2168:1: warning: unused function 'ComplexVectorSexp_AsSexp' [-Wunused-function]
ComplexVectorSexp_AsSexp(PyObject *pyfloat) {
^
11 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.12-intel-2.7/./rpy/rinterface/_rinterface.o -L/usr/local/lib -Lbuild/temp.macosx-10.12-intel-2.7 -L/usr/local/lib -lpcre -llzma -lbz2 -lz -licucore -lm -liconv -lr_utils -o build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/_rinterface.so -fopenmp -F/Library/Frameworks/R.framework/.. -framework R
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/private/tmp/pip-build-0H8VbG/rpy2/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-umxGfs-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-0H8VbG/rpy2/

In trying to solve a similar issue, I came across this problem thread on the RPy2 Bitbucket. Apparently the latest R (3.4.0 "Single Candle") was built using the -fopenmp flag from Clang 4.0.0, which is now not supplied by Apple. If you can use R 3.3.3, then that could serve as a workaround. Alternatively, you could try modifying setup.py to remove the -fopenmp flag by adding the following after line 272:
if "-fopenmp" in unknown:
unknown.remove("-fopenmp")
If neither work, you can always force brew to use gcc to install it with the command:
env CC=/usr/local/Cellar/gcc/7.2.0/bin/gcc-7 pip install rpy2
or if you try one of these solutions and get an error that looks like this:
ld: in '/usr/local/opt/llvm/lib/libunwind.dylib', file was built for x86_64 which is not the architecture being linked (i386): /usr/local/opt/llvm/lib/libunwind.dylib for architecture i386
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/local/opt/llvm/bin/clang' failed with exit status 1
you can try installing using the command:
env ARCHFLAGS="-arch x86_64" pip install rpy2
to ensure the architecture is correct. Or combine them:
env ARCHFLAGS="-arch x86_64" CC=/usr/local/Cellar/gcc/7.2.0/bin/gcc-7 pip install rpy2
Really, this seems to be a bit of a Frankenstein issue. Different solutions worked for different people - the above were the most common ones. It's not something that is likely to have an easy fix soon, either, since it seems to be an issue on R's end.

Related

can't compile OpenFOAM v1912 with intel icc and intelmpi

! UPDATE on 28 Feb, 2020:
The problem is solved. please refer to :https://develop.openfoam.com/Development/openfoam/issues/1608
Summary
I'm new to OpenFOAM and I'm trying to compile OpenFOAM-v1912 using Icc and IntelMPI, only to find the following confusing error. It seems like an error in codes. But it just makes no sense, because I have successfully compiled it with gcc(v4.8.5) and openmpi(1.10.7), and it worked just fine. I'd be more than delighted to hear any suggestions. Ideas about what the problem might be will also be of great help. THANKS A LOT!
wallBoundedStreamLine/wallBoundedParticleTemplates.C(121): error: no operator "==" matches these operands
Steps to reproduce
I edited OpenFOAM-v1912/etc/bashrc from
...
export WM_COMPILER=Gcc
...
export WM_MPLIB=OPENMPI
...
to
...
export WM_COMPILER=Icc
...
export WM_MPLIB=INTELMPI
...
and I got "ld: cannot find -lmpi" error so I edit OpenFOAM-v1912/wmake/rules/General/Icc/c++
CC = icpc -std=c++11
to
CC = mpiicc -std=c++11
then under directory OpenFOAM-v1912/ , I ran
./Allwmake
What I've tried
Compiling with $WM_LABEL_SIZE=64
But it just seemed irrelevant and it got stuck on building libscotch. Doesn't seem to help at all.
Details of the error from the promts:
wmake reactingEulerFoam/phaseSystems
wmake reactingEulerFoam/interfacialModels
wmake reactingEulerFoam/interfacialCompositionModels
wmake reactingEulerFoam/derivedFvPatchFields
wmake reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem
wmake reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseCompressibleTurbulenceModels
wmake reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem
wmake reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels
wmake field
mpiicc -std=c++11 -fp-trap=common -fp-model precise -DOPENFOAM=1912 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-unknown-pragmas -diag-disable 327,654,1125,1292,2289,2304,11062,11074,11076 -O3 -DNoRepository -ftemplate-depth-100 -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/finiteVolume/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/fileFormats/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/surfMesh/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/meshTools/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/sampling/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/lagrangian/basic/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/lagrangian/distributionModels/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/thermophysicalModels/basic/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/transportModels -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/transportModels/compressible/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/TurbulenceModels/turbulenceModels/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/TurbulenceModels/incompressible/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/TurbulenceModels/compressible/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/transportModels/compressible/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/thermophysicalModels/basic/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/thermophysicalModels/solidThermo/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/thermophysicalModels/chemistryModel/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/thermophysicalModels/reactionThermo/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/thermophysicalModels/specie/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/fvAgglomerationMethods/pairPatchAgglomeration/lnInclude -IlnInclude -I. -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/OpenFOAM/lnInclude -I/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/OSspecific/POSIX/lnInclude -fPIC -c wallBoundedStreamLine/wallBoundedStreamLine.C -o /share/software/OpenFOAM/OpenFOAM-v1912-ICC/build/linux64IccDPInt32Opt/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.o
wallBoundedStreamLine/wallBoundedParticleTemplates.C(121): error: no operator "==" matches these operands
operand types are: Foam::cell == const Foam::label
cell() == mesh().faceOwner()[face()]
^
/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/lagrangian/basic/lnInclude/particle.H(70): note: this candidate was rejected because arguments do not match
bool operator==(const particle&, const particle&);
^
/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/OpenFOAM/lnInclude/labelBits.H(123): note: this candidate was rejected because function is not visible
inline friend bool operator==(const labelBits& a, const labelBits& b)
^
/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/OpenFOAM/lnInclude/objectMapI.H(85): note: this candidate was rejected because arguments do not match
inline bool Foam::operator==(const objectMap& a, const objectMap& b)
^
/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/OpenFOAM/lnInclude/triFaceI.H(406): note: this candidate was rejected because arguments do not match
inline bool Foam::operator==(const triFace& a, const triFace& b)
^
(followed by lots of rejected candidates)
instantiation of "bool Foam::wallBoundedStreamLineParticle::move(TrackCloudType &, Foam::wallBoundedStreamLineParticle::trackingData &, Foam::scalar={Foam::doubleScalar={double}}) [with TrackCloudType=Foam::wallBoundedStreamLineParticleCloud]" at line 212 of "/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/lagrangian/basic/lnInclude/Cloud.C"
instantiation of "void Foam::Cloud<ParticleType>::move(TrackCloudType &, ParticleType::trackingData &, Foam::scalar={Foam::doubleScalar={double}}) [with ParticleType=Foam::wallBoundedStreamLineParticle, TrackCloudType=Foam::wallBoundedStreamLineParticleCloud]" at line 275 of "wallBoundedStreamLine/wallBoundedStreamLine.C"
wallBoundedStreamLine/wallBoundedParticleTemplates.C(138): error: no operator "=" matches these operands
operand types are: Foam::cell = Foam::label
cell() = nbrCelli;
^
detected during:
instantiation of "bool Foam::wallBoundedStreamLineParticle::move(TrackCloudType &, Foam::wallBoundedStreamLineParticle::trackingData &, Foam::scalar={Foam::doubleScalar={double}}) [with TrackCloudType=Foam::wallBoundedStreamLineParticleCloud]" at line 212 of "/share/software/OpenFOAM/OpenFOAM-v1912-ICC/src/lagrangian/basic/lnInclude/Cloud.C"
instantiation of "void Foam::Cloud<ParticleType>::move(TrackCloudType &, ParticleType::trackingData &, Foam::scalar={Foam::doubleScalar={double}}) [with ParticleType=Foam::wallBoundedStreamLineParticle, TrackCloudType=Foam::wallBoundedStreamLineParticleCloud]" at line 275 of "wallBoundedStreamLine/wallBoundedStreamLine.C"
compilation aborted for wallBoundedStreamLine/wallBoundedStreamLine.C (code 2)
make: *** [/share/software/OpenFOAM/OpenFOAM-v1912-ICC/build/linux64IccDPInt32Opt/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.o] Error 2
Environment information
OpenFOAM: v1912 (codes from https://sourceforge.net/projects/openfoam/files/v1912/OpenFOAM-v1912.tgz)
ThirdParty from https://sourceforge.net/projects/openfoam/files/v1912/ThirdParty-v1912.tgz
Intel suite: parallel_studio_xe_2020_cluster_edition
Intel icc: icc (ICC) 19.1.0.166 20191121
Intel MPI lib: for Linux* OS, Version 2019 Update 6 Build 20191024
OS Kernel: Linux version 3.10.0-1062.el7.x86_64 (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) )
OS: CentOS 7.7.1908
CPU: 72 * Intel(R) Xeon(R) Gold 6240 CPU # 2.60GHz
Solution
The problem is solved! Please refer to https://develop.openfoam.com/Development/openfoam/issues/1608.

Cygwin new user *how to generate an executable?

I just installed Cygwin -I’m new user. I’m following instructions, but I’m stuck.
I need to generate an executable of the software I want to use, which was made in c++. When I type”make” in the right directory I have a list of errors and I don’t know what they mean. It may be something with my makefile?
Here are the instructions:
“The enclosed makefile should allow Match to be built on any GNU-based compiler platform as well as many others. You may need to modify the makefile if your compiler is not named "c++" or requires different command line options. ”
Here the errors:
$ make
c++ -O4 -c match.cc -o match.o -Wall -g
In file included from match.cc:37:0:
series.hh: In member function ‘void core::insert(const point&, int)’:
series.hh:161:5: error: ‘memmove’ was not declared in this scope
memmove(&data[i+1], &data[i], sizeof(point)*(size-i-1));
^~~~~~~
series.hh:161:5: note: suggested alternative: ‘wmemmove’
memmove(&data[i+1], &data[i], sizeof(point)*(size-i-1));
^~~~~~~
wmemmove
series.hh: In member function ‘void core::erase(int)’:
series.hh:166:5: error: ‘memmove’ was not declared in this scope
memmove(&data[i], &data[i+1], sizeof(point)*(size-i-1));
^~~~~~~
series.hh:166:5: note: suggested alternative: ‘wmemmove’
memmove(&data[i], &data[i+1], sizeof(point)*(size-i-1));
^~~~~~~
wmemmove
series.hh: In member function ‘int core::averageduplicates()’:
series.hh:214:2: error: ‘memmove’ was not declared in this scope
memmove(&data[i+1],&data[j],sizeof(point)*(size-j));
^~~~~~~
series.hh:214:2: note: suggested alternative: ‘wmemmove’
memmove(&data[i+1],&data[j],sizeof(point)*(size-j));
^~~~~~~
wmemmove
series.hh: At global scope:
series.hh:239:25: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
void build_labelmap() throw(format_error) {
^~~~~
series.hh:253:44: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
int lookup_label(int label, float depth) throw(format_error) {
^~~~~
series.hh:410:50: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
void addtiept(vector<tiept> &tiemap, tiept &t) throw(format_error) {
^~~~~
series.hh:433:42: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
void buildmaps(series &s1, series &s2) throw(format_error) {
^~~~~
series.hh:474:48: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
tiepts read_tiefile(string name, ostream &log) throw(format_error);
^~~~~
series.hh:488:30: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
void apply_gaps(series &s) throw(format_error) {
^~~~~
series.hh:539:32: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
gaps read_gapfile(string name) throw(format_error);
^~~~~
make: *** [Makefile:10: match.o] Error 1
Here the makefile:
VERSION=2.3
all: match
%: %.o
c++ $^ -o $# $(LDFLAGS)
.cc.o:
# c++ -c $< -o $# -Wall -g $(CFLAGS)
c++ -O4 -c $< -o $# -Wall -g $(CFLAGS)
match: match.o series.o config.o normalize.o floatnan.o
match.o: match.cc config.hh series.hh normalize.hh floatnan.hh
series.o: series.cc series.hh floatnan.hh
config.o: config.cc config.hh floatnan.hh
normalize.o: normalize.cc normalize.hh series.hh floatnan.hh
floatnan.o: floatnan.cc floatnan.hh
clean:
rm -f *.o match *~ match.exe match.log *.new xmatch score_matrix
tar:
sed '/\S/ ! d;s/^/Match-${VERSION}\//' ../manifest > ../manifest.tmp
tar -cz -C ../.. -f ../match-${VERSION}.tgz -T ../manifest.tmp
check-manifest:
cd .. && find . -type f | sed 's/^.\///' | grep -v ,v | sort > manifest.tmp
sort ../manifest > ../manifest.tmp1
diff ../manifest.tmp1 ../manifest.tmp; true
pwd | grep 'Match-${VERSION}/' > /dev/null || (echo version mismatch; false)
Following an advice as per comment below, in the file "series.hh", I replaced "memmove" by "std::memmove".
I type "make" again, and now I get this:
$ make
c++ -O4 -c match.cc -o match.o -Wall -g
In file included from match.cc:37:0:
series.hh:9:1: error: expected unqualified-id before string constant
"//This program is distributed in the hope that it will be useful,"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/fstream:42:0,
from series.hh:36,
from match.cc:37:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:57:7: error: ‘__c_file’ does not name a type; did you mean ‘__basic_file’?
__c_file* _M_cfile;
^~~~~~~~
__basic_file
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:63:28: error: expected ‘)’ before ‘*’ token
__basic_file(__c_lock* __lock = 0) throw ();
^
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:66:41: error: ‘__c_lock’ has not been declared
__basic_file(__basic_file&& __rv, __c_lock* __lock = 0) noexcept
^~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:88:7: error: expected ‘;’ at end of member declaration
sys_open(__c_file* __file, ios_base::openmode);
^~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:88:24: error: expected ‘)’ before ‘*’ token
sys_open(__c_file* __file, ios_base::openmode);
^
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:91:60: error: ‘std::__basic_file<char>* std::__basic_file<char>::sys_open(int, std::ios_base::openmode)’ conflicts with a previous declaration
sys_open(int __fd, ios_base::openmode __mode) throw ();
^
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:88:16: note: previous declaration ‘std::__basic_file<char>* std::__basic_file<char>::sys_open’
sys_open(__c_file* __file, ios_base::openmode);
^~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:102:21: error: ‘__c_file’ does not name a type; did you mean ‘__basic_file’?
_GLIBCXX_PURE __c_file*
^~~~~~~~
__basic_file
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h: In constructor ‘std::__basic_file<char>::__basic_file(std::__basic_file<char>&&, int*)’:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:67:9: error: class ‘std::__basic_file<char>’ does not have any field named ‘_M_cfile’
: _M_cfile(__rv._M_cfile), _M_cfile_created(__rv._M_cfile_created)
^~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:67:23: error: ‘class std::__basic_file<char>’ has no member named ‘_M_cfile’; did you mean ‘__basic_file’?
: _M_cfile(__rv._M_cfile), _M_cfile_created(__rv._M_cfile_created)
^~~~~~~~
__basic_file
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:69:7: error: ‘class std::__basic_file<char>’ has no member named ‘_M_cfile’; did you mean ‘__basic_file’?
__rv._M_cfile = nullptr;
^~~~~~~~
__basic_file
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h: In member function ‘void std::__basic_file<char>::swap(std::__basic_file<char>&)’:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:79:12: error: ‘_M_cfile’ was not declared in this scope
std::swap(_M_cfile, __f._M_cfile);
^~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:79:12: note: suggested alternative: ‘_Setfill’
std::swap(_M_cfile, __f._M_cfile);
^~~~~~~~
_Setfill
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin/bits/basic_file.h:79:26: error: ‘class std::__basic_file<char>’ has no member named ‘_M_cfile’; did you mean ‘__basic_file’?
std::swap(_M_cfile, __f._M_cfile);
^~~~~~~~
__basic_file
In file included from series.hh:36:0,
from match.cc:37:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/fstream: At global scope:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/fstream:107:7: error: ‘__c_lock’ does not name a type; did you mean ‘__c_locale’?
__c_lock _M_lock;
^~~~~~~~
__c_locale
In file included from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/fstream:1081:0,
from series.hh:36,
from match.cc:37:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/fstream.tcc: In constructor ‘std::basic_filebuf<_CharT, _Traits>::basic_filebuf()’:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/fstream.tcc:80:43: error: class ‘std::basic_filebuf<_CharT, _Traits>’ does not have any field named ‘_M_lock’
basic_filebuf() : __streambuf_type(), _M_lock(), _M_file(&_M_lock),
^~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/fstream.tcc:80:63: error: ‘_M_lock’ was not declared in this scope
basic_filebuf() : __streambuf_type(), _M_lock(), _M_file(&_M_lock),
^~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/fstream.tcc:80:63: note: suggested alternative: ‘_M_seek’
basic_filebuf() : __streambuf_type(), _M_lock(), _M_file(&_M_lock),
^~~~~~~
_M_seek
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/fstream.tcc: In constructor ‘std::basic_filebuf<_CharT, _Traits>::basic_filebuf(std::basic_filebuf<_CharT, _Traits>&&)’:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/fstream.tcc:97:5: error: class ‘std::basic_filebuf<_CharT, _Traits>’ does not have any field named ‘_M_lock’
_M_lock(), _M_file(std::move(__rhs._M_file), &_M_lock),
^~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/fstream.tcc:97:51: error: ‘_M_lock’ was not declared in this scope
_M_lock(), _M_file(std::move(__rhs._M_file), &_M_lock),
^~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/fstream.tcc:97:51: note: suggested alternative: ‘_M_seek’
_M_lock(), _M_file(std::move(__rhs._M_file), &_M_lock),
^~~~~~~
_M_seek
In file included from match.cc:37:0:
series.hh: At global scope:
series.hh:43:1: error: expected unqualified-id before string constant
"#include ""assert.h"""
^~~~~~~~~~~
series.hh:62:1: error: expected unqualified-id before string constant
" float x, y;"
^~~~~~~~~~~~~~~
series.hh:67:1: error: expected unqualified-id before string constant
"static float intervalmap(float i1b, float i1e, float i2b, "
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
series.hh:70:1: error: expected declaration before ‘}’ token
}
^
make: *** [Makefile:10: match.o] Error 1
What should I do?
Alp

How do I FFI a CUDA application on Haskell?

I've ported a Haskell application to CUDA in order to accelerate it. Now, I have a .cu file which I want to use from Haskell as an API. I've managed to FFI C files easily following the tutorials, but I'm not sure how this applies to CUDA/nvcc. How do I do it?
For completion, this is what I get trying to treat the .cu as a normal .c file:
vh:CUDA apple1$ nvcc hello.cu -c -o hello.o
vh:CUDA apple1$ ghc test.hs -o test hello.o
Linking test ...
Undefined symbols for architecture x86_64:
"___cudaRegisterFatBinary", referenced from:
__sti____cudaRegisterAll_40_tmpxft_00002168_00000000_7_hello_cpp1_ii_f33df8d2() in hello.o
"___cudaRegisterFunction", referenced from:
__nv_cudaEntityRegisterCallback(void**) in hello.o
"___cudaUnregisterFatBinary", referenced from:
__cudaUnregisterBinaryUtil() in hello.o
"_cudaConfigureCall", referenced from:
render(Renderer_*) in hello.o
"_cudaFree", referenced from:
renderer_free(Renderer_*) in hello.o
"_cudaLaunch", referenced from:
cudaError cudaLaunch<char>(char*) in hello.o
"_cudaMalloc", referenced from:
renderer_init(Renderer_*, float, float, float, float, float) in hello.o
"_cudaMemcpy", referenced from:
renderer_init(Renderer_*, float, float, float, float, float) in hello.o
render(Renderer_*) in hello.o
"_cudaSetupArgument", referenced from:
__device_stub__Z4walk6float3PiS_S_S_S_S0_(float3&, int*, float3&, float3&, float3&, float3&, int*) in hello.o
"_hello", referenced from:
_r3yw_info in test.o
_c3Ib_info in test.o
_c3Il_info in test.o
(maybe you meant: _Main_hello_closure, _Main_hello_info )
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And that is my Haskell file:
{-# LANGUAGE ForeignFunctionInterface #-}
module Main where
import Foreign.C
import Foreign.Ptr (Ptr,nullPtr)
foreign import ccall "hello" hello :: IO ()
main = hello
I managed to solve it by adding extern "C" to all functions on hello.cu:
-- hello.cu
extern "C"
void hello();
Compiling the CUDA file with:
nvcc -c hello.cu
And the Haskell file with:
ghc --make test.hs -o test hello.o -L/usr/local/cuda/lib -optl-lcudart

macosx thread explicitly marked deleted

I'm building an application with C++11 threads, but I can't seem to get it to work with clang++ on MacOSX 10.9. Here is the simplest example I can find that causes the issues:
#include <thread>
#include <iostream>
class Functor {
public:
Functor() = default;
Functor (const Functor& ) = delete;
void execute () {
std::cerr << "running in thread\n";
}
};
int main (int argc, char* argv[])
{
Functor functor;
std::thread thread (&Functor::execute, std::ref(functor));
thread.join();
}
This compiles and runs fine on Arch Linux using g++ (version 4.9.2) with the following command-line:
$ g++ -std=c++11 -Wall -pthread test_thread.cpp -o test_thread
It also compiles and runs fine using clang++ (version 3.5.0, also on Arch Linux):
$ clang++ -std=c++11 -Wall -pthread test_thread.cpp -o test_thread
But fails on MacOSX 10.9.5, using XCode 6.1 (regardless of whether I include the -stdlib=libc++ option):
$ clang++ -std=c++11 -Wall -pthread test_thread.cpp -o test_thread
In file included from test_thread.cpp:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread:332:5: error: attempt to use a deleted function
__invoke(_VSTD::move(_VSTD::get<0>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread:342:5: note: in instantiation of function template specialization
'std::__1::__thread_execute<void (Functor::*)(), std::__1::reference_wrapper<Functor> , 1>' requested here
__thread_execute(*__p, _Index());
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread:354:42: note: in instantiation of function template specialization
'std::__1::__thread_proxy<std::__1::tuple<void (Functor::*)(), std::__1::reference_wrapper<Functor> > >' requested here
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Gp>, __p.get());
^
test_thread.cpp:19:15: note: in instantiation of function template specialization 'std::__1::thread::thread<void (Functor::*)(), std::__1::reference_wrapper<Functor> , void>'
requested here
std::thread thread (&Functor::execute, std::ref(functor));
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:1001:5: note: '~__nat' has been explicitly marked deleted
here
~__nat() = delete;
^
1 error generated.
I can't figure out how to get around this, it seems like a compiler bug to me. For reference, the version of clang on that Mac is:
$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
Any ideas what it is I'm doing wrong?
Thanks!
Donald.
The standard does not require the std::thread constructor - or the similar std::async for that matter - to unwrap a reference_wrapper when passed as the first argument with a pointer-to-member-function the way std::bind does. Pass a pointer to Functor instead of a reference_wrapper. (See Library Active Issues list DR2219.)

can't build wxwidgets on Cygwin: ambiguous overload for ‘operator[]’ basedll_apebase.o error

I'm willing to bet I'm not configuring it right, but it's not brief on how I need to for wxWidgets_3_0
I get the following error:
$ make
/home/Bill/WX_3_0_BRANCH/build-debug/bk-deps g++ -c -o basedll_appbase.o -D__WXM SW__ -DWXBUILDING -I/home/Tom/WX_3_0_BRANCH/build-debug/src/tiff/libtiff -I ../src/tiff/libtiff -I../src/jpeg -I../src/png -I../src/zlib -I../src/regex -I.. /src/expat/lib -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -Wall -Wundef -W unused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS =64 -I/home/Tom/WX_3_0_BRANCH/build-debug/lib/wx/include/msw-unicode-3.0 -I../in clude -O2 -fno-strict-aliasing ../src/common/appbase.cpp
In file included from ../src/common/appbase.cpp:42:0:
../include/wx/filename.h: In static member function ‘static wxUniChar wxFileName ::GetPathSeparator(wxPathFormat)’:
../include/wx/filename.h:473:43: error: ambiguous overload for ‘operator[]’ (ope rand types are ‘wxString’ and ‘unsigned int’)
{ return GetPathSeparators(format)[0u]; }
In file included from ../include/wx/memory.h:15:0,
from ../include/wx/object.h:19,
from ../include/wx/list.h:32,
from ../src/common/appbase.cpp:30:
../include/wx/string.h:1544:15: note: wxUniChar wxString::operator[](int) const
wxUniChar operator[](int n) const
^
../include/wx/string.h:1546:15: note: wxUniChar wxString::operator[](long int) c onst
wxUniChar operator[](long n) const
^
../include/wx/string.h:1548:15: note: wxUniChar wxString::operator[](size_t) con st
wxUniChar operator[](size_t n) const
^
../include/wx/string.h:1556:18: note: wxUniCharRef wxString::operator[](int)
wxUniCharRef operator[](int n)
^
../include/wx/string.h:1558:18: note: wxUniCharRef wxString::operator[](long int )
wxUniCharRef operator[](long n)
^
../include/wx/string.h:1560:18: note: wxUniCharRef wxString::operator[](size_t)
wxUniCharRef operator[](size_t n)
^
Makefile:28650: recipe for target 'basedll_appbase.o' failed
make: *** [basedll_appbase.o] Error 1
This is what's in the makefile on that line:
basedll_appbase.o: $(srcdir)/src/common/appbase.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $# $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/appbase.cpp
This is a known bug, but I thought it affected only wxGTK and hence it had a low priority (because subset of people using wxGTK under Cygwin is vanishingly small). If it affects wxMSW as well, it would be nice to fix it, especially as it shouldn't be difficult, and we'll try to do it for the next 3.0.1 release.
Seems that long, unsigned int, and size_t are all expected to exist as different function signatures
So the fix for this case was to add a cast of size_t to any ambiguous overload errors with 0u or 1u.
Here's on example: in the filename.h I edited its source code:
// get the canonical path separator for this format
static wxUniChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE)
{ return GetPathSeparators(format)[0u]; }
to
// get the canonical path separator for this format
static wxUniChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE)
{ return GetPathSeparators(format)[(size_t)0u]; }
The second thing I had to do was configure for my 64 bit windows
../configure --host=i686-w64-mingw32 --build=i686-pc-cygwin

Resources