Installing Weewx 4, Belchertown 1.1 and MQTT from scratch. Almost fully succesful (fails on python-cjson)

90 views
Skip to first unread message

Maarten van der Hoeven

unread,
May 6, 2020, 4:27:37 PM5/6/20
to weewx-user
Hi,

hard disc crashed, rebuilding the complete environment. Backup was sound, no data lost.

Running Ubuntu 20.04, installed Weewx4 with python 3, Belchertown 1.1 skin succesfully implemented. Got mosquitto running okay.

Now busy implementing weewx-mqtt. Instuctions:

sudo pip3 install paho-mqtt, succesful
sudo pip3 install python-cjson. Package is found, but when trying to build it, it fails. What can I do? I dont want to mess with python2, and risk breaking dependencies. Error log from failure python-cjson:

maarten@weewx:~$ sudo pip3 install python-cjson
Collecting python-cjson
  Downloading python-cjson-1.2.2.tar.gz (12 kB)
Building wheels for collected packages: python-cjson
  Building wheel for python-cjson (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zu4cgg1n/python-cjson/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zu4cgg1n/python-cjson/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-3y0kj1p4
       cwd: /tmp/pip-install-zu4cgg1n/python-cjson/
  Complete output (243 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'cjson' extension
  creating build
  creating build/temp.linux-x86_64-3.8
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DMODULE_VERSION=1.2.2 -I/usr/include/python3.8 -c cjson.c -o build/temp.linux-x86_64-3.8/cjson.o
  cjson.c: In function ‘decode_string’:
  cjson.c:167:18: warning: implicit declaration of function ‘PyString_DecodeEscape’; did you mean ‘PyBytes_DecodeEscape’? [-Wimplicit-function-declaration]
    167 |         object = PyString_DecodeEscape(jsondata->ptr+1, len, NULL, 0, NULL);
        |                  ^~~~~~~~~~~~~~~~~~~~~
        |                  PyBytes_DecodeEscape
  cjson.c:167:16: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    167 |         object = PyString_DecodeEscape(jsondata->ptr+1, len, NULL, 0, NULL);
        |                ^
  cjson.c:169:18: warning: implicit declaration of function ‘PyString_FromStringAndSize’; did you mean ‘PyBytes_FromStringAndSize’? [-Wimplicit-function-declaration]
    169 |         object = PyString_FromStringAndSize(jsondata->ptr+1, len);
        |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
        |                  PyBytes_FromStringAndSize
  cjson.c:169:16: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    169 |         object = PyString_FromStringAndSize(jsondata->ptr+1, len);
        |                ^
  cjson.c:185:39: warning: implicit declaration of function ‘PyString_AsString’ [-Wimplicit-function-declaration]
    185 |                              reason ? PyString_AsString(reason) : "bad format");
        |                                       ^~~~~~~~~~~~~~~~~
  cjson.c:185:65: warning: pointer/integer type mismatch in conditional expression
    185 |                              reason ? PyString_AsString(reason) : "bad format");
        |                                                                 ^
  cjson.c: In function ‘decode_number’:
  cjson.c:295:9: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    295 |     str = PyString_FromStringAndSize(jsondata->ptr, ptr - jsondata->ptr);
        |         ^
  cjson.c:300:18: error: too many arguments to function ‘PyFloat_FromString’
    300 |         object = PyFloat_FromString(str, NULL);
        |                  ^~~~~~~~~~~~~~~~~~
  In file included from /usr/include/python3.8/Python.h:101,
                   from cjson.c:5:
  /usr/include/python3.8/floatobject.h:42:24: note: declared here
     42 | PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*);
        |                        ^~~~~~~~~~~~~~~~~~
  cjson.c:302:18: warning: implicit declaration of function ‘PyInt_FromString’; did you mean ‘PyLong_FromString’? [-Wimplicit-function-declaration]
    302 |         object = PyInt_FromString(PyString_AS_STRING(str), NULL, 10);
        |                  ^~~~~~~~~~~~~~~~
        |                  PyLong_FromString
  cjson.c:302:35: warning: implicit declaration of function ‘PyString_AS_STRING’; did you mean ‘PyBytes_AS_STRING’? [-Wimplicit-function-declaration]
    302 |         object = PyInt_FromString(PyString_AS_STRING(str), NULL, 10);
        |                                   ^~~~~~~~~~~~~~~~~~
        |                                   PyBytes_AS_STRING
  cjson.c:302:16: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    302 |         object = PyInt_FromString(PyString_AS_STRING(str), NULL, 10);
        |                ^
  cjson.c: In function ‘encode_string’:
  cjson.c:593:14: error: unknown type name ‘PyStringObject’
    593 |     register PyStringObject* op = (PyStringObject*) string;
        |              ^~~~~~~~~~~~~~
  cjson.c:593:36: error: ‘PyStringObject’ undeclared (first use in this function); did you mean ‘PySliceObject’?
    593 |     register PyStringObject* op = (PyStringObject*) string;
        |                                    ^~~~~~~~~~~~~~
        |                                    PySliceObject
  cjson.c:593:36: note: each undeclared identifier is reported only once for each function it appears in
  cjson.c:593:51: error: expected expression before ‘)’ token
    593 |     register PyStringObject* op = (PyStringObject*) string;
        |                                                   ^
  cjson.c:594:32: error: request for member ‘ob_size’ in something not a structure or union
    594 |     size_t newsize = 2 + 6 * op->ob_size;
        |                                ^~
  cjson.c:597:11: error: request for member ‘ob_size’ in something not a structure or union
    597 |     if (op->ob_size > (PY_SSIZE_T_MAX-2)/6) {
        |           ^~
  cjson.c:602:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    602 |     v = PyString_FromStringAndSize((char *)NULL, newsize);
        |       ^
  cjson.c:614:11: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    614 |         p = PyString_AS_STRING(v);
        |           ^
  cjson.c:616:27: error: request for member ‘ob_size’ in something not a structure or union
    616 |         for (i = 0; i < op->ob_size; i++) {
        |                           ^~
  cjson.c:620:19: error: request for member ‘ob_sval’ in something not a structure or union
    620 |             c = op->ob_sval[i];
        |                   ^~
  cjson.c:646:9: warning: implicit declaration of function ‘_PyString_Resize’ [-Wimplicit-function-declaration]
    646 |         _PyString_Resize(&v, (int) (p - PyString_AS_STRING(v)));
        |         ^~~~~~~~~~~~~~~~
  cjson.c:646:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    646 |         _PyString_Resize(&v, (int) (p - PyString_AS_STRING(v)));
        |                              ^
  cjson.c: In function ‘encode_unicode’:
  cjson.c:697:10: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    697 |     repr = PyString_FromStringAndSize(NULL, 2 + expandsize*size + 1);
        |          ^
  cjson.c:701:7: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    701 |     p = PyString_AS_STRING(repr);
        |       ^
  cjson.c:709:57: error: subscripted value is neither array nor pointer nor vector
    709 |         if ((ch == (Py_UNICODE) PyString_AS_STRING(repr)[0] || ch == '\\')) {
        |                                                         ^
  cjson.c:785:36: error: subscripted value is neither array nor pointer nor vector
    785 |     *p++ = PyString_AS_STRING(repr)[0];
        |                                    ^
  cjson.c: In function ‘encode_tuple’:
  cjson.c:809:10: error: ‘PyTupleObject’ {aka ‘struct <anonymous>’} has no member named ‘ob_size’
    809 |     n = v->ob_size;
        |          ^~
  cjson.c:811:16: warning: implicit declaration of function ‘PyString_FromString’; did you mean ‘PyLong_FromString’? [-Wimplicit-function-declaration]
    811 |         return PyString_FromString("[]");
        |                ^~~~~~~~~~~~~~~~~~~
        |                PyLong_FromString
  cjson.c:811:16: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
    811 |         return PyString_FromString("[]");
        |                ^~~~~~~~~~~~~~~~~~~~~~~~~
  cjson.c:827:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    827 |     s = PyString_FromString("[");
        |       ^
  cjson.c:831:5: warning: implicit declaration of function ‘PyString_ConcatAndDel’; did you mean ‘PyBytes_ConcatAndDel’? [-Wimplicit-function-declaration]
    831 |     PyString_ConcatAndDel(&s, temp);
        |     ^~~~~~~~~~~~~~~~~~~~~
        |     PyBytes_ConcatAndDel
  cjson.c:836:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    836 |     s = PyString_FromString("]");
        |       ^
  cjson.c:846:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    846 |     s = PyString_FromString(", ");
        |       ^
  cjson.c:849:14: warning: implicit declaration of function ‘_PyString_Join’ [-Wimplicit-function-declaration]
    849 |     result = _PyString_Join(s, pieces);
        |              ^~~~~~~~~~~~~~
  cjson.c:849:12: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    849 |     result = _PyString_Join(s, pieces);
        |            ^
  cjson.c: In function ‘encode_list’:
  cjson.c:883:10: error: ‘PyListObject’ {aka ‘struct <anonymous>’} has no member named ‘ob_size’
    883 |     if (v->ob_size == 0) {
        |          ^~
  cjson.c:884:16: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    884 |         result = PyString_FromString("[]");
        |                ^
  cjson.c:894:22: error: ‘PyListObject’ {aka ‘struct <anonymous>’} has no member named ‘ob_size’
    894 |     for (i = 0; i < v->ob_size; ++i) {
        |                      ^~
  cjson.c:907:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    907 |     s = PyString_FromString("[");
        |       ^
  cjson.c:916:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    916 |     s = PyString_FromString("]");
        |       ^
  cjson.c:926:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    926 |     s = PyString_FromString(", ");
        |       ^
  cjson.c:929:12: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    929 |     result = _PyString_Join(s, pieces);
        |            ^
  cjson.c: In function ‘encode_dict’:
  cjson.c:968:16: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    968 |         result = PyString_FromString("{}");
        |                ^
  cjson.c:976:11: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    976 |     colon = PyString_FromString(": ");
        |           ^
  cjson.c:986:14: warning: implicit declaration of function ‘PyString_Check’; did you mean ‘PyMapping_Check’? [-Wimplicit-function-declaration]
    986 |         if (!PyString_Check(key) && !PyUnicode_Check(key)) {
        |              ^~~~~~~~~~~~~~
        |              PyMapping_Check
  cjson.c:995:9: warning: implicit declaration of function ‘PyString_Concat’; did you mean ‘PySequence_Concat’? [-Wimplicit-function-declaration]
    995 |         PyString_Concat(&s, colon);
        |         ^~~~~~~~~~~~~~~
        |         PySequence_Concat
  cjson.c:1008:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   1008 |     s = PyString_FromString("{");
        |       ^
  cjson.c:1017:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   1017 |     s = PyString_FromString("}");
        |       ^
  cjson.c:1027:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   1027 |     s = PyString_FromString(", ");
        |       ^
  cjson.c:1030:12: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   1030 |     result = _PyString_Join(s, pieces);
        |            ^
  cjson.c: In function ‘encode_object’:
  cjson.c:1045:16: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
   1045 |         return PyString_FromString("true");
        |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  cjson.c:1047:16: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
   1047 |         return PyString_FromString("false");
        |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cjson.c:1049:16: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
   1049 |         return PyString_FromString("null");
        |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  cjson.c:1057:20: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
   1057 |             return PyString_FromString("NaN");
        |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
  cjson.c:1060:24: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
   1060 |                 return PyString_FromString("Infinity");
        |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cjson.c:1062:24: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
   1062 |                 return PyString_FromString("-Infinity");
        |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cjson.c:1067:16: warning: implicit declaration of function ‘PyInt_Check’; did you mean ‘PySet_Check’? [-Wimplicit-function-declaration]
   1067 |     } else if (PyInt_Check(object) || PyLong_Check(object)) {
        |                ^~~~~~~~~~~
        |                PySet_Check
  cjson.c: In function ‘JSON_decode’:
  cjson.c:1130:9: warning: implicit declaration of function ‘PyString_AsStringAndSize’; did you mean ‘PyBytes_AsStringAndSize’? [-Wimplicit-function-declaration]
   1130 |     if (PyString_AsStringAndSize(str, &(jsondata.str), NULL) == -1) {
        |         ^~~~~~~~~~~~~~~~~~~~~~~~
        |         PyBytes_AsStringAndSize
  cjson.c:1136:35: warning: implicit declaration of function ‘PyString_GET_SIZE’; did you mean ‘PyList_GET_SIZE’? [-Wimplicit-function-declaration]
   1136 |     jsondata.end = jsondata.str + PyString_GET_SIZE(str);
        |                                   ^~~~~~~~~~~~~~~~~
        |                                   PyList_GET_SIZE
  cjson.c: In function ‘initcjson’:
  cjson.c:1187:9: warning: implicit declaration of function ‘Py_InitModule3’ [-Wimplicit-function-declaration]
   1187 |     m = Py_InitModule3("cjson", cjson_methods, module_doc);
        |         ^~~~~~~~~~~~~~
  cjson.c:1187:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   1187 |     m = Py_InitModule3("cjson", cjson_methods, module_doc);
        |       ^
  cjson.c:1190:9: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
   1190 |         return;
        |         ^~~~~~
  cjson.c:1183:1: note: declared here
   1183 | initcjson(void)
        | ^~~~~~~~~
  cjson.c:1194:9: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
   1194 |         return;
        |         ^~~~~~
  cjson.c:1183:1: note: declared here
   1183 | initcjson(void)
        | ^~~~~~~~~
  cjson.c:1200:9: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
   1200 |         return;
        |         ^~~~~~
  cjson.c:1183:1: note: declared here
   1183 | initcjson(void)
        | ^~~~~~~~~
  cjson.c:1206:9: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
   1206 |         return;
        |         ^~~~~~
  cjson.c:1183:1: note: declared here
   1183 | initcjson(void)
        | ^~~~~~~~~
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for python-cjson
  Running setup.py clean for python-cjson
Failed to build python-cjson
Installing collected packages: python-cjson
    Running setup.py install for python-cjson ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zu4cgg1n/python-cjson/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zu4cgg1n/python-cjson/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-record-b8b539va/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/python-cjson
         cwd: /tmp/pip-install-zu4cgg1n/python-cjson/
    Complete output (243 lines):
    running install
    running build
    running build_ext
    building 'cjson' extension
    creating build
    creating build/temp.linux-x86_64-3.8
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DMODULE_VERSION=1.2.2 -I/usr/include/python3.8 -c cjson.c -o build/temp.linux-x86_64-3.8/cjson.o
    cjson.c: In function ‘decode_string’:
    cjson.c:167:18: warning: implicit declaration of function ‘PyString_DecodeEscape’; did you mean ‘PyBytes_DecodeEscape’? [-Wimplicit-function-declaration]
      167 |         object = PyString_DecodeEscape(jsondata->ptr+1, len, NULL, 0, NULL);
          |                  ^~~~~~~~~~~~~~~~~~~~~
          |                  PyBytes_DecodeEscape
    cjson.c:167:16: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      167 |         object = PyString_DecodeEscape(jsondata->ptr+1, len, NULL, 0, NULL);
          |                ^
    cjson.c:169:18: warning: implicit declaration of function ‘PyString_FromStringAndSize’; did you mean ‘PyBytes_FromStringAndSize’? [-Wimplicit-function-declaration]
      169 |         object = PyString_FromStringAndSize(jsondata->ptr+1, len);
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
          |                  PyBytes_FromStringAndSize
    cjson.c:169:16: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      169 |         object = PyString_FromStringAndSize(jsondata->ptr+1, len);
          |                ^
    cjson.c:185:39: warning: implicit declaration of function ‘PyString_AsString’ [-Wimplicit-function-declaration]
      185 |                              reason ? PyString_AsString(reason) : "bad format");
          |                                       ^~~~~~~~~~~~~~~~~
    cjson.c:185:65: warning: pointer/integer type mismatch in conditional expression
      185 |                              reason ? PyString_AsString(reason) : "bad format");
          |                                                                 ^
    cjson.c: In function ‘decode_number’:
    cjson.c:295:9: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      295 |     str = PyString_FromStringAndSize(jsondata->ptr, ptr - jsondata->ptr);
          |         ^
    cjson.c:300:18: error: too many arguments to function ‘PyFloat_FromString’
      300 |         object = PyFloat_FromString(str, NULL);
          |                  ^~~~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.8/Python.h:101,
                     from cjson.c:5:
    /usr/include/python3.8/floatobject.h:42:24: note: declared here
       42 | PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*);
          |                        ^~~~~~~~~~~~~~~~~~
    cjson.c:302:18: warning: implicit declaration of function ‘PyInt_FromString’; did you mean ‘PyLong_FromString’? [-Wimplicit-function-declaration]
      302 |         object = PyInt_FromString(PyString_AS_STRING(str), NULL, 10);
          |                  ^~~~~~~~~~~~~~~~
          |                  PyLong_FromString
    cjson.c:302:35: warning: implicit declaration of function ‘PyString_AS_STRING’; did you mean ‘PyBytes_AS_STRING’? [-Wimplicit-function-declaration]
      302 |         object = PyInt_FromString(PyString_AS_STRING(str), NULL, 10);
          |                                   ^~~~~~~~~~~~~~~~~~
          |                                   PyBytes_AS_STRING
    cjson.c:302:16: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      302 |         object = PyInt_FromString(PyString_AS_STRING(str), NULL, 10);
          |                ^
    cjson.c: In function ‘encode_string’:
    cjson.c:593:14: error: unknown type name ‘PyStringObject’
      593 |     register PyStringObject* op = (PyStringObject*) string;
          |              ^~~~~~~~~~~~~~
    cjson.c:593:36: error: ‘PyStringObject’ undeclared (first use in this function); did you mean ‘PySliceObject’?
      593 |     register PyStringObject* op = (PyStringObject*) string;
          |                                    ^~~~~~~~~~~~~~
          |                                    PySliceObject
    cjson.c:593:36: note: each undeclared identifier is reported only once for each function it appears in
    cjson.c:593:51: error: expected expression before ‘)’ token
      593 |     register PyStringObject* op = (PyStringObject*) string;
          |                                                   ^
    cjson.c:594:32: error: request for member ‘ob_size’ in something not a structure or union
      594 |     size_t newsize = 2 + 6 * op->ob_size;
          |                                ^~
    cjson.c:597:11: error: request for member ‘ob_size’ in something not a structure or union
      597 |     if (op->ob_size > (PY_SSIZE_T_MAX-2)/6) {
          |           ^~
    cjson.c:602:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      602 |     v = PyString_FromStringAndSize((char *)NULL, newsize);
          |       ^
    cjson.c:614:11: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      614 |         p = PyString_AS_STRING(v);
          |           ^
    cjson.c:616:27: error: request for member ‘ob_size’ in something not a structure or union
      616 |         for (i = 0; i < op->ob_size; i++) {
          |                           ^~
    cjson.c:620:19: error: request for member ‘ob_sval’ in something not a structure or union
      620 |             c = op->ob_sval[i];
          |                   ^~
    cjson.c:646:9: warning: implicit declaration of function ‘_PyString_Resize’ [-Wimplicit-function-declaration]
      646 |         _PyString_Resize(&v, (int) (p - PyString_AS_STRING(v)));
          |         ^~~~~~~~~~~~~~~~
    cjson.c:646:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      646 |         _PyString_Resize(&v, (int) (p - PyString_AS_STRING(v)));
          |                              ^
    cjson.c: In function ‘encode_unicode’:
    cjson.c:697:10: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      697 |     repr = PyString_FromStringAndSize(NULL, 2 + expandsize*size + 1);
          |          ^
    cjson.c:701:7: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      701 |     p = PyString_AS_STRING(repr);
          |       ^
    cjson.c:709:57: error: subscripted value is neither array nor pointer nor vector
      709 |         if ((ch == (Py_UNICODE) PyString_AS_STRING(repr)[0] || ch == '\\')) {
          |                                                         ^
    cjson.c:785:36: error: subscripted value is neither array nor pointer nor vector
      785 |     *p++ = PyString_AS_STRING(repr)[0];
          |                                    ^
    cjson.c: In function ‘encode_tuple’:
    cjson.c:809:10: error: ‘PyTupleObject’ {aka ‘struct <anonymous>’} has no member named ‘ob_size’
      809 |     n = v->ob_size;
          |          ^~
    cjson.c:811:16: warning: implicit declaration of function ‘PyString_FromString’; did you mean ‘PyLong_FromString’? [-Wimplicit-function-declaration]
      811 |         return PyString_FromString("[]");
          |                ^~~~~~~~~~~~~~~~~~~
          |                PyLong_FromString
    cjson.c:811:16: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
      811 |         return PyString_FromString("[]");
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~
    cjson.c:827:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      827 |     s = PyString_FromString("[");
          |       ^
    cjson.c:831:5: warning: implicit declaration of function ‘PyString_ConcatAndDel’; did you mean ‘PyBytes_ConcatAndDel’? [-Wimplicit-function-declaration]
      831 |     PyString_ConcatAndDel(&s, temp);
          |     ^~~~~~~~~~~~~~~~~~~~~
          |     PyBytes_ConcatAndDel
    cjson.c:836:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      836 |     s = PyString_FromString("]");
          |       ^
    cjson.c:846:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      846 |     s = PyString_FromString(", ");
          |       ^
    cjson.c:849:14: warning: implicit declaration of function ‘_PyString_Join’ [-Wimplicit-function-declaration]
      849 |     result = _PyString_Join(s, pieces);
          |              ^~~~~~~~~~~~~~
    cjson.c:849:12: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      849 |     result = _PyString_Join(s, pieces);
          |            ^
    cjson.c: In function ‘encode_list’:
    cjson.c:883:10: error: ‘PyListObject’ {aka ‘struct <anonymous>’} has no member named ‘ob_size’
      883 |     if (v->ob_size == 0) {
          |          ^~
    cjson.c:884:16: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      884 |         result = PyString_FromString("[]");
          |                ^
    cjson.c:894:22: error: ‘PyListObject’ {aka ‘struct <anonymous>’} has no member named ‘ob_size’
      894 |     for (i = 0; i < v->ob_size; ++i) {
          |                      ^~
    cjson.c:907:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      907 |     s = PyString_FromString("[");
          |       ^
    cjson.c:916:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      916 |     s = PyString_FromString("]");
          |       ^
    cjson.c:926:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      926 |     s = PyString_FromString(", ");
          |       ^
    cjson.c:929:12: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      929 |     result = _PyString_Join(s, pieces);
          |            ^
    cjson.c: In function ‘encode_dict’:
    cjson.c:968:16: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      968 |         result = PyString_FromString("{}");
          |                ^
    cjson.c:976:11: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      976 |     colon = PyString_FromString(": ");
          |           ^
    cjson.c:986:14: warning: implicit declaration of function ‘PyString_Check’; did you mean ‘PyMapping_Check’? [-Wimplicit-function-declaration]
      986 |         if (!PyString_Check(key) && !PyUnicode_Check(key)) {
          |              ^~~~~~~~~~~~~~
          |              PyMapping_Check
    cjson.c:995:9: warning: implicit declaration of function ‘PyString_Concat’; did you mean ‘PySequence_Concat’? [-Wimplicit-function-declaration]
      995 |         PyString_Concat(&s, colon);
          |         ^~~~~~~~~~~~~~~
          |         PySequence_Concat
    cjson.c:1008:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
     1008 |     s = PyString_FromString("{");
          |       ^
    cjson.c:1017:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
     1017 |     s = PyString_FromString("}");
          |       ^
    cjson.c:1027:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
     1027 |     s = PyString_FromString(", ");
          |       ^
    cjson.c:1030:12: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
     1030 |     result = _PyString_Join(s, pieces);
          |            ^
    cjson.c: In function ‘encode_object’:
    cjson.c:1045:16: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
     1045 |         return PyString_FromString("true");
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    cjson.c:1047:16: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
     1047 |         return PyString_FromString("false");
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cjson.c:1049:16: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
     1049 |         return PyString_FromString("null");
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    cjson.c:1057:20: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
     1057 |             return PyString_FromString("NaN");
          |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
    cjson.c:1060:24: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
     1060 |                 return PyString_FromString("Infinity");
          |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cjson.c:1062:24: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
     1062 |                 return PyString_FromString("-Infinity");
          |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cjson.c:1067:16: warning: implicit declaration of function ‘PyInt_Check’; did you mean ‘PySet_Check’? [-Wimplicit-function-declaration]
     1067 |     } else if (PyInt_Check(object) || PyLong_Check(object)) {
          |                ^~~~~~~~~~~
          |                PySet_Check
    cjson.c: In function ‘JSON_decode’:
    cjson.c:1130:9: warning: implicit declaration of function ‘PyString_AsStringAndSize’; did you mean ‘PyBytes_AsStringAndSize’? [-Wimplicit-function-declaration]
     1130 |     if (PyString_AsStringAndSize(str, &(jsondata.str), NULL) == -1) {
          |         ^~~~~~~~~~~~~~~~~~~~~~~~
          |         PyBytes_AsStringAndSize
    cjson.c:1136:35: warning: implicit declaration of function ‘PyString_GET_SIZE’; did you mean ‘PyList_GET_SIZE’? [-Wimplicit-function-declaration]
     1136 |     jsondata.end = jsondata.str + PyString_GET_SIZE(str);
          |                                   ^~~~~~~~~~~~~~~~~
          |                                   PyList_GET_SIZE
    cjson.c: In function ‘initcjson’:
    cjson.c:1187:9: warning: implicit declaration of function ‘Py_InitModule3’ [-Wimplicit-function-declaration]
     1187 |     m = Py_InitModule3("cjson", cjson_methods, module_doc);
          |         ^~~~~~~~~~~~~~
    cjson.c:1187:7: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
     1187 |     m = Py_InitModule3("cjson", cjson_methods, module_doc);
          |       ^
    cjson.c:1190:9: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
     1190 |         return;
          |         ^~~~~~
    cjson.c:1183:1: note: declared here
     1183 | initcjson(void)
          | ^~~~~~~~~
    cjson.c:1194:9: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
     1194 |         return;
          |         ^~~~~~
    cjson.c:1183:1: note: declared here
     1183 | initcjson(void)
          | ^~~~~~~~~
    cjson.c:1200:9: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
     1200 |         return;
          |         ^~~~~~
    cjson.c:1183:1: note: declared here
     1183 | initcjson(void)
          | ^~~~~~~~~
    cjson.c:1206:9: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
     1206 |         return;
          |         ^~~~~~
    cjson.c:1183:1: note: declared here
     1183 | initcjson(void)
          | ^~~~~~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zu4cgg1n/python-cjson/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zu4cgg1n/python-cjson/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-record-b8b539va/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/python-cjson Check the logs for full command output.

Maarten van der Hoeven

unread,
May 6, 2020, 4:48:29 PM5/6/20
to weewx-user
Update by myself. In stead of trying to install python-cjson, I succeeded with installing

sudo pip3 install ujson

All set now, data published live on my webpage.



Op woensdag 6 mei 2020 22:27:37 UTC+2 schreef Maarten van der Hoeven:
Reply all
Reply to author
Forward
0 new messages