Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

umemcache compilation error (again) #103

Open
Natim opened this issue Feb 21, 2017 · 6 comments
Open

umemcache compilation error (again) #103

Natim opened this issue Feb 21, 2017 · 6 comments
Labels

Comments

@Natim
Copy link
Contributor

Natim commented Feb 21, 2017

I tried adding -fpermissive to the CFLAGS with no luck. Any idea?

Failed to build umemcache
Installing collected packages: umemcache
  Running setup.py install for umemcache ... error
    Complete output from command /home/rhubscher/mozilla/tokenserver/.tox/py35/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d63ffn1t/umemcache/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-wmihseb0-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/rhubscher/mozilla/tokenserver/.tox/py35/include/site/python3.5/umemcache:
    running install
    running build
    running build_ext
    building 'umemcache' extension
    creating build
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/python
    creating build/temp.linux-x86_64-3.5/lib
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wno-error -Wno-error=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWIN32_LEAN_AND_MEAN -I./lib/ -I/usr/include/python3.5m -I/home/rhubscher/mozilla/tokenserver/.tox/py35/include/python3.5m -c ./python/umemcache.cpp -o build/temp.linux-x86_64-3.5/./python/umemcache.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    ./python/umemcache.cpp: In function ‘int API_send(SOCKETDESC*, void*, size_t)’:
    ./python/umemcache.cpp:85:39: error: ‘PyString_FromString’ was not declared in this scope
       funcStr = PyString_FromString("send");
                                           ^
    ./python/umemcache.cpp:86:63: error: ‘PyString_FromStringAndSize’ was not declared in this scope
       pybuffer = PyString_FromStringAndSize( (char *) data, cbData);
                                                                   ^
    ./python/umemcache.cpp:96:31: error: ‘PyInt_AsLong’ was not declared in this scope
       ret = (int) PyInt_AsLong(res);
                                   ^
    ./python/umemcache.cpp: In function ‘int API_recv(SOCKETDESC*, void*, size_t)’:
    ./python/umemcache.cpp:118:39: error: ‘PyString_FromString’ was not declared in this scope
       funcStr = PyString_FromString("recv");
                                           ^
    ./python/umemcache.cpp:119:37: error: ‘PyInt_FromLong’ was not declared in this scope
       bufSize = PyInt_FromLong(cbMaxData);
                                         ^
    ./python/umemcache.cpp:129:36: error: ‘PyString_GET_SIZE’ was not declared in this scope
       ret = (int) PyString_GET_SIZE(res);
                                        ^
    ./python/umemcache.cpp:130:39: error: ‘PyString_AS_STRING’ was not declared in this scope
       memcpy (data, PyString_AS_STRING(res), ret);
                                           ^
    In file included from /usr/include/python3.5m/Python.h:85:0,
                     from ./python/umemcache.cpp:32:
    ./python/umemcache.cpp: In function ‘int API_connect(SOCKETDESC*, const char*, int)’:
    ./python/umemcache.cpp:158:56: error: ‘PyInt_FromLong’ was not declared in this scope
       PyTuple_SET_ITEM(args, 1, PyInt_FromLong(client->port));
                                                            ^
    /usr/include/python3.5m/tupleobject.h:62:75: note: in definition of macro ‘PyTuple_SET_ITEM’
     #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
                                                                               ^
    ./python/umemcache.cpp:159:51: error: ‘PyString_FromString’ was not declared in this scope
       PyObject *method = PyString_FromString("connect");
                                                       ^
    ./python/umemcache.cpp: In function ‘int Client_init(PyClient*, PyObject*, PyObject*)’:
    ./python/umemcache.cpp:255:60: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
       static char *kwlist[] = {"address", "max_item_size", NULL};
                                                                ^
    ./python/umemcache.cpp:255:60: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:275:70: error: ‘PyString_FromStringAndSize’ was not declared in this scope
       self->host = PyString_FromStringAndSize(address, (offset - address));
                                                                          ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_connect(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:312:60: error: ‘PyString_AS_STRING’ was not declared in this scope
       if (!self->client->connect (PyString_AS_STRING(self->host), self->port))
                                                                ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_command(PyClient*, PFN_COMMAND, PyObject*)’:
    ./python/umemcache.cpp:373:58: error: ‘PyString_FromStringAndSize’ was not declared in this scope
           return PyString_FromStringAndSize(pResult, cbResult);
                                                              ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_get(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:447:62: error: ‘PyString_FromStringAndSize’ was not declared in this scope
       PyObject *ovalue = PyString_FromStringAndSize(pData, cbData);
                                                                  ^
    ./python/umemcache.cpp:448:42: error: ‘PyInt_FromLong’ was not declared in this scope
       PyObject *oflags = PyInt_FromLong(flags);
                                              ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_gets(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:510:62: error: ‘PyString_FromStringAndSize’ was not declared in this scope
       PyObject *ovalue = PyString_FromStringAndSize(pData, cbData);
                                                                  ^
    ./python/umemcache.cpp:511:42: error: ‘PyInt_FromLong’ was not declared in this scope
       PyObject *oflags = PyInt_FromLong(flags);
                                              ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_get_multi(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:561:27: error: ‘PyString_Check’ was not declared in this scope
         if (PyString_Check(arg))
                               ^
    ./python/umemcache.cpp:570:54: error: ‘PyString_AS_STRING’ was not declared in this scope
         self->client->getKeyWrite(PyString_AS_STRING(ostr), PyString_GET_SIZE(ostr));
                                                          ^
    ./python/umemcache.cpp:570:79: error: ‘PyString_GET_SIZE’ was not declared in this scope
         self->client->getKeyWrite(PyString_AS_STRING(ostr), PyString_GET_SIZE(ostr));
                                                                                   ^
    ./python/umemcache.cpp:588:61: error: ‘PyString_FromStringAndSize’ was not declared in this scope
         PyObject *okey  = PyString_FromStringAndSize(pKey, cbKey);
                                                                 ^
    ./python/umemcache.cpp:591:44: error: ‘PyInt_FromLong’ was not declared in this scope
         PyObject *oflags = PyInt_FromLong(flags);
                                                ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_gets_multi(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:642:27: error: ‘PyString_Check’ was not declared in this scope
         if (PyString_Check(arg))
                               ^
    ./python/umemcache.cpp:651:54: error: ‘PyString_AS_STRING’ was not declared in this scope
         self->client->getKeyWrite(PyString_AS_STRING(ostr), PyString_GET_SIZE(ostr));
                                                          ^
    ./python/umemcache.cpp:651:79: error: ‘PyString_GET_SIZE’ was not declared in this scope
         self->client->getKeyWrite(PyString_AS_STRING(ostr), PyString_GET_SIZE(ostr));
                                                                                   ^
    ./python/umemcache.cpp:669:61: error: ‘PyString_FromStringAndSize’ was not declared in this scope
         PyObject *okey  = PyString_FromStringAndSize(pKey, cbKey);
                                                                 ^
    ./python/umemcache.cpp:672:44: error: ‘PyInt_FromLong’ was not declared in this scope
         PyObject *oflags = PyInt_FromLong(flags);
                                                ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_delete(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:729:58: error: ‘PyString_FromStringAndSize’ was not declared in this scope
           return PyString_FromStringAndSize(pResult, cbResult);
                                                              ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_cas(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:776:58: error: ‘PyString_FromStringAndSize’ was not declared in this scope
           return PyString_FromStringAndSize(pResult, cbResult);
                                                              ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_incr(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:825:58: error: ‘PyString_FromStringAndSize’ was not declared in this scope
           return PyString_FromStringAndSize(pResult, cbResult);
                                                              ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_decr(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:873:58: error: ‘PyString_FromStringAndSize’ was not declared in this scope
           return PyString_FromStringAndSize(pResult, cbResult);
                                                              ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_version(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:894:56: error: ‘PyString_FromStringAndSize’ was not declared in this scope
       return PyString_FromStringAndSize(pVersion, cbVersion);
                                                            ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_stats(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:913:64: error: ‘PyString_FromStringAndSize’ was not declared in this scope
         PyObject *oname  = PyString_FromStringAndSize(pName, cbName);
                                                                    ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_flush_all(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:950:58: error: ‘PyString_FromStringAndSize’ was not declared in this scope
           return PyString_FromStringAndSize(pResult, cbResult);
                                                              ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_set_timeout(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:971:54: error: ‘PyString_FromString’ was not declared in this scope
       PyObject *method = PyString_FromString("settimeout");
                                                          ^
    ./python/umemcache.cpp: In function ‘PyObject* Client_get_timeout(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:984:54: error: ‘PyString_FromString’ was not declared in this scope
       PyObject *method = PyString_FromString("gettimeout");
                                                          ^
    ./python/umemcache.cpp: At global scope:
    ./python/umemcache.cpp:1056:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     };
     ^
    ./python/umemcache.cpp:1056:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1101:1: error: invalid conversion from ‘const char*’ to ‘Py_ssize_t {aka long int}’ [-fpermissive]
     };
     ^
    ./python/umemcache.cpp:1065:3: error: invalid conversion from ‘destructor {aka void (*)(_object*)}’ to ‘printfunc {aka int (*)(_object*, _IO_FILE*, int)}’ [-fpermissive]
       (destructor) Client_Destructor,        /* tp_dealloc     */
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.5m/pytime.h:6:0,
                     from /usr/include/python3.5m/Python.h:65,
                     from ./python/umemcache.cpp:32:
    /usr/include/python3.5m/object.h:653:46: error: invalid conversion from ‘long unsigned int’ to ‘const char*’ [-fpermissive]
     #define Py_TPFLAGS_DEFAULT  ( \
                                 ~~~
                      Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      Py_TPFLAGS_HAVE_VERSION_TAG | \
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
                     0)
                     ~~
    ./python/umemcache.cpp:1080:3: note: in expansion of macro ‘Py_TPFLAGS_DEFAULT’
       Py_TPFLAGS_DEFAULT,        /* tp_flags       */
       ^~~~~~~~~~~~~~~~~~
    ./python/umemcache.cpp:1101:1: error: cannot convert ‘const char*’ to ‘traverseproc {aka int (*)(_object*, int (*)(_object*, void*), void*)}’ in initialization
     };
     ^
    ./python/umemcache.cpp:1101:1: error: cannot convert ‘PyMethodDef*’ to ‘PyMemberDef*’ in initialization
    ./python/umemcache.cpp:1101:1: error: cannot convert ‘PyMemberDef*’ to ‘PyGetSetDef*’ in initialization
    ./python/umemcache.cpp:1100:3: error: invalid conversion from ‘initproc {aka int (*)(_object*, _object*, _object*)}’ to ‘allocfunc {aka _object* (*)(_typeobject*, long int)}’ [-fpermissive]
       (initproc)Client_init,  /* tp_init           */
       ^~~~~~~~~~~~~~~~~~~~~
    ./python/umemcache.cpp: In function ‘PyObject* initumemcache()’:
    ./python/umemcache.cpp:1113:46: error: ‘Py_InitModule3’ was not declared in this scope
       m = Py_InitModule3("umemcache", methods, "");
                                                  ^
    ./python/umemcache.cpp:1115:5: error: return-statement with no value, in function returning ‘PyObject* {aka _object*}’ [-fpermissive]
         return;
         ^~~~~~
    ./python/umemcache.cpp:1119:5: error: return-statement with no value, in function returning ‘PyObject* {aka _object*}’ [-fpermissive]
         return;
         ^~~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
@rfk rfk added the backlog label Sep 6, 2018
@okin
Copy link
Contributor

okin commented Oct 2, 2018

umemcache does only support Python 2 but from the provided log it appears that you are trying to compile it for Python 3.5.

@okin
Copy link
Contributor

okin commented Oct 6, 2018

umemcache does only support Python 2 but from the provided log it appears that you are trying to compile it for Python 3.5.

I was wrong on here and umemcache seems to be running with Python 3 aswell.
But it requires some special CFLAGS.

@Natim Today I learned about de87689 which did fix compilation problems for me. I think this commit is actually one of yours ;)

@Natim
Copy link
Contributor Author

Natim commented Oct 7, 2018

It is one of my commit, but it already landed in master didn't it?

@okin
Copy link
Contributor

okin commented Oct 7, 2018

@Natim it landed there and I have to apologise: Appearantly I got carried away by some Travis runs with Python 3.x but didn't realise that not Python 3 but 2.x was used for their execution. Sorry for this!

umemcache on Python 3 fails as the module does not seem to support the Python 3 module initialization.
The project appears to be abandoned on GitHub. I think it's fair to see that there probably won't be any support for Python 3 coming soon.

I think ultimately mozservices should settle on another library for providing the memcache functionality under Python 3.
I opened the following issue over there: mozilla-services/mozservices/issues/41
Any thoughts on this?

@Natim
Copy link
Contributor Author

Natim commented Oct 8, 2018

What about porting umemcache to python3 altogether and maintaining it? It's a simple layer on top of a C library not something complex nor cumbersome. esnme/ultramemcache#38

@okin
Copy link
Contributor

okin commented Oct 8, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants