You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building DD4hep against a Geant4 installation that was built with a different CXX_STANDARD, the Geant4 one will be used to compile DDG4, as it becomes part of Geant4_CXX_FLAGS, which are in turn used to compile DDG4, at least in my build:
This can lead to build errors when this is not compatible with the one used by ROOT.
root/spack/lib/spack/env/gcc/g++ -DBOOST_SPIRIT_USE_PHOENIX_V3 -DDD4HEP_USE_TINYXML -DDDG4_EXPORTS -DG4LIB_BUILD_DLL -DG4UI_USE_TCSH -I/tmp/root/spack-stage/spack-stage-dd4hep-1.27-tpk4d52f757bndwiuyx2binippaeonbi/spack-src/DDG4/include -I/tmp/root/spack-stage/spack-stage-dd4hep-1.27-tpk4d52f757bndwiuyx2binippaeonbi/spack-src/DDCore/include -I/tmp/root/spack-stage/spack-stage-dd4hep-1.27-tpk4d52f757bndwiuyx2binippaeonbi/spack-src/DDParsers/include -isystem /root/spack/opt/spack/linux-almalinux9-broadwell/gcc-11.3.1/root-6.28.06-3ynbwb3imflq2qnrl3ophmt7o7knilmz/include/root -isystem /root/spack/opt/spack/linux-almalinux9-broadwell/gcc-11.3.1/boost-1.83.0-zvpm7l67mphzg6bs733aqqysfnwyauzp/include -isystem /root/spack/opt/spack/linux-almalinux9-broadwell/gcc-11.3.1/geant4-10.7.4-wrl76wz3d4xy5rxbtfow5yn6vswl2xyn/include/Geant4 -isystem /root/spack/opt/spack/linux-almalinux9-broadwell/gcc-11.3.1/clhep-2.4.6.4-schzolggr2q3rt2pyz5wnsc6os6idxyu/include -isystem /root/spack/opt/spack/linux-almalinux9-broadwell/gcc-11.3.1/zlib-ng-2.1.4-43pipt6aq3bztdhamxiy2jzxu4miaoox/include -isystem /root/spack/opt/spack/linux-almalinux9-broadwell/gcc-11.3.1/expat-2.5.0-chqhbuyyswtm7knv46x3lozm4prsufie/include -isystem /root/spack/opt/spack/linux-almalinux9-broadwell/gcc-11.3.1/xerces-c-3.2.4-hwqxluk7hv42im7wp3ukpkyo6hrq67ev/include -ftls-model=global-dynamic -Wno-psabi -pedantic -Wextra -Wall -fdiagnostics-color=auto -Wdeprecated -Wno-long-long -Wformat-security -Wshadow -pthread -O3 -DNDEBUG -std=c++17 -fPIC -W -Wall -pedantic -Wno-non-virtual-dtor -Wno-long-long -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -Wno-variadic-macros -Wshadow -pipe -pthread -ftls-model=global-dynamic -std=c++14 -MD -MT DDG4/CMakeFiles/DDG4.dir/src/Geant4Converter.cpp.o -MF DDG4/CMakeFiles/DDG4.dir/src/Geant4Converter.cpp.o.d -o DDG4/CMakeFiles/DDG4.dir/src/Geant4Converter.cpp.o -c /tmp/root/spack-stage/spack-stage-dd4hep-1.27-tpk4d52f757bndwiuyx2binippaeonbi/spack-src/DDG4/src/Geant4Converter.cpp
...
/root/spack/opt/spack/linux-almalinux9-broadwell/gcc-11.3.1/root-6.28.06-3ynbwb3imflq2qnrl3ophmt7o7knilmz/include/root/TString.h:869:32: note: 'std::string_view' is only available from C++17 onwards
869 | std::string printValue(const std::string_view* val);
| ^~~
/tmp/root/spack-stage/spack-stage-dd4hep-1.27-tpk4d52f757bndwiuyx2binippaeonbi/spack-src/DDG4/src/Geant4Converter.cpp: In member function 'void dd4hep::sim::Geant4Converter::handleProperties(dd4hep::Detector::Properties&) const':
/tmp/root/spack-stage/spack-stage-dd4hep-1.27-tpk4d52f757bndwiuyx2binippaeonbi/spack-src/DDG4/src/Geant4Converter.cpp:1222:20: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
1222 | for( const auto& [nam, vals] : prp ) {
I saw this as part of a spack build but should not be spack-specific in any way. It's not a bug per se, but I would have expected that the DD4hep CXX STANDARD is used throughout. Also, in my case, it's very possible to build DD4hep (cxxstd=17) against ROOT (cxxstd=17) and Geant4 (cxxstd=14) with some tweaks to the cmake config.
OS version: alma9
Compiler version: GCC 11.3.1
Package version: 01-27
Reproduced by: cmake .. ( using ROOT cxxstd=17 and Geant4 cxxstd=14 )
Output:see text
Goal: build DD4hep against ROOT cxxstd=17 and Geant4 cxxstd=14
The text was updated successfully, but these errors were encountered:
Aha I didn't remember this. In my case it was Geant4 with c++11 and then building with c++17 doesn't work because DD4hep needs at least c++14. To begin with, I'm not sure gcc should be happy when you pass --std=c++17 --std=c++11 and then keeps the second one, but it is 🤷
When building DD4hep against a Geant4 installation that was built with a different CXX_STANDARD, the Geant4 one will be used to compile DDG4, as it becomes part of Geant4_CXX_FLAGS, which are in turn used to compile DDG4, at least in my build:
This can lead to build errors when this is not compatible with the one used by ROOT.
I saw this as part of a spack build but should not be spack-specific in any way. It's not a bug per se, but I would have expected that the DD4hep CXX STANDARD is used throughout. Also, in my case, it's very possible to build DD4hep (cxxstd=17) against ROOT (cxxstd=17) and Geant4 (cxxstd=14) with some tweaks to the cmake config.
The text was updated successfully, but these errors were encountered: