Details
Description
It is not possible to build PySide2 v5.11.0 TP inside the "brew install" environment. The build stops with the following error
[ 95%] Building CXX object PySide2/QtUiTools/CMakeFiles/QtUiTools.dir/PySide2/QtUiTools/quiloader_wrapper.cpp.o
clang: error: no such file or directory: '/tmp/pyside-20180701-18189-rfzsud/pyside-setup-everywhere-src-5.11.0/pyside2_build/py2.7-qt5.11.1-64bit-release/pyside2/PySide2/QtUiTools/PySide2/QtUiTools/quiloader_wrapper.cpp'
which is preceded by this warning:
qt.shiboken: (uitools) type 'QUiLoader' is specified in typesystem, but not defined. This could potentially lead to compilation errors.
The environment set by "brew install" passes qt headers as system headers (-isystem) and shiboken is configured to ignore such headers. In a brew install build, qt headers are then passed both as both system and non-system (-isystem/usr/local/opt/qt/include vs -i...). Oddly, almost all the modules are still capable to find the right headers with the only exception of QUiLoader class. Building works fine on the same system using the same sources if ran outside the "brew install" environment.
This issue currently prevents the creation of a pyside formula for homebrew. Workarounds for this consist in skipping the module (by adding --skip-modules=UiTools to the setup.py command), or in patching the clang header parser as
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp index 5192e9e7..431ce36a 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp @@ -636,6 +636,7 @@ bool Builder::visitLocation(const CXSourceLocation &location) const || compareHeaderName(cFileName, "gltypes.h") || cStringStartsWith("/usr/include/_types", cFileName) || cStringStartsWith("/usr/include/sys/_types", cFileName) + || cStringStartsWith("/usr/local/opt", cFileName) #endif ; clang_disposeString(cxFileName);
The patch also allows importing and using the PySide2.QtUiTools module in builds done inside "brew install". Thanks to Alexandru Croitor for providing both these temporary workarounds.