Skip to content

Compilation errors when installing from PyPi and git #37

Closed

Description

@thedrow
Collecting git+https://github.com/kenrobbins/python-rapidjson
  Cloning https://github.com/kenrobbins/python-rapidjson to /tmp/pip-54hC76-build
Installing collected packages: python-rapidjson
  Running setup.py install for python-rapidjson
    Complete output from command /home/omer/.virtualenvs/playground/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-54hC76-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-RoOWJP-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/omer/.virtualenvs/playground/include/site/python2.7/python-rapidjson:
    running install
    running build
    running build_ext
    building 'rapidjson' extension
    creating build
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/python-rapidjson
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./thirdparty/rapidjson/include -I/home/omer/.pyenv/versions/2.7.10/include/python2.7 -c ./python-rapidjson/rapidjson.cpp -o build/temp.linux-x86_64-2.7/./python-rapidjson/rapidjson.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    ./python-rapidjson/rapidjson.cpp: In member function ‘bool PyHandler::NaN()’:
    ./python-rapidjson/rapidjson.cpp:199:43: error: too few arguments to function ‘PyObject* PyFloat_FromString(PyObject*, char**)’
                 value = PyFloat_FromString(str);
                                               ^
    In file included from /home/omer/.pyenv/versions/2.7.10/include/python2.7/Python.h:89:0,
                     from ./python-rapidjson/rapidjson.cpp:1:
    /home/omer/.pyenv/versions/2.7.10/include/python2.7/floatobject.h:48:24: note: declared here
     PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk);
                            ^
    ./python-rapidjson/rapidjson.cpp: In member function ‘bool PyHandler::Infinity(bool)’:
    ./python-rapidjson/rapidjson.cpp:229:43: error: too few arguments to function ‘PyObject* PyFloat_FromString(PyObject*, char**)’
                 value = PyFloat_FromString(str);
                                               ^
    In file included from /home/omer/.pyenv/versions/2.7.10/include/python2.7/Python.h:89:0,
                     from ./python-rapidjson/rapidjson.cpp:1:
    /home/omer/.pyenv/versions/2.7.10/include/python2.7/floatobject.h:48:24: note: declared here
     PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk);
                            ^
    ./python-rapidjson/rapidjson.cpp: In function ‘PyObject* rapidjson_loads(PyObject*, PyObject*, PyObject*)’:
    ./python-rapidjson/rapidjson.cpp:342:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
         };
         ^
    ./python-rapidjson/rapidjson.cpp:342:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:342:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:342:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:342:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:366:66: error: ‘PyUnicode_AsUTF8AndSize’ was not declared in this scope
             jsonStr = PyUnicode_AsUTF8AndSize(jsonObject, &jsonStrLen);
                                                                      ^
    ./python-rapidjson/rapidjson.cpp:401:47: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                     emsg = PyUnicode_AsUTF8(evalue);
                                                   ^
    ./python-rapidjson/rapidjson.cpp: In function ‘PyObject* rapidjson_dumps_internal(WriterT*, BufferT*, PyObject*, int, int, PyObject*, int, int, unsigned int, DatetimeMode)’:
    ./python-rapidjson/rapidjson.cpp:513:68: error: there are no arguments to ‘PyUnicode_AsUTF8AndSize’ that depend on a template parameter, so a declaration of ‘PyUnicode_AsUTF8AndSize’ must be available [-fpermissive]
                 char* decStr = PyUnicode_AsUTF8AndSize(decStrObj, &size);
                                                                        ^
    ./python-rapidjson/rapidjson.cpp:513:68: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
    ./python-rapidjson/rapidjson.cpp:571:46: error: there are no arguments to ‘PyUnicode_AsUTF8’ that depend on a template parameter, so a declaration of ‘PyUnicode_AsUTF8’ must be available [-fpermissive]
                 char* s = PyUnicode_AsUTF8(object);
                                                  ^
    ./python-rapidjson/rapidjson.cpp:607:61: error: there are no arguments to ‘PyUnicode_AsUTF8’ that depend on a template parameter, so a declaration of ‘PyUnicode_AsUTF8’ must be available [-fpermissive]
                             char* key_str = PyUnicode_AsUTF8(key);
                                                                 ^
    ./python-rapidjson/rapidjson.cpp:622:61: error: there are no arguments to ‘PyUnicode_AsUTF8’ that depend on a template parameter, so a declaration of ‘PyUnicode_AsUTF8’ must be available [-fpermissive]
                             char* key_str = PyUnicode_AsUTF8(key);
                                                                 ^
    ./python-rapidjson/rapidjson.cpp:721:95: error: there are no arguments to ‘PyUnicode_AsUTF8’ that depend on a template parameter, so a declaration of ‘PyUnicode_AsUTF8’ must be available [-fpermissive]
                 PyErr_Format(PyExc_TypeError, "%s is not JSON serializable", PyUnicode_AsUTF8(repr));
                                                                                                   ^
    ./python-rapidjson/rapidjson.cpp: In function ‘PyObject* rapidjson_dumps(PyObject*, PyObject*, PyObject*)’:
    ./python-rapidjson/rapidjson.cpp:781:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
         };
         ^
    ./python-rapidjson/rapidjson.cpp:781:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:781:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:781:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:781:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:781:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:781:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:781:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:781:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp:781:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ./python-rapidjson/rapidjson.cpp: At global scope:
    ./python-rapidjson/rapidjson.cpp:852:8: error: ‘PyModuleDef’ does not name a type
     static PyModuleDef rapidjson_module = {
            ^
    In file included from /usr/include/locale.h:28:0,
                     from /usr/include/c++/5/clocale:42,
                     from /usr/include/x86_64-linux-gnu/c++/5/bits/c++locale.h:41,
                     from /usr/include/c++/5/bits/localefwd.h:40,
                     from /usr/include/c++/5/string:43,
                     from ./python-rapidjson/rapidjson.cpp:5:
    ./python-rapidjson/rapidjson.cpp: In function ‘void PyInit_rapidjson()’:
    ./python-rapidjson/rapidjson.cpp:867:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
             return NULL;
                    ^
    ./python-rapidjson/rapidjson.cpp:874:31: error: ‘rapidjson_module’ was not declared in this scope
         module = PyModule_Create(&rapidjson_module);
                                   ^
    ./python-rapidjson/rapidjson.cpp:874:47: error: ‘PyModule_Create’ was not declared in this scope
         module = PyModule_Create(&rapidjson_module);
                                                   ^
    In file included from /usr/include/locale.h:28:0,
                     from /usr/include/c++/5/clocale:42,
                     from /usr/include/x86_64-linux-gnu/c++/5/bits/c++locale.h:41,
                     from /usr/include/c++/5/bits/localefwd.h:40,
                     from /usr/include/c++/5/string:43,
                     from ./python-rapidjson/rapidjson.cpp:5:
    ./python-rapidjson/rapidjson.cpp:876:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
             return NULL;
                    ^
    ./python-rapidjson/rapidjson.cpp:888:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
         return module;
                ^
    ./python-rapidjson/rapidjson.cpp: In instantiation of ‘PyObject* rapidjson_dumps_internal(WriterT*, BufferT*, PyObject*, int, int, PyObject*, int, int, unsigned int, DatetimeMode) [with WriterT = rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::ASCII<> >, rapidjson::UTF8<>, rapidjson::ASCII<> >; BufferT = rapidjson::GenericStringBuffer<rapidjson::ASCII<> >; PyObject = _object]’:
    ./python-rapidjson/rapidjson.cpp:821:20:   required from here
    ./python-rapidjson/rapidjson.cpp:513:51: error: ‘PyUnicode_AsUTF8AndSize’ was not declared in this scope
                 char* decStr = PyUnicode_AsUTF8AndSize(decStrObj, &size);
                                                       ^
    ./python-rapidjson/rapidjson.cpp:571:39: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                 char* s = PyUnicode_AsUTF8(object);
                                           ^
    ./python-rapidjson/rapidjson.cpp:607:57: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                             char* key_str = PyUnicode_AsUTF8(key);
                                                             ^
    ./python-rapidjson/rapidjson.cpp:622:57: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                             char* key_str = PyUnicode_AsUTF8(key);
                                                             ^
    ./python-rapidjson/rapidjson.cpp:660:58: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                     PyObject* utcOffset = PyObject_CallMethod(object, "utcoffset", NULL);
                                                              ^
    ./python-rapidjson/rapidjson.cpp:721:90: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                 PyErr_Format(PyExc_TypeError, "%s is not JSON serializable", PyUnicode_AsUTF8(repr));
                                                                                              ^
    ./python-rapidjson/rapidjson.cpp: In instantiation of ‘PyObject* rapidjson_dumps_internal(WriterT*, BufferT*, PyObject*, int, int, PyObject*, int, int, unsigned int, DatetimeMode) [with WriterT = rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::UTF8<> > >; BufferT = rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; PyObject = _object]’:
    ./python-rapidjson/rapidjson.cpp:826:20:   required from here
    ./python-rapidjson/rapidjson.cpp:513:51: error: ‘PyUnicode_AsUTF8AndSize’ was not declared in this scope
                 char* decStr = PyUnicode_AsUTF8AndSize(decStrObj, &size);
                                                       ^
    ./python-rapidjson/rapidjson.cpp:571:39: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                 char* s = PyUnicode_AsUTF8(object);
                                           ^
    ./python-rapidjson/rapidjson.cpp:607:57: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                             char* key_str = PyUnicode_AsUTF8(key);
                                                             ^
    ./python-rapidjson/rapidjson.cpp:622:57: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                             char* key_str = PyUnicode_AsUTF8(key);
                                                             ^
    ./python-rapidjson/rapidjson.cpp:660:58: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                     PyObject* utcOffset = PyObject_CallMethod(object, "utcoffset", NULL);
                                                              ^
    ./python-rapidjson/rapidjson.cpp:721:90: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                 PyErr_Format(PyExc_TypeError, "%s is not JSON serializable", PyUnicode_AsUTF8(repr));
                                                                                              ^
    ./python-rapidjson/rapidjson.cpp: In instantiation of ‘PyObject* rapidjson_dumps_internal(WriterT*, BufferT*, PyObject*, int, int, PyObject*, int, int, unsigned int, DatetimeMode) [with WriterT = rapidjson::PrettyWriter<rapidjson::GenericStringBuffer<rapidjson::ASCII<> >, rapidjson::UTF8<>, rapidjson::ASCII<> >; BufferT = rapidjson::GenericStringBuffer<rapidjson::ASCII<> >; PyObject = _object]’:
    ./python-rapidjson/rapidjson.cpp:833:16:   required from here
    ./python-rapidjson/rapidjson.cpp:513:51: error: ‘PyUnicode_AsUTF8AndSize’ was not declared in this scope
                 char* decStr = PyUnicode_AsUTF8AndSize(decStrObj, &size);
                                                       ^
    ./python-rapidjson/rapidjson.cpp:571:39: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                 char* s = PyUnicode_AsUTF8(object);
                                           ^
    ./python-rapidjson/rapidjson.cpp:607:57: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                             char* key_str = PyUnicode_AsUTF8(key);
                                                             ^
    ./python-rapidjson/rapidjson.cpp:622:57: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                             char* key_str = PyUnicode_AsUTF8(key);
                                                             ^
    ./python-rapidjson/rapidjson.cpp:660:58: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                     PyObject* utcOffset = PyObject_CallMethod(object, "utcoffset", NULL);
                                                              ^
    ./python-rapidjson/rapidjson.cpp:721:90: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                 PyErr_Format(PyExc_TypeError, "%s is not JSON serializable", PyUnicode_AsUTF8(repr));
                                                                                              ^
    ./python-rapidjson/rapidjson.cpp: In instantiation of ‘PyObject* rapidjson_dumps_internal(WriterT*, BufferT*, PyObject*, int, int, PyObject*, int, int, unsigned int, DatetimeMode) [with WriterT = rapidjson::PrettyWriter<rapidjson::GenericStringBuffer<rapidjson::UTF8<> > >; BufferT = rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; PyObject = _object]’:
    ./python-rapidjson/rapidjson.cpp:839:16:   required from here
    ./python-rapidjson/rapidjson.cpp:513:51: error: ‘PyUnicode_AsUTF8AndSize’ was not declared in this scope
                 char* decStr = PyUnicode_AsUTF8AndSize(decStrObj, &size);
                                                       ^
    ./python-rapidjson/rapidjson.cpp:571:39: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                 char* s = PyUnicode_AsUTF8(object);
                                           ^
    ./python-rapidjson/rapidjson.cpp:607:57: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                             char* key_str = PyUnicode_AsUTF8(key);
                                                             ^
    ./python-rapidjson/rapidjson.cpp:622:57: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                             char* key_str = PyUnicode_AsUTF8(key);
                                                             ^
    ./python-rapidjson/rapidjson.cpp:660:58: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                     PyObject* utcOffset = PyObject_CallMethod(object, "utcoffset", NULL);
                                                              ^
    ./python-rapidjson/rapidjson.cpp:721:90: error: ‘PyUnicode_AsUTF8’ was not declared in this scope
                 PyErr_Format(PyExc_TypeError, "%s is not JSON serializable", PyUnicode_AsUTF8(repr));
                                                                                              ^
    In file included from ./python-rapidjson/rapidjson.cpp:14:0:
    ./python-rapidjson/docstrings.h: At global scope:
    ./python-rapidjson/docstrings.h:4:20: warning: ‘rapidjson_module_docstring’ defined but not used [-Wunused-variable]
     static const char* rapidjson_module_docstring =
                        ^
    ./python-rapidjson/rapidjson.cpp:846:1: warning: ‘rapidjson_functions’ defined but not used [-Wunused-variable]
     rapidjson_functions[] = {
     ^
    error: command 'gcc' failed with exit status 1

    ----------------------------------------

Activity

  1. thedrow commented on Jan 6, 2016

    @thedrow
    Author

    Well this makes sense if you only support Python 3.
    Maybe a better message in setup.py would help to clarify this.

  2. kenrobbins commented on Aug 26, 2016

    @kenrobbins
    Member

    Yeah, sorry, this lib is only Python 3 compatible at the moment. I've thought about adding Python 2 support but it is a decent amount of work.

  3. lelit commented on Mar 2, 2017

    @lelit
    Contributor

    Should be fixed in version 0.0.9.
    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions