[ 12%] Building CXX object src/Gui/CMakeFiles/FreeCADGui.dir/FreeCADGui_autogen/mocs_compilation.cpp.o
[ 12%] Building CXX object src/Gui/CMakeFiles/FreeCADGui.dir/3Dconnexion/GuiAbstractNativeEvent.cpp.o
[ 12%] Building CXX object src/Gui/CMakeFiles/FreeCADGui.dir/3Dconnexion/GuiNativeEventLinux.cpp.o
[ 12%] Building CXX object src/Gui/CMakeFiles/FreeCADGui.dir/Application.cpp.o
In file included from /home/jyothish/Projects/FreeCAD-Qt6/src/Base/BaseClassPy.h:7,
from /home/jyothish/Projects/FreeCAD-Qt6/src/Base/PersistencePy.h:7,
from /home/jyothish/Projects/FreeCAD-Qt6/src/App/PropertyContainerPy.h:7,
from /home/jyothish/Projects/FreeCAD-Qt6/src/App/ExtensionContainerPy.h:7,
from /home/jyothish/Projects/FreeCAD-Qt6/src/App/DocumentObjectPy.h:7,
from /home/jyothish/Projects/FreeCAD-fork/src/Gui/Application.cpp:48:
/home/jyothish/Projects/FreeCAD-fork/src/Base/PyObjectBase.h: In function ‘void Base::PyTypeCheck(PyObject**, PyTypeObject*, const char*)’:
/home/jyothish/Projects/FreeCAD-fork/src/Base/PyObjectBase.h:536:43: error: invalid use of incomplete type ‘PyTypeObject’ {aka ‘struct _typeobject’}
536 | str << "Type must be " << type->tp_name << " or None, not " << (*ptr)->ob_type->tp_name;
| ^~
In file included from /usr/include/python3.10/Python.h:74,
from /home/jyothish/Projects/FreeCAD-fork/src/Base/PyObjectBase.h:38:
/usr/include/python3.10/object.h:66:16: note: forward declaration of ‘PyTypeObject’ {aka ‘struct _typeobject’}
66 | typedef struct _typeobject PyTypeObject;
| ^~~~~~~~~~~
/home/jyothish/Projects/FreeCAD-fork/src/Base/PyObjectBase.h:536:91: error: invalid use of incomplete type ‘PyTypeObject’ {aka ‘struct _typeobject’}
536 | str << "Type must be " << type->tp_name << " or None, not " << (*ptr)->ob_type->tp_name;
| ^~
/usr/include/python3.10/object.h:66:16: note: forward declaration of ‘PyTypeObject’ {aka ‘struct _typeobject’}
66 | typedef struct _typeobject PyTypeObject;
| ^~~~~~~~~~~
In file included from /home/jyothish/Projects/FreeCAD-fork/src/CXX/Python3/Extensions.hxx:183,
from /home/jyothish/Projects/FreeCAD-fork/src/CXX/Extensions.hxx:42,
from /home/jyothish/Projects/FreeCAD-fork/src/Base/Interpreter.h:44,
from /home/jyothish/Projects/FreeCAD-fork/src/Gui/Application.cpp:50:
/home/jyothish/Projects/FreeCAD-fork/src/CXX/Python3/PythonType.hxx: At global scope:
/home/jyothish/Projects/FreeCAD-fork/src/CXX/Python3/PythonType.hxx:206:14: error: declaration does not declare anything [-fpermissive]
206 | std::unordered_map<int, void*> slots;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/jyothish/Projects/FreeCAD-fork/src/Gui/Application.cpp: In member function ‘QStringList Gui::Application::workbenches() const’:
/home/jyothish/Projects/FreeCAD-fork/src/Gui/Application.cpp:1659:30: error: ‘PyUnicode_AsUTF8’ was not declared in this scope; did you mean ‘PyUnicode_AsUCS4’?
1659 | const char* wbName = PyUnicode_AsUTF8(key);
| ^~~~~~~~~~~~~~~~
| PyUnicode_AsUCS4
/home/jyothish/Projects/FreeCAD-fork/src/Gui/Application.cpp: In static member function ‘static void Gui::Application::runApplication()’:
/home/jyothish/Projects/FreeCAD-fork/src/Gui/Application.cpp:2245:28: warning: ‘static void QApplication::setActiveWindow(QWidget*)’ is deprecated: Use QWidget::activateWindow() instead. [-Wdeprecated-declarations]
2245 | mainApp.setActiveWindow(&mw);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/qt6/QtWidgets/QApplication:1,
from /home/jyothish/Projects/FreeCAD-fork/src/Gui/GuiApplicationNativeEventAware.h:26,
from /home/jyothish/Projects/FreeCAD-fork/src/Gui/GuiApplication.h:27,
from /home/jyothish/Projects/FreeCAD-fork/src/Gui/Application.cpp:74:
/usr/include/qt6/QtWidgets/qapplication.h:84:17: note: declared here
84 | static void setActiveWindow(QWidget* act);
| ^~~~~~~~~~~~~~~
make[2]: *** [src/Gui/CMakeFiles/FreeCADGui.dir/build.make:650: src/Gui/CMakeFiles/FreeCADGui.dir/Application.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:6753: src/Gui/CMakeFiles/FreeCADGui.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
@chennes said he had the same issue, but has no recollection of how he solved it. Pinging @wmayer.
I was compiling from git commit 245c803fd and everything worked fine for me.
From your build failure I don't see how this is related to Qt6. Could it be that you use a different Python version for your Qt5 and Qt6 builds?
I feel like the problem for me turned out to be something with PySide setting up the Python limited API... I'm sorry I didn't take any notes while I was fighting with it.
chennes wrote:I feel like the problem for me turned out to be something with PySide setting up the Python limited API... I'm sorry I didn't take any notes while I was fighting with it.
This is what I fear, too.
PyObjectBase.h includes Python.h and this is supposed to include all relevant headers so that the PyTypeObject is declared. Can you make the following test, please:
Open PyObjectBase.h and add this block directly after the include of Python.h
[ 55%] Building CXX object src/Mod/Web/App/CMakeFiles/Web.dir/Server.cpp.o
[ 55%] Building CXX object tests/CMakeFiles/Tests_run.dir/src/Base/Unit.cpp.o
[ 55%] Linking CXX shared library ../../../../Mod/Web/Web.so
[ 55%] Built target Web
[ 55%] Building CXX object src/Gui/CMakeFiles/FreeCADGui.dir/Application.cpp.o
[ 55%] Building CXX object src/Mod/Mesh/App/CMakeFiles/Mesh.dir/Core/Triangulation.cpp.o
In file included from /home/jyothish/Projects/FreeCAD-Qt6/src/Base/BaseClassPy.h:7,
from /home/jyothish/Projects/FreeCAD-Qt6/src/Base/PersistencePy.h:7,
from /home/jyothish/Projects/FreeCAD-Qt6/src/App/PropertyContainerPy.h:7,
from /home/jyothish/Projects/FreeCAD-Qt6/src/App/ExtensionContainerPy.h:7,
from /home/jyothish/Projects/FreeCAD-Qt6/src/App/DocumentObjectPy.h:7,
from /home/jyothish/Projects/FreeCAD-fork/src/Gui/Application.cpp:48:
/home/jyothish/Projects/FreeCAD-fork/src/Base/PyObjectBase.h:40:5: error: #error PY_LIMITED_API is set
40 | # error PY_LIMITED_API is set
| ^~~~~
[ 55%] Building CXX object src/Mod/Mesh/App/CMakeFiles/Mesh.dir/Core/Trim.cpp.o
I'm now at /Mod/Mesh and I can see that it is set.
It already starts to build Mesh but the error still occurs for FreeCADGui because it happens when building Gui/Application.cpp.
So, the define PY_LIMITED_API is set by a 3rd party library and the candidate most likely is shiboken or PySide. Now can you go through all .cmake files of your PySide and shiboken installations and search for PY_LIMITED_API, please?