Persistency/gdml/G02 example

Hi,

I’m having difficulties getting any of the G02 examples to run (I use here {} to mean quotes). I have had to apply a number of fixes to get other examples to run:

  • changing the alias of MaxOSX.sdk from 12.0 to 11.3 in the folder {/Library/Developer/CommandLineTools/SDKs/}
  • changing the filepath of xercesc using the command {find . -type f -name “*.hh” -print0 | xargs -0 sed -ie “s/<xercesc//</usr/local/Cellar/xerces-c/3.2.3/include/xercesc//g”}, with *.hh, *.c and *.hpp in the folder /usr/local/Cellar/xerces-c/3.2.3/include/xercesc/ because cmake complained it couldn’t find {#include <xercesc/…>} statements
  • having a .sh script with export statements like {export G4LEDATA=a_direct_filepath} etc as explained in the Geant4 Installation Guide Documentation, Release 10.7 on p28 (that I also have in my ~/.bashrc file but which don’t do anything when an example project is opened in its build folder and the command {cmake -S … -B .} is run

I am now at the stage trying to fix these problems where I run:
{cmake -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_GDML=ON -S … -B .}
which executes ok

then:
{make}

and get the error:
{Consolidate compiler generated dependencies of target geotest
[ 14%] Building CXX object CMakeFiles/geotest.dir/geotest.cc.o
[ 28%] Building CXX object CMakeFiles/geotest.dir/src/G02DetectorConstruction.cc.o
[ 42%] Building CXX object CMakeFiles/geotest.dir/src/G02DetectorMessenger.cc.o
[ 57%] Linking CXX executable geotest
Undefined symbols for architecture x86_64:
“_G4cout”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
G02DetectorConstruction::ListOfMaterials() in G02DetectorConstruction.cc.o
G02RunAction::BeginOfRunAction(G4Run const*) in G02RunAction.cc.o
“G4GDMLRead::Read(G4String const&, bool, bool, bool)”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
“G4GDMLWrite::Write(G4String const&, G4LogicalVolume const*, G4String const&, int, bool)”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
“G4GDMLParser::ExportRegions(bool)”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
“G4GDMLParser::ImportRegions()”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
“G4GDMLParser::G4GDMLParser()”, referenced from:
G02DetectorConstruction::G02DetectorConstruction() in G02DetectorConstruction.cc.o
“G4GDMLParser::~G4GDMLParser()”, referenced from:
G02DetectorConstruction::G02DetectorConstruction() in G02DetectorConstruction.cc.o
G02DetectorConstruction::~G02DetectorConstruction() in G02DetectorConstruction.cc.o
“G4GDMLReadStructure::GetWorldVolume(G4String const&)”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
“G4STRead::Read(G4String const&, G4Material*, G4Material*)”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [geotest] Error 1
make[1]: *** [CMakeFiles/geotest.dir/all] Error 2
make: *** [all] Error 2}

I don’t really know what I’m doing when fixing all these issues. I hope the process will be made easier for beginners as the current setup is troublesome on Mac. Would greatly appreciate any help, on any of these issues.

What errors were you seeing that required this, and which version of macOS is this?

This should not be necessary - again, what error messages were you seeing?

if the script is sourced in the .bashrc, then the G4... env vars should be set in every new terminal session opened. If env isn’t showing these variables to be set in the environment, then there’s something wrong with that script, or it’s not getting sourced in the .bashrc.

Could you run make VERBOSE=1 and post the output here please?

Hi bmorgan, thanks for the reply

  1. I get the error:

CMake Error at /Applications/CMake.app/Contents/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler

"/usr/local/bin/x86_64-apple-darwin21-g++-11"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_5d0e9/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_5d0e9.dir/build.make CMakeFiles/cmTC_5d0e9.dir/build
Building C object CMakeFiles/cmTC_5d0e9.dir/testCCompiler.c.o
/usr/local/bin/x86_64-apple-darwin21-g++-11    -o CMakeFiles/cmTC_5d0e9.dir/testCCompiler.c.o -c /Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1/build/CMakeFiles/CMakeTmp/testCCompiler.c
cc1plus: error: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/local/include: Not a directory
cc1plus: error: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include: Not a directory
cc1plus: error: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks: Not a directory
cc1plus: error: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/Library/Frameworks: Not a directory
make[1]: *** [CMakeFiles/cmTC_5d0e9.dir/testCCompiler.c.o] Error 1
make: *** [cmTC_5d0e9/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:7 (project)

This is macOS Monterey version 12.0.1. My previous fix involved just making the MacOSX12.sdk alias go to MacOSX11.3.sdk folder, or deleting all the references to 12.0/12 in the /Library/Developer/CommandLineTools/SDKs/ folder.

  1. I replicated the output by reversing an edit on one of my files DOM.hpp:

/usr/local/Cellar/xerces-c/3.2.3/include/xercesc/dom/DOM.hpp:30:10: fatal error: ‘include/xercesc/dom/DOMAttr.hpp’ file not found
#include <include/xercesc/dom/DOMAttr.hpp>

  1. So if I open up a new project folder e.g. B1example if I initially do:

(base) edwardtaylor@Edwards-MacBook-Pro build % cmake -S … -B .
zsh: command not found: cmake

and doing:

(base) edwardtaylor@Edwards-MacBook-Pro build % cat ~/.bashrc
source /usr/local/share/Geant4-10.7.2/geant4make/geant4make.sh
source /usr/local/share/Geant4-10.7.2/bin/geant4.sh
source /Users/edwardtaylor/Documents/PhD/Geant4/geant4.10.07.p02
export G4LEDATA=/usr/local/share/Geant4-10.7.2/data/G4EMLOW7.13
export G4LEVELGAMMADATA=/usr/local/share/Geant4-10.7.2/data/PhotonEvaporation5.7
export G4PARTICLEXSDATA=/usr/local/share/Geant4-10.7.2/data/G4PARTICLEXS3.1.1
export G4ENSDFSTATEDATA=/usr/local/share/Geant4-10.7.2/data/G4ENSDFSTATE2.3
PATH=$PATH:/Applications/CMake.App/Contents/bin

To be honest I’ve been pretty stupid: I’m using zsh so it needed to be in ~/.zshrc and that seems to work.

  1. Doing that gives (sorry its long)

(base) edwardtaylor@Edwards-MacBook-Pro build % make VERBOSE=1
/Applications/CMake.app/Contents/bin/cmake -S/Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02 -B/Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build --check-build-system CMakeFiles/Makefile.cmake 0
/Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build/CMakeFiles /Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build//CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 all
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/geotest.dir/build.make CMakeFiles/geotest.dir/depend
cd /Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends “Unix Makefiles” /Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02 /Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02 /Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build /Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build /Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build/CMakeFiles/geotest.dir/DependInfo.cmake --color=
Dependencies file “CMakeFiles/geotest.dir/geotest.cc.o.d” is newer than depends file “/Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build/CMakeFiles/geotest.dir/compiler_depend.internal”.
Dependencies file “CMakeFiles/geotest.dir/src/G02ChamberParameterisation.cc.o.d” is newer than depends file “/Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build/CMakeFiles/geotest.dir/compiler_depend.internal”.
Dependencies file “CMakeFiles/geotest.dir/src/G02DetectorConstruction.cc.o.d” is newer than depends file “/Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build/CMakeFiles/geotest.dir/compiler_depend.internal”.
Dependencies file “CMakeFiles/geotest.dir/src/G02DetectorMessenger.cc.o.d” is newer than depends file “/Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build/CMakeFiles/geotest.dir/compiler_depend.internal”.
Dependencies file “CMakeFiles/geotest.dir/src/G02PrimaryGeneratorAction.cc.o.d” is newer than depends file “/Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build/CMakeFiles/geotest.dir/compiler_depend.internal”.
Dependencies file “CMakeFiles/geotest.dir/src/G02RunAction.cc.o.d” is newer than depends file “/Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/build/CMakeFiles/geotest.dir/compiler_depend.internal”.
Consolidate compiler generated dependencies of target geotest
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/geotest.dir/build.make CMakeFiles/geotest.dir/build
[ 14%] Linking CXX executable geotest
/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/geotest.dir/link.txt --verbose=1
/usr/bin/clang++ -W -Wall -pedantic -Wno-non-virtual-dtor -Wno-long-long -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -Wno-variadic-macros -Wshadow -pipe -Qunused-arguments -DGL_SILENCE_DEPRECATION -stdlib=libc++ -pthread -ftls-model=initial-exec -std=c++11 -O3 -DNDEBUG -fno-trapping-math -ftree-vectorize -fno-math-errno -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/geotest.dir/geotest.cc.o CMakeFiles/geotest.dir/src/G02ChamberParameterisation.cc.o CMakeFiles/geotest.dir/src/G02DetectorConstruction.cc.o CMakeFiles/geotest.dir/src/G02DetectorMessenger.cc.o CMakeFiles/geotest.dir/src/G02PrimaryGeneratorAction.cc.o CMakeFiles/geotest.dir/src/G02RunAction.cc.o -o geotest -Wl,-rpath,/usr/local/lib /usr/local/lib/libG4Tree.dylib /usr/local/lib/libG4FR.dylib /usr/local/lib/libG4GMocren.dylib /usr/local/lib/libG4visHepRep.dylib /usr/local/lib/libG4RayTracer.dylib /usr/local/lib/libG4VRML.dylib /usr/local/lib/libG4OpenGL.dylib /usr/local/lib/libG4gl2ps.dylib /usr/local/lib/libG4visQt3D.dylib /usr/local/lib/libG4vis_management.dylib /usr/local/lib/libG4modeling.dylib /usr/local/lib/libG4interfaces.dylib /usr/local/lib/libG4persistency.dylib /usr/local/lib/libG4error_propagation.dylib /usr/local/lib/libG4readout.dylib /usr/local/lib/libG4physicslists.dylib /usr/local/lib/libG4tasking.dylib /usr/local/lib/libG4parmodels.dylib /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/OpenGL.framework/OpenGL.tbd /usr/local/Cellar/qt@5/5.15.2/lib/QtOpenGL.framework/QtOpenGL /usr/local/Cellar/qt@5/5.15.2/lib/QtPrintSupport.framework/QtPrintSupport /usr/local/Cellar/qt@5/5.15.2/lib/QtWidgets.framework/QtWidgets /usr/local/Cellar/qt@5/5.15.2/lib/Qt3DExtras.framework/Qt3DExtras /usr/local/Cellar/qt@5/5.15.2/lib/Qt3DInput.framework/Qt3DInput /usr/local/Cellar/qt@5/5.15.2/lib/QtGamepad.framework/QtGamepad /usr/local/Cellar/qt@5/5.15.2/lib/Qt3DLogic.framework/Qt3DLogic /usr/local/Cellar/qt@5/5.15.2/lib/Qt3DRender.framework/Qt3DRender /usr/local/Cellar/qt@5/5.15.2/lib/Qt3DCore.framework/Qt3DCore /usr/local/Cellar/qt@5/5.15.2/lib/QtGui.framework/QtGui /usr/local/Cellar/qt@5/5.15.2/lib/QtNetwork.framework/QtNetwork /usr/local/Cellar/qt@5/5.15.2/lib/QtCore.framework/QtCore /usr/local/lib/libG4run.dylib /usr/local/lib/libG4event.dylib /usr/local/lib/libG4tracking.dylib /usr/local/lib/libG4processes.dylib /usr/local/lib/libG4analysis.dylib /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libexpat.tbd /usr/local/lib/libG4digits_hits.dylib /usr/local/lib/libG4track.dylib /usr/local/lib/libG4particles.dylib /usr/local/lib/libG4geometry.dylib /usr/local/lib/libG4materials.dylib /usr/local/lib/libG4zlib.dylib /usr/local/lib/libG4graphics_reps.dylib /usr/local/lib/libG4intercoms.dylib /usr/local/lib/libG4global.dylib /usr/local/lib/libG4clhep.dylib /usr/local/lib/libG4ptl.0.0.2.dylib
Undefined symbols for architecture x86_64:
“_G4cout”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
G02DetectorConstruction::ListOfMaterials() in G02DetectorConstruction.cc.o
G02RunAction::BeginOfRunAction(G4Run const*) in G02RunAction.cc.o
“G4GDMLRead::Read(G4String const&, bool, bool, bool)”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
“G4GDMLWrite::Write(G4String const&, G4LogicalVolume const*, G4String const&, int, bool)”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
“G4GDMLParser::ExportRegions(bool)”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
“G4GDMLParser::ImportRegions()”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
“G4GDMLParser::G4GDMLParser()”, referenced from:
G02DetectorConstruction::G02DetectorConstruction() in G02DetectorConstruction.cc.o
“G4GDMLParser::~G4GDMLParser()”, referenced from:
G02DetectorConstruction::G02DetectorConstruction() in G02DetectorConstruction.cc.o
G02DetectorConstruction::~G02DetectorConstruction() in G02DetectorConstruction.cc.o
“G4GDMLReadStructure::GetWorldVolume(G4String const&)”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
“G4STRead::Read(G4String const&, G4Material*, G4Material*)”, referenced from:
G02DetectorConstruction::Construct() in G02DetectorConstruction.cc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [geotest] Error 1
make[1]: *** [CMakeFiles/geotest.dir/all] Error 2
make: *** [all] Error 2
(base) edwardtaylor@Edwards-MacBook-Pro build %

Thanks for the detailed info. I’m not sure if these issues are interrelated or not…

That’s the GCC compiler rather than the expected system compiler for Monterey (/usr/bin/clang and /usr/bin/clang++). I’m surprised CMake is picking GCC up like this instead of the system ones, and later on in (4) , it is using clang/clang++. So there’s something inconsistent here.

Given that the system is Monterey, I think the SDK should be 12.0.

I still think this indicates an issue with the local system, not CMake or Geant4. I would reinstall xerces-c from homebrew to fix all the hacks made here.

O.k.! The only thing to spot here is the PATH change needs to be exported (Also, unless you need the GUI/other things, Homebrew can install cmake for you)

Long is good in this case! The link line shows that all of the Geant4 libs are being linked, so I’m not sure why _G4cout is not found. The remainder indicate that the install of Geant4 being used probably wasn’t compiled with GDML support. That can be checked by running

$ geant4-config --has-feature gdml

which will print “yes” if the install supports GDML.

Thanks again for your help.

  1. I have set the CC=/usr/bin/clang and taken the SDK 12.0 and its alias out of the trash (I have not changed any of the cmake files which means I think it still points to 11.3 even though the alias below points to 12.0.sdk)

(base) edwardtaylor@Edwards-MacBook-Pro ~ % xcrun --show-sdk-path

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

  • no errors thus far
  1. I have brew reinstalled xercesc-c
  • no errors thus far
  1. I updated both the ~/.bashrc and ~/.zshrc with the export
  • seems to work fine

4a) This error still persists with all the above changes. When I also run:

(base) edwardtaylor@Edwards-MacBook-Pro build % geant4-config --has-feature gdml
no

I do wish to use gdml and make sure this a yes

4b) the error seen earlier also persists for running any of the exampels/codes in Geant4

(base) edwardtaylor@Edwards-MacBook-Pro build % make VERBOSE=1
/Applications/CMake.app/Contents/bin/cmake -S/Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1 -B/Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1/build --check-build-system CMakeFiles/Makefile.cmake 0
/Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1/build/CMakeFiles /Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1/build//CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 all
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/exampleB1.dir/build.make CMakeFiles/exampleB1.dir/depend
cd /Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends “Unix Makefiles” /Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1 /Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1 /Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1/build /Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1/build /Users/edwardtaylor/Documents/PhD/Geant4/Ed_examples/test_B1/build/CMakeFiles/exampleB1.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/exampleB1.dir/build.make CMakeFiles/exampleB1.dir/build
[ 6%] Linking CXX executable exampleB1
/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/exampleB1.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/c++ -W -Wall -pedantic -Wno-non-virtual-dtor -Wno-long-long -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -Wno-variadic-macros -Wshadow -pipe -Qunused-arguments -DGL_SILENCE_DEPRECATION -stdlib=libc++ -pthread -ftls-model=initial-exec -std=c++11 -O3 -DNDEBUG -fno-trapping-math -ftree-vectorize -fno-math-errno -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/exampleB1.dir/exampleB1.cc.o CMakeFiles/exampleB1.dir/src/B1ActionInitialization.cc.o CMakeFiles/exampleB1.dir/src/B1DetectorConstruction.cc.o CMakeFiles/exampleB1.dir/src/B1EventAction.cc.o CMakeFiles/exampleB1.dir/src/B1MagneticField.cc.o CMakeFiles/exampleB1.dir/src/B1Physics.cc.o CMakeFiles/exampleB1.dir/src/B1PrimaryGeneratorAction.cc.o CMakeFiles/exampleB1.dir/src/B1RunAction.cc.o CMakeFiles/exampleB1.dir/src/Make_conical_multifoil_target.cc.o CMakeFiles/exampleB1.dir/src/Make_cylindrical_multifoil_target.cc.o CMakeFiles/exampleB1.dir/src/MultifoilHit.cc.o CMakeFiles/exampleB1.dir/src/MultifoilSD.cc.o CMakeFiles/exampleB1.dir/src/Multifoil_Parameterisation.cc.o CMakeFiles/exampleB1.dir/src/detector.cc.o -o exampleB1 -Wl,-rpath,/usr/local/lib /usr/local/lib/libG4Tree.dylib /usr/local/lib/libG4FR.dylib /usr/local/lib/libG4GMocren.dylib /usr/local/lib/libG4visHepRep.dylib /usr/local/lib/libG4RayTracer.dylib /usr/local/lib/libG4VRML.dylib /usr/local/lib/libG4OpenGL.dylib /usr/local/lib/libG4gl2ps.dylib /usr/local/lib/libG4visQt3D.dylib /usr/local/lib/libG4vis_management.dylib /usr/local/lib/libG4modeling.dylib /usr/local/lib/libG4interfaces.dylib /usr/local/lib/libG4persistency.dylib /usr/local/lib/libG4error_propagation.dylib /usr/local/lib/libG4readout.dylib /usr/local/lib/libG4physicslists.dylib /usr/local/lib/libG4tasking.dylib /usr/local/lib/libG4parmodels.dylib /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/OpenGL.framework/OpenGL.tbd /usr/local/Cellar/qt@5/5.15.2/lib/QtOpenGL.framework/QtOpenGL /usr/local/Cellar/qt@5/5.15.2/lib/QtPrintSupport.framework/QtPrintSupport /usr/local/Cellar/qt@5/5.15.2/lib/QtWidgets.framework/QtWidgets /usr/local/Cellar/qt@5/5.15.2/lib/Qt3DExtras.framework/Qt3DExtras /usr/local/Cellar/qt@5/5.15.2/lib/Qt3DInput.framework/Qt3DInput /usr/local/Cellar/qt@5/5.15.2/lib/QtGamepad.framework/QtGamepad /usr/local/Cellar/qt@5/5.15.2/lib/Qt3DLogic.framework/Qt3DLogic /usr/local/Cellar/qt@5/5.15.2/lib/Qt3DRender.framework/Qt3DRender /usr/local/Cellar/qt@5/5.15.2/lib/Qt3DCore.framework/Qt3DCore /usr/local/Cellar/qt@5/5.15.2/lib/QtGui.framework/QtGui /usr/local/Cellar/qt@5/5.15.2/lib/QtNetwork.framework/QtNetwork /usr/local/Cellar/qt@5/5.15.2/lib/QtCore.framework/QtCore /usr/local/lib/libG4run.dylib /usr/local/lib/libG4event.dylib /usr/local/lib/libG4tracking.dylib /usr/local/lib/libG4processes.dylib /usr/local/lib/libG4analysis.dylib /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libexpat.tbd /usr/local/lib/libG4digits_hits.dylib /usr/local/lib/libG4track.dylib /usr/local/lib/libG4particles.dylib /usr/local/lib/libG4geometry.dylib /usr/local/lib/libG4materials.dylib /usr/local/lib/libG4zlib.dylib /usr/local/lib/libG4graphics_reps.dylib /usr/local/lib/libG4intercoms.dylib /usr/local/lib/libG4global.dylib /usr/local/lib/libG4clhep.dylib /usr/local/lib/libG4ptl.0.0.2.dylib
Undefined symbols for architecture x86_64:
“_G4cout”, referenced from:
MultifoilHit::Print() in MultifoilHit.cc.o
MySensitiveDetector::ProcessHits(G4Step*, G4TouchableHistory*) in detector.cc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [exampleB1] Error 1
make[1]: *** [CMakeFiles/exampleB1.dir/all] Error 2
make: *** [all] Error 2

you probably have, but did not mention it specifically: did you also recompile geant4 after step 2?

Hi Weller, do you mean just doing:

cmake -S … -B . -

then

make

Instead when I do

rm -rf build

mkdir build

cd build

cmake -S … -B .

then

(base) edwardtaylor@Edwards-MacBook-Pro build % make
[ 14%] Building CXX object CMakeFiles/geotest.dir/geotest.cc.o
In file included from /Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/geotest.cc:39:
In file included from /usr/local/include/Geant4/G4RunManagerFactory.hh:37:
In file included from /usr/local/include/Geant4/G4Types.hh:74:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/complex:237:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:321:9: error: no member named ‘signbit’ in the global namespace
using ::signbit;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:322:9: error: no member named ‘fpclassify’ in the global namespace
using ::fpclassify;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:323:9: error: no member named ‘isfinite’ in the global namespace; did you mean ‘finite’?
using ::isfinite;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/math.h:752:12: note: ‘finite’ declared here
extern int finite(double)
^
In file included from /Users/edwardtaylor/Documents/PhD/Geant4/examples/extended/persistency/gdml/G02/geotest.cc:39:
In file included from /usr/local/include/Geant4/G4RunManagerFactory.hh:37:
In file included from /usr/local/include/Geant4/G4Types.hh:74:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/complex:237:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:324:9: error: no member named ‘isinf’ in the global namespace
using ::isinf;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:325:9: error: no member named ‘isnan’ in the global namespace
using ::isnan;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:326:9: error: no member named ‘isnormal’ in the global namespace
using ::isnormal;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:327:9: error: no member named ‘isgreater’ in the global namespace
using ::isgreater;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:328:9: error: no member named ‘isgreaterequal’ in the global namespace
using ::isgreaterequal;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:329:9: error: no member named ‘isless’ in the global namespace
using ::isless;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:330:9: error: no member named ‘islessequal’ in the global namespace
using ::islessequal;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:331:9: error: no member named ‘islessgreater’ in the global namespace
using ::islessgreater;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:332:9: error: no member named ‘isunordered’ in the global namespace
using ::isunordered;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:333:9: error: no member named ‘isunordered’ in the global namespace
using ::isunordered;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:644:26: error: no template named ‘numeric_limits’
bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:644:60: error: no template named ‘numeric_limits’
bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:645:18: error: no template named ‘numeric_limits’
int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:645:50: error: no template named ‘numeric_limits’
int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:650:17: error: no template named ‘numeric_limits’
static_assert(numeric_limits<_FloatT>::radix == 2, “FloatT has incorrect radix”);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:653:25: error: no template named ‘numeric_limits’
return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/geotest.dir/geotest.cc.o] Error 1
make[1]: *** [CMakeFiles/geotest.dir/all] Error 2
make: *** [all] Error 2

Which was the issue with 12.0 sdk on Mac - which is the same as Mac OS X building bug - #3 by Adiolph

Argh, I’ve seen this annoying issue especially with Homebrew based installs - and I know root has seen it as well, but I’ve never found a clear answer to what is causing it (other than the “hack your system”). I’m going to need some time to get to the bottom of this, likely won’t be until next week given colleagues holidays in the US.

BTW, do you have any other installs of anaconda/conda present or setup? This is just on the chance that something here could be interfering.

Thank again, I do have miniconda3 in the filepath:

/Users/edwardtaylor/opt/miniconda3/

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.