Problem 2497

Summary: Geant 4.11.1.b01 problem with Qt during build
Product: Geant4 Reporter: korsch
Component: cmakeAssignee: Ben Morgan <Ben.Morgan>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P4    
Version: other   
Hardware: Apple   
OS: Mac OS X   

Description korsch 2022-07-01 23:30:31 CEST
Hi,
 I tried to compile the new beta version (4.11.1.b01) on a Mac OS 12.4 (Intel) and I get a bunch of errors in the Qt section (see below). It was configured (cmake) using -DGEANT_USE_QT=ON. Any ideas?

Thanks,
 Wolfgang
 

[ 17%] Building CXX object source/CMakeFiles/G4interfaces.dir/interfaces/common/src/G4Xt.cc.o
In file included from /usr/local/cern/geant4/geant4-v11.1.b01/source/interfaces/basic/src/G4UIQt.cc:34:
/usr/local/cern/geant4/geant4-v11.1.b01/source/interfaces/basic/include/G4UIQt.hh:54:7: error: definition of type 'QStringList' conflicts with type alias of the same name
class QStringList;
      ^
/usr/local/include/QtCore/qcontainerfwd.h:64:7: note: 'QStringList' declared here
using QStringList = QList<QString>;
      ^
In file included from /usr/local/cern/geant4/geant4-v11.1.b01/source/interfaces/basic/src/G4UIExecutive.cc:31:
/usr/local/cern/geant4/geant4-v11.1.b01/source/interfaces/basic/include/G4UIQt.hh:54:7: error: definition of type 'QStringList' conflicts with type alias of the same name
class QStringList;
      ^
/usr/local/include/QtCore/qcontainerfwd.h:64:7: note: 'QStringList' declared here
using QStringList = QList<QString>;
      ^
In file included from /usr/local/cern/geant4/geant4-v11.1.b01/source/interfaces/basic/src/G4UIQt.cc:48:
/usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qlayout.h:129:5: error: unknown type name 'QT6_VIRTUAL'
    QT6_VIRTUAL int indexOf(QLayoutItem *) const;
    ^
/usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qlayout.h:134:5: error: unknown type name 'QT6_VIRTUAL'
    QT6_VIRTUAL QLayoutItem *replaceWidget(QWidget *from, QWidget *to,
    ^
/usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qlayout.h:134:28: error: expected ';' at end of declaration list
    QT6_VIRTUAL QLayoutItem *replaceWidget(QWidget *from, QWidget *to,
                           ^
/usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qlayout.h:163:41: error: must use 'class' tag to refer to type 'QLayoutItem' in this scope
    static void activateRecursiveHelper(QLayoutItem *item);
                                        ^
/usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qlayout.h:134:17: note: class 'QLayoutItem' is hidden by a non-type declaration of 'QLayoutItem' here
    QT6_VIRTUAL QLayoutItem *replaceWidget(QWidget *from, QWidget *to,

......
Comment 1 Ben Morgan 2022-07-02 17:39:36 CEST
Which version of Qt is this? Note that Geant4 does not currently support Qt6, though we expect to do so for the 11.1 release in December.
Comment 2 Ben Morgan 2022-07-13 15:44:41 CEST
Just to follow up, this does look like a problem I've seen with Homebrew qt on macOS. What's likely happened is that both the qt (Qt6) and qt@5 formulae are installed, and the qt one is linked. Due to search order of include paths, I think headers from both formulae get mixed up and result in the errors.

What does work is to "brew unlink qt" before building Geant4. That shouldn't break other formulae that depend on qt, though I can't guarantee that.
Comment 3 korsch 2022-07-13 21:50:36 CEST
Hi Ben,
 Thanks for your feedback. You were right, the issue was due to qt6. Unlinking it in homebrew fixed it. Thanks for the help.

Best,
 Wolfgang
Comment 4 Ben Morgan 2022-07-14 14:20:59 CEST
Thanks! I'm marking as "RESOLVED INVALID" as that's the only status that makes sense, but work is ongoing to support Qt6 for the next release, and we'll note this potential clash in the documentation.