Solved Build error compiling from git
#1
In trying to compile from git, I am getting errors relating to python it seems.  Build distro is Arch Linux.  Complete build log and snippet:
Code:
...
[ 95%] Building CXX object build/network/upnp/CMakeFiles/network_upnp.dir/UPnP.cpp.o
/build/kodi-git/src/xbmc/xbmc/interfaces/python/PythonInvoker.cpp: In member function ‘bool CPythonInvoker::execute(const string&, const std::vector<std::__cxx11::basic_string<wchar_t> >&)’:
/build/kodi-git/src/xbmc/xbmc/interfaces/python/PythonInvoker.cpp:366:40: error: invalid use of incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
  366 |   for (PyThreadState* s = state->interp->tstate_head, *old = NULL; s;)
      |                                        ^~
In file included from /usr/include/python3.8/genobject.h:11,
                 from /usr/include/python3.8/Python.h:121,
                 from /build/kodi-git/src/xbmc/xbmc/interfaces/python/PythonInvoker.cpp:10:
/usr/include/python3.8/pystate.h:20:8: note: forward declaration of ‘PyInterpreterState’ {aka ‘struct _is’}
   20 | struct _is;
      |        ^~~
/build/kodi-git/src/xbmc/xbmc/interfaces/python/PythonInvoker.cpp:373:9: error: ‘old’ was not declared in this scope
  373 |     if (old != s)
      |         ^~~
/build/kodi-git/src/xbmc/xbmc/interfaces/python/PythonInvoker.cpp:383:22: error: invalid use of incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
  383 |     s = state->interp->tstate_head;
      |                      ^~
In file included from /usr/include/python3.8/genobject.h:11,
                 from /usr/include/python3.8/Python.h:121,
                 from /build/kodi-git/src/xbmc/xbmc/interfaces/python/PythonInvoker.cpp:10:
/usr/include/python3.8/pystate.h:20:8: note: forward declaration of ‘PyInterpreterState’ {aka ‘struct _is’}
   20 | struct _is;
      |        ^~~
/build/kodi-git/src/xbmc/xbmc/interfaces/python/PythonInvoker.cpp: In member function ‘virtual bool CPythonInvoker::stop(bool)’:
/build/kodi-git/src/xbmc/xbmc/interfaces/python/PythonInvoker.cpp:527:74: error: invalid use of incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
  527 |       for (PyThreadState* state = ((PyThreadState*)m_threadState)->interp->tstate_head; state; state = state->next)
      |                                                                          ^~
In file included from /usr/include/python3.8/genobject.h:11,
                 from /usr/include/python3.8/Python.h:121,
                 from /build/kodi-git/src/xbmc/xbmc/interfaces/python/PythonInvoker.cpp:10:
/usr/include/python3.8/pystate.h:20:8: note: forward declaration of ‘PyInterpreterState’ {aka ‘struct _is’}
   20 | struct _is;
      |        ^~~
distcc[40942] ERROR: compile /build/kodi-git/src/xbmc/xbmc/interfaces/python/PythonInvoker.cpp on localhost failed
make[2]: *** [build/interfaces/python/CMakeFiles/python_interface.dir/build.make:115: build/interfaces/python/CMakeFiles/python_interface.dir/PythonInvoker.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:11631: build/interfaces/python/CMakeFiles/python_interface.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

I am building like this:
Code:
  cmake -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DENABLE_EVENTCLIENTS=ON \
    -DENABLE_INTERNAL_FFMPEG=ON \
    -DENABLE_INTERNAL_FMT=ON \
    -DENABLE_INTERNAL_CROSSGUID=ON \
    -DENABLE_INTERNAL_FSTRCMP=ON \
    -DENABLE_INTERNAL_FLATBUFFERS=ON \
    -DENABLE_MYSQLCLIENT=ON \
    -DX11_RENDER_SYSTEM=gl \
    -Dlibdvdcss_URL="/libdvdcss-1.4.2-Leia-Beta-5.tar.gz" \
    -Dlibdvdnav_URL="/libdvdnav-6.0.0-Leia-Alpha-3.tar.gz" \
    -Dlibdvdread_URL="/libdvdread-6.0.0-Leia-Alpha-3.tar.gz" \
    -DFFMPEG_URL="/ffmpeg-4.0.4-Leia-18.4.tar.gz" \
    -DFMT_URL="/fmt-5.1.0.tar.gz" \
    -DCROSSGUID_URL="/crossguid-8f399e8bd4.tar.gz" \
    -DFSTRCMP_URL="/fstrcmp-0.7.D001.tar.gz" \
    -DFLATBUFFERS_URL="/flatbuffers-1.11.0.tar.gz" \
    ../xbmc
  make
Need help programming a Streamzap remote?
Reply
#2
Yep.
That's because of python 3.8 change. See 16560 (GH issue) for more info.
This is the patch I use:
Code:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2fb6bf5bed..52be5b649d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,7 +163,7 @@ find_package(JsonSchemaBuilder REQUIRED)
 core_optional_dep(${optional_deps})
 core_require_dep(${required_deps})

-SET(PYTHON_VERSION 3.7)
+SET(PYTHON_VERSION 3.8)

 if(ENABLE_MARIADBCLIENT AND NOT ENABLE_MARIADBCLIENT STREQUAL AUTO AND ENABLE_MYSQLCLIENT AND NOT ENABLE_MYSQLCLIENT STREQUAL AUTO)
   MESSAGE(FATAL_ERROR "You can not use MySql and MariaDB at the same time. Disable one by adding -DENABLE_MYSQLCLIENT=OFF or -DENABLE_MARIADBCLIENT=OFF.")
diff --git a/xbmc/interfaces/python/PythonInvoker.cpp b/xbmc/interfaces/python/PythonInvoker.cpp
index 4342e05dcd..660e82c254 100644
--- a/xbmc/interfaces/python/PythonInvoker.cpp
+++ b/xbmc/interfaces/python/PythonInvoker.cpp
@@ -8,6 +8,14 @@

 // python.h should always be included first before any other includes
 #include <Python.h>
+#if PY_VERSION_HEX >= 0x03080000
+# define Py_BUILD_CORE
+# undef HAVE_STD_ATOMIC
+/* for access to the fields of PyInterpreterState */
+#  include "internal/pycore_pystate.h"
+# undef Py_BUILD_CORE
+# define HAVE_STD_ATOMIC
+#endif
 #include <iterator>
 #include <osdefs.h>
 
Reply
#3
Thanks @asavah , your patch works great.
Need help programming a Streamzap remote?
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
Build error compiling from git00