andre-martins / AD3

Alternating Directions Dual Decomposition
GNU Lesser General Public License v3.0
68 stars 38 forks source link

Can not compile on MacOS High Sierra, using Python 3.10 #27

Open charlesmartin14 opened 2 years ago

charlesmartin14 commented 2 years ago

Can not compile on MacOS High Sierra, using Python 3.10

cpp --version Apple LLVM version 9.0.0 (clang-900.0.38) Target: x86_64-apple-darwin17.7.0

Here's the error message:

building 'ad3.factor_graph' extension clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/charleshmartin/anaconda3/envs/ssvm/include -fPIC -O2 -isystem /Users/charleshmartin/anaconda3/envs/ssvm/include -I. -Iad3 -I/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10 -c python/ad3/factor_graph.cpp -o build/temp.macosx-10.9-x86_64-3.10/python/ad3/factor_graph.o -O3 -Wall -Wno-sign-compare -Wno-overloaded-virtual -c -fmessage-length=0 -fPIC -ffast-math -march=native python/ad3/factor_graph.cpp:19366:5: error: expression is not assignable ++Py_REFCNT(o); ^ ~~~~ python/ad3/factor_graph.cpp:19368:5: error: expression is not assignable --Py_REFCNT(o); ^ ~~~~ python/ad3/factor_graph.cpp:19492:5: error: expression is not assignable ++Py_REFCNT(o); ^ ~~~~ python/ad3/factor_graph.cpp:19494:5: error: expression is not assignable --Py_REFCNT(o); ^ ~~~~ python/ad3/factor_graph.cpp:19781:5: error: expression is not assignable ++Py_REFCNT(o); ^ ~~~~ python/ad3/factor_graph.cpp:19783:5: error: expression is not assignable --Py_REFCNT(o); ^ ~~~~ python/ad3/factor_graph.cpp:20020:5: error: expression is not assignable ++Py_REFCNT(o); ^ ~~~~ python/ad3/factor_graph.cpp:20022:5: error: expression is not assignable --Py_REFCNT(o); ^ ~~~~ python/ad3/factor_graph.cpp:20824:47: error: no member named 'tp_print' in '_typeobject' __pyx_type_3ad3_12factor_graph_PFactorGraph.tp_print = 0;


python/ad3/factor_graph.cpp:20831:26: error: no member named 'tp_print' in '_typeobject'
  __pyx_type___pyx_array.tp_print = 0;
  ~~~~~~~~~~~~~~~~~~~~~~ ^
python/ad3/factor_graph.cpp:20836:32: error: no member named 'tp_print' in '_typeobject'
  __pyx_type___pyx_MemviewEnum.tp_print = 0;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
python/ad3/factor_graph.cpp:20848:31: error: no member named 'tp_print' in '_typeobject'
  __pyx_type___pyx_memoryview.tp_print = 0;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
python/ad3/factor_graph.cpp:20858:36: error: no member named 'tp_print' in '_typeobject'
  __pyx_type___pyx_memoryviewslice.tp_print = 0;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
python/ad3/factor_graph.cpp:21583:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
      PyUnicode_WSTR_LENGTH(op) :                    \
      ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21583:22: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
      ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
             ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21583:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
       PyUnicode_WSTR_LENGTH(op)))
       ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21583:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                   ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
      PyUnicode_WSTR_LENGTH(op) :                    \
      ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21583:52: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                   ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
      ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
             ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21583:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                   ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
       PyUnicode_WSTR_LENGTH(op)))
       ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21599:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
      PyUnicode_WSTR_LENGTH(op) :                    \
      ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21599:26: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
      ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
             ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21599:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
       PyUnicode_WSTR_LENGTH(op)))
       ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21599:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                          ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
      PyUnicode_WSTR_LENGTH(op) :                    \
      ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21599:59: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                          ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
      ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
             ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:21599:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                          ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
       PyUnicode_WSTR_LENGTH(op)))
       ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                  ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
python/ad3/factor_graph.cpp:22132:16: warning: 'PyUnicode_FromUnicode' is deprecated [-Wdeprecated-declarations]
        return PyUnicode_FromUnicode(NULL, 0);
               ^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/cpython/unicodeobject.h:551:1: note: 'PyUnicode_FromUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
^
/Users/charleshmartin/anaconda3/envs/ssvm/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
tskoba commented 2 years ago

On macOS Big Sur(11.6.4) and python 3.9.10, I had a similar problem. I found the following two workarounds to solve it:

  1. to update bindings for python, by running

    pip install cython
    cd python/ad3
    cython *.pyx --cplus

    as written in https://github.com/andre-martins/AD3/tree/master/python I think this is the workaround for the error: python/ad3/factor_graph.cpp:20831:26: error: no member named 'tp_print' in '_typeobject'

  2. to link correctly libad3.a, by apply patch to setup.py as

    
    @@ -50,6 +50,7 @@ class our_build_ext(build_ext):
    
         for e in self.extensions:
             e.extra_compile_args.extend(compile_args)
    +            e.extra_link_args.append('-Lad3')
    
         build_ext.build_extensions(self)