Problem running my project in geant4 with binmake.gmk

Hello, dear all!
I have a problem.
I built my geant4(version geant4.10.05.p01) to this directory: /opt/geant4/geant4.10.05.p01
After that i ran my project with cmake: after success compiling my project i have this error:
/opt/geant4/geant4.10.05.p01/config/binmake.gmk:398: recipe for target ‘Linux-g++/tracker’ failed

file content(binmake.gmk) is:
395 (G4BINDIR)/(G4TARGET): $(LINK_DEPENDENCIES)

396 ifndef USER_DEFINED_LDLIBS

397 ifndef GLOBALLIBS

398 @echo “Using granular libraries …”

399 @if [ ! ( -f (G4LIB)/(G4SYSTEM)/liblist \

What is my problem?
Help me!

What files do you have in /opt/geant4/geant4.10.05.p01? How did you build both that Geant4 and your project?

I built to this directory(/opt/geant4/geant4.10.05.p01) my install-files, i.e. this directory has source and install files and no build-files.
My project and geant4 are different directory.
P.S. I use Linux Mint 19.

O.k., could you outline the steps you used to build/install Geant4, and then your project please? It’s not clear to me where you’re getting the error:

as if you configured and built your project with CMake, the binmake.gmk file shouldn’t be used at all.

I installed geant4 this metod:
cd /opt/geant4 && mkdir geant4.10.05.p01 && mkdir geant4.10.05.p01 build && cd geant4.10.05.p01 build
sudo cmake -DCMAKE_INSTALL_PREFIX=/opt/geant4/geant4.10.05.p01 -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON /opt/geant4/geant4.10.05.p01
sudo make -j4 && sudo make install

compilling my project and my error:
andy@andy:~/geant4/MONITOR$ make
Making dependency for file tracker.cc …
Compiling tracker.cc …
Using granular libraries …
ERROR: No liblist program or library map file.
These are needed for building with granular
libraries.
cd $G4INSTALL/source
gmake
or if you are sure you have already made all the
granular libraries:
gmake libmap
/opt/geant4/geant4.10.05.p01/config/binmake.gmk:398: recipe for target ‘Linux-g++/tracker’ failed
make: *** [Linux-g++/tracker] Error 1

To use the GNUmake system, you need to source the geant4make.sh file first, which should be located at /opt/geant4/geant4.10.05.p01/share/Geant4-10.5.1/geant4make/geant4make.sh.

may be, do I have multiple definitions of the same class?

look up my error(it is line after ifndef) in text down:

this is file binmake.gmk

(G4BINDIR)/(G4TARGET): $(LINK_DEPENDENCIES)
ifndef USER_DEFINED_LDLIBS
ifndef GLOBALLIBS

**@echo "Using granular libraries ..."**
@if [ ! \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
  -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
  echo "ERROR: No liblist program or library map file."; \
  echo "       These are needed for building with granular"; \
  echo "       libraries."; \
  echo '         cd $$G4INSTALL/source'; \
  echo "         gmake"; \
  echo "       or if you are sure you have already made all the"; \
  echo "       granular libraries:"; \
  echo "         gmake libmap"; \
  exit 1; fi

OK.
There is this file in the directory: /opt/geant4/geant4.10.05.p01/share/Geant4-10.5.1/geant4make

OK, thank you very mach your help!
I ran this file in current terminal:
andy@andy:~/geant4/MONITOR$ source /opt/geant4/geant4.10.05.p01/share/Geant4-10.5.1/geant4make/geant4make.sh

and my error went away/disappear, but the new error came up:
Using global libraries …
Linking tracker
/usr/bin/ld: cannot find -lEvent
collect2: error: ld returned 1 exit status
/opt/geant4/geant4.10.05.p01/share/Geant4-10.5.1/geant4make/config/binmake.gmk:411: recipe for target ‘Linux-g++/tracker’ failed
make: *** [Linux-g++/tracker] Error 1

What is it?

What’s the Event library? Part of your project, or from somewhere else? It’s not part of Geant4, so you’ll need to look in your project’s Makefile so see how it expect to be located.

OK, i corrected my previous error and my cmake-file finished with next result:
andy@andy:~/geant4/MONITOR$ make -j2


/home/andy/lib64/Linux-g++/libSD.a(GLG4TorusStack.o): In function GLG4TorusStack::ComputeDimensions(G4VPVParameterisation*, int, G4VPhysicalVolume const*)': GLG4TorusStack.cc:(.text+0xaea): undefined reference toG4cerr’
/home/andy/lib64/Linux-g++/libSD.a(GLG4TorusStack.o): In function GLG4TorusStack::SurfaceNormal(CLHEP::Hep3Vector const&) const': GLG4TorusStack.cc:(.text+0x22c7): undefined reference toG4cout’
GLG4TorusStack.cc:(.text+0x22df): undefined reference to G4cerr' GLG4TorusStack.cc:(.text+0x2341): undefined reference toG4cerr’
GLG4TorusStack.cc:(.text+0x2415): undefined reference to G4cerr' /home/andy/lib64/Linux-g++/libSD.a(GLG4TorusStack.o): In functionGLG4TorusStack::DistanceToOut(CLHEP::Hep3Vector const&, CLHEP::Hep3Vector const&, bool, bool*, CLHEP::Hep3Vector*) const’:
GLG4TorusStack.cc:(.text+0x3ba2): undefined reference to G4cout' GLG4TorusStack.cc:(.text+0x3bb5): undefined reference toG4cerr’
GLG4TorusStack.cc:(.text+0x3c35): undefined reference to G4cerr' GLG4TorusStack.cc:(.text+0x3d65): undefined reference toG4cerr’
GLG4TorusStack.cc:(.text+0x3f3a): undefined reference to G4cerr' GLG4TorusStack.cc:(.text+0x3fbd): undefined reference toG4cerr’
/home/andy/lib64/Linux-g++/libSD.a(GLG4TorusStack.o):GLG4TorusStack.cc:(.text+0x4053): more undefined references to G4cerr' follow /home/andy/lib64/Linux-g++/libSD.a(GLG4TorusStack.o): In functionGLG4TorusStack::DistanceToOut(CLHEP::Hep3Vector const&, CLHEP::Hep3Vector const&, bool, bool*, CLHEP::Hep3Vector*) const’:
GLG4TorusStack.cc:(.text+0x43c7): undefined reference to G4cout' GLG4TorusStack.cc:(.text+0x43e2): undefined reference toG4cerr’
GLG4TorusStack.cc:(.text+0x4422): undefined reference to G4cerr' GLG4TorusStack.cc:(.text+0x44c6): undefined reference toG4cerr’
GLG4TorusStack.cc:(.text+0x4596): undefined reference to G4cerr' GLG4TorusStack.cc:(.text+0x45de): undefined reference toG4cerr’
/home/andy/lib64/Linux-g++/libSD.a(GLG4TorusStack.o):GLG4TorusStack.cc:(.text+0x4eea): more undefined references to G4cerr' follow /home/andy/lib64/Linux-g++/libOptical.a(Scintillation.o): In functionScintillation::Scintillation(G4String const&, G4ProcessType)’:
Scintillation.cc:(.text+0x2e7): undefined reference to G4cout' /home/andy/lib64/Linux-g++/libOptical.a(Scintillation.o): In functionScintillation::PostStepDoIt(G4Track const&, G4Step const&)’:
Scintillation.cc:(.text+0x2152): undefined reference to G4cerr' Scintillation.cc:(.text+0x216a): undefined reference toG4cerr’
Scintillation.cc:(.text+0x2e42): undefined reference to G4cout' Scintillation.cc:(.text+0x2e59): undefined reference toG4cout’
Scintillation.cc:(.text+0x2ea5): undefined reference to G4cout' Scintillation.cc:(.text+0x2ebc): undefined reference toG4cout’
Scintillation.cc:(.text+0x2fd0): undefined reference to G4cout' /home/andy/lib64/Linux-g++/libOptical.a(Scintillation.o):Scintillation.cc:(.text+0x2fe6): more undefined references toG4cout’ follow
/home/andy/lib64/Linux-g++/libOptical.a(Scintillation.o): In function Scintillation::PostStepDoIt(G4Track const&, G4Step const&)': Scintillation.cc:(.text+0x330a): undefined reference toG4cerr’
Scintillation.cc:(.text+0x3326): undefined reference to G4cerr' /home/andy/lib64/Linux-g++/libNeutrinoNucleus.a(AntiNuENucleusCohElasticInteractionModel.o): In functionAntiNuENucleusCohElasticInteractionModel::applyInteractionModel(G4Track const&, G4Nucleus&)’:
AntiNuENucleusCohElasticInteractionModel.cc:(.text+0x24c6): undefined reference to G4cout' AntiNuENucleusCohElasticInteractionModel.cc:(.text+0x24dc): undefined reference toG4cout’
AntiNuENucleusCohElasticInteractionModel.cc:(.text+0x24ed): undefined reference to G4cout' AntiNuENucleusCohElasticInteractionModel.cc:(.text+0x2500): undefined reference toG4cout’
AntiNuENucleusCohElasticInteractionModel.cc:(.text+0x2516): undefined reference to G4cout' /home/andy/lib64/Linux-g++/libNeutrinoNucleus.a(AntiNuENucleusCohElasticInteractionModel.o):AntiNuENucleusCohElasticInteractionModel.cc:(.text+0x2539): more undefined references toG4cout’ follow
./tmp/Linux-g++/tracker/libtracker.so: undefined reference to `PhotonCollection::AddPhoton()’
collect2: error: ld returned 1 exit status
/opt/geant4/geant4.10.05.p01/share/Geant4-10.5.1/geant4make/config/binmake.gmk:411: recipe for target ‘Linux-g++/tracker’ failed
make: *** [Linux-g++/tracker] Error 1

may be is this problem solution?

What libraries are linked to libSD and libOptical (and in what order since they’re built static)? The missing symbols should be in the libG4global library.

hello, dear all!
Thank you very much for your help!
I use Linux Mint 19 Mate, root_v5.34.38, geant4.10.05.p01.
I resolved my problem:
i used different classes in my project and if i write them in one file - i have this error(written up) , but if these classes write in two different files - error vanishes.