Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Build failure due to GCC deprecation warnings #33

Closed
nicholasserra opened this issue Jul 31, 2014 · 5 comments
Closed

Build failure due to GCC deprecation warnings #33

nicholasserra opened this issue Jul 31, 2014 · 5 comments

Comments

@nicholasserra
Copy link

Saw this when installing via pip in a Travis.ci build. I was able to resolve it by setting the env variable CFLAGS="-Wno-error", but figured I'd post this as a reference for the warnings. Thanks!

Python 2.6.9
travis_time:finish:start=1406830035331541823,finish=1406830035366262833,duration=34721010
�[0Ktravis_time:start
�[0K$ pip --version
pip 1.5.4 from /home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages (python 2.6)
travis_time:finish:start=1406830035376107682,finish=1406830036488618693,duration=1112511011
�[0Ktravis_fold:start:install
�[0Ktravis_time:start
�[0K$ pip install -r requirements.txt
Downloading/unpacking umemcache==1.6.3 (from -r requirements.txt (line 1))
  Downloading umemcache-1.6.3.zip
  Running setup.py (path:/home/travis/virtualenv/python2.6.9/build/umemcache/setup.py) egg_info for package umemcache
Installing collected packages: umemcache
  Running setup.py install for umemcache
    building 'umemcache' extension
    gcc -pthread -fno-strict-aliasing -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWIN32_LEAN_AND_MEAN -I./lib/ -I/opt/python/2.6.9/include/python2.6 -c ./python/umemcache.cpp -o build/temp.linux-x86_64-2.6/./python/umemcache.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
    ./python/umemcache.cpp: In function ‘int Client_init(PyClient*, PyObject*, PyObject*)’:
    ./python/umemcache.cpp:255:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:255:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp: In function ‘PyObject* Client_incr(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:822:62: error: format not a string literal and no format arguments [-Werror=format-security]
    ./python/umemcache.cpp: In function ‘PyObject* Client_decr(PyClient*, PyObject*)’:
    ./python/umemcache.cpp:870:62: error: format not a string literal and no format arguments [-Werror=format-security]
    ./python/umemcache.cpp: At global scope:
    ./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python/umemcache.cpp: In function ‘void initumemcache()’:
    ./python/umemcache.cpp:1124:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    cc1plus: some warnings being treated as errors
    error: command 'gcc' failed with exit status 1
    Complete output from command /home/travis/virtualenv/python2.6.9/bin/python -c "import setuptools, tokenize;__file__='/home/travis/virtualenv/python2.6.9/build/umemcache/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-IvrdDE-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/travis/virtualenv/python2.6.9/include/site/python2.6:
    running install

running build

running build_ext

building 'umemcache' extension

creating build

creating build/temp.linux-x86_64-2.6

creating build/temp.linux-x86_64-2.6/python

creating build/temp.linux-x86_64-2.6/lib

gcc -pthread -fno-strict-aliasing -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWIN32_LEAN_AND_MEAN -I./lib/ -I/opt/python/2.6.9/include/python2.6 -c ./python/umemcache.cpp -o build/temp.linux-x86_64-2.6/./python/umemcache.o

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]

./python/umemcache.cpp: In function ‘int Client_init(PyClient*, PyObject*, PyObject*)’:

./python/umemcache.cpp:255:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./python/umemcache.cpp:255:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./python/umemcache.cpp: In function ‘PyObject* Client_incr(PyClient*, PyObject*)’:

./python/umemcache.cpp:822:62: error: format not a string literal and no format arguments [-Werror=format-security]

./python/umemcache.cpp: In function ‘PyObject* Client_decr(PyClient*, PyObject*)’:

./python/umemcache.cpp:870:62: error: format not a string literal and no format arguments [-Werror=format-security]

./python/umemcache.cpp: At global scope:

./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./python/umemcache.cpp:1056:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./python/umemcache.cpp: In function ‘void initumemcache()’:

./python/umemcache.cpp:1124:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

cc1plus: some warnings being treated as errors

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
�[31mCommand /home/travis/virtualenv/python2.6.9/bin/python -c "import setuptools, tokenize;__file__='/home/travis/virtualenv/python2.6.9/build/umemcache/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-IvrdDE-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/travis/virtualenv/python2.6.9/include/site/python2.6 failed with error code 1 in /home/travis/virtualenv/python2.6.9/build/umemcache
�[0mTraceback (most recent call last):
  File "/home/travis/virtualenv/python2.6.9/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)
travis_time:finish:start=1406830036508166748,finish=1406830040485105172,duration=3976938424
�[0K
�[31;1mThe command "pip install -r requirements.txt" failed and exited with 1 during .�[0m

Your build has been stopped.
@tadumtada
Copy link

tadumtada commented Jan 13, 2017

for anyone as stupid as me, who didn't understand it, simply type:
CFLAGS=-Wno-error pip install umemcache

@Natim
Copy link

Natim commented Feb 17, 2017

I am having a similar issue today and @tadumtada is not sufficient:

    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wno-error -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWIN32_LEAN_AND_MEAN -I./lib/ -I/usr/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

@Natim
Copy link

Natim commented Feb 21, 2017

I even tried: CFLAGS="-Wno-error -Wno-error=write-strings -fpermissive" bin/pip install umemcache

@Natim
Copy link

Natim commented Feb 22, 2017

Should be fixed by #37

@Jahaja
Copy link
Member

Jahaja commented Feb 22, 2017

I hope so, I'll close the issue but feel free to reopen if it doesn't.

@Jahaja Jahaja closed this as completed Feb 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants