I made the mistake of trying to migrate both G4 libraries and OS at the same time. I’m on a Mac (M4 Max), running Sequoia 15.4.1, clang 17.0.0, cmake 4.0.1 and geant4 v11.3.2.
While I’m able to build example basic/B4d which uses G4AnalysisManager.hh, I’m getting a long set of errors, see below, when I try to build my own code. One distinction is that I use a set of base classes, creatively named Base, that is shared across many of my applications. The error appears to where I include “G4AnalysisManager.hh” in the RunAction.cc file for the base class. Below are the a couple of examples of the 20 errors. Any help figuring out what I’m doing wrong would be appreciated.
In file included from /Users/d3m222/geant4/projects/base/src/BaseRunAction.cc:7:
In file included from /usr/local/geant4-v11.3.2/install/include/Geant4/G4AnalysisManager.hh:32:
In file included from /usr/local/geant4-v11.3.2/install/include/Geant4/G4GenericAnalysisManager.hh:35:
In file included from /usr/local/geant4-v11.3.2/install/include/Geant4/G4ToolsAnalysisManager.hh:34:
In file included from /usr/local/geant4-v11.3.2/install/include/Geant4/G4VAnalysisManager.hh:40:
/usr/local/geant4-v11.3.2/install/include/Geant4/G4AnalysisManagerState.hh:80:39: error: constexpr variable 'fkClass' must be initialized by a constant expression
80 | static constexpr std::string_view fkClass { "G4AnalysisManagerState" };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:270:10: note: non-constexpr function 'length' cannot be used in a constant expression
270 | _Traits::length(__s);
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:346:31: note: in call to '__char_traits_length_checked<std::char_traits<char>>(&"G4AnalysisManagerState"[0])'
346 | : __data_(__s), __size_(std::__char_traits_length_checked<_Traits>(__s)) {}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/geant4-v11.3.2/install/include/Geant4/G4AnalysisManagerState.hh:80:39: note: in call to 'basic_string_view(&"G4AnalysisManagerState"[0])'
80 | static constexpr std::string_view fkClass { "G4AnalysisManagerState" };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string/char_traits.h:128:76: note: declared here
128 | static inline _LIBCPP_HIDE_FROM_ABI size_t _LIBCPP_CONSTEXPR_SINCE_CXX17 length(const char_type* __s) _NOEXCEPT {
| ^
In file included from /Users/d3m222/geant4/projects/base/src/BaseRunAction.cc:7:
In file included from /usr/local/geant4-v11.3.2/install/include/Geant4/G4AnalysisManager.hh:32:
In file included from /usr/local/geant4-v11.3.2/install/include/Geant4/G4GenericAnalysisManager.hh:35:
In file included from /usr/local/geant4-v11.3.2/install/include/Geant4/G4ToolsAnalysisManager.hh:34:
In file included from /usr/local/geant4-v11.3.2/install/include/Geant4/G4VAnalysisManager.hh:41:
/usr/local/geant4-v11.3.2/install/include/Geant4/G4AnalysisUtilities.hh:69:28: error: constexpr variable 'kNamespaceName' must be initialized by a constant expression
69 | constexpr std::string_view kNamespaceName { "G4Analysis" };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:270:10: note: non-constexpr function 'length' cannot be used in a constant expression
270 | _Traits::length(__s);
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:346:31: note: in call to '__char_traits_length_checked<std::char_traits<char>>(&"G4Analysis"[0])'
346 | : __data_(__s), __size_(std::__char_traits_length_checked<_Traits>(__s)) {}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/geant4-v11.3.2/install/include/Geant4/G4AnalysisUtilities.hh:69:28: note: in call to 'basic_string_view(&"G4Analysis"[0])'
69 | constexpr std::string_view kNamespaceName { "G4Analysis" };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string/char_traits.h:128:76: note: declared here
128 | static inline _LIBCPP_HIDE_FROM_ABI size_t _LIBCPP_CONSTEXPR_SINCE_CXX17 length(const char_type* __s) _NOEXCEPT {
|
Geant4 Version: 11.3.2
Operating System: MacOS Sequoia 15.4.1
Compiler/Version:. clang 17.0.0
CMake Version: cmake 4.0.1