I can't install

Hello, I’m trying to install Geant4, unfortunately I tried more times but everytime, It just compile 16 packets and not compile 20.
I use Geant for Windows and I’m compiling by using visual studio express 2017.
Here the logs.

CMAKE

  1. `
    ``During the configuration I got this log:
    Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
    The C compiler identification is MSVC 19.16.27031.1
    The CXX compiler identification is MSVC 19.16.27031.1
    Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/WDExpress/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
    Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/WDExpress/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe – works
    Detecting C compiler ABI info
    Detecting C compiler ABI info - done
    Detecting C compile features
    Detecting C compile features - done
    Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/WDExpress/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
    Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/WDExpress/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe – works
    Detecting CXX compiler ABI info
    Detecting CXX compiler ABI info - done
    Detecting CXX compile features
    Detecting CXX compile features - done
    Looking for dlfcn.h
    Looking for dlfcn.h - not found
    Looking for fcntl.h
    Looking for fcntl.h - found
    Looking for inttypes.h
    Looking for inttypes.h - found
    Looking for memory.h
    Looking for memory.h - found
    Looking for stdint.h
    Looking for stdint.h - found
    Looking for stdlib.h
    Looking for stdlib.h - found
    Looking for strings.h
    Looking for strings.h - not found
    Looking for string.h
    Looking for string.h - found
    Looking for sys/stat.h
    Looking for sys/stat.h - found
    Looking for sys/types.h
    Looking for sys/types.h - found
    Looking for unistd.h
    Looking for unistd.h - not found
    Looking for getpagesize
    Looking for getpagesize - not found
    Looking for bcopy
    Looking for bcopy - not found
    Looking for memmove
    Looking for memmove - found
    Looking for mmap
    Looking for mmap - not found
    Looking for 4 include files stdlib.h, …, float.h
    Looking for 4 include files stdlib.h, …, float.h - found
    Check if the system is big endian
    Searching 16 bit integer
    Looking for stddef.h
    Looking for stddef.h - found
    Check size of unsigned short
    Check size of unsigned short - done
    Using unsigned short
    Check if the system is big endian - little endian
    Looking for off_t
    Looking for off_t - not found
    Looking for size_t
    Looking for size_t - not found
    Check size of off64_t
    Check size of off64_t - failed
    Looking for fseeko
    Looking for fseeko - not found
    Looking for unistd.h
    Looking for unistd.h - not found
    Pre-configuring dataset G4NDL (4.5)
    Pre-configuring dataset G4EMLOW (7.7)
    Pre-configuring dataset PhotonEvaporation (5.3)
    Pre-configuring dataset RadioactiveDecay (5.3)
    Pre-configuring dataset G4PARTICLEXS (1.1)
    Pre-configuring dataset G4PII (1.3)
    Pre-configuring dataset RealSurface (2.1.1)
    Pre-configuring dataset G4SAIDDATA (2.0)
    Pre-configuring dataset G4ABLA (3.1)
    Pre-configuring dataset G4INCL (1.0)
    Pre-configuring dataset G4ENSDFSTATE (2.2)
    WARNING
    Geant4 has been pre-configured to look for datasets
    in the directory:

         C:/Program Files (x86)/Geant4/share/Geant4-10.5.1/data
      
         but the following datasets are NOT present on disk at
         that location:
      
         G4NDL (4.5)
         G4EMLOW (7.7)
         PhotonEvaporation (5.3)
         RadioactiveDecay (5.3)
         G4PARTICLEXS (1.1)
         G4PII (1.3)
         RealSurface (2.1.1)
         G4SAIDDATA (2.0)
         G4ABLA (3.1)
         G4INCL (1.0)
         G4ENSDFSTATE (2.2)
      
         If you want to have these datasets installed automatically
         simply re-run cmake and set the GEANT4_INSTALL_DATA
         variable to ON. This will configure the build to download
         and install these datasets for you. For example, on the
         command line, do:
      
         cmake -DGEANT4_INSTALL_DATA=ON <otherargs>
      
         The variable can also be toggled in ccmake or cmake-gui.
         If you're running on a Windows system, this is the best
         solution as CMake will unpack the datasets for you
         without any further software being required
      
         Alternatively, you can install these datasets manually
         now or after you have installed Geant4. To do this,
         download the following files:
      
         https://cern.ch/geant4-data/datasets/G4NDL.4.5.tar.gz
         https://cern.ch/geant4-data/datasets/G4EMLOW.7.7.tar.gz
         https://cern.ch/geant4-data/datasets/G4PhotonEvaporation.5.3.tar.gz
         https://cern.ch/geant4-data/datasets/G4RadioactiveDecay.5.3.tar.gz
         https://cern.ch/geant4-data/datasets/G4PARTICLEXS.1.1.tar.gz
         https://cern.ch/geant4-data/datasets/G4PII.1.3.tar.gz
         https://cern.ch/geant4-data/datasets/G4RealSurface.2.1.1.tar.gz
         https://cern.ch/geant4-data/datasets/G4SAIDDATA.2.0.tar.gz
         https://cern.ch/geant4-data/datasets/G4ABLA.3.1.tar.gz
         https://cern.ch/geant4-data/datasets/G4INCL.1.0.tar.gz
         https://cern.ch/geant4-data/datasets/G4ENSDFSTATE.2.2.tar.gz
      
         and unpack them under the directory:
      
         C:/Program Files (x86)/Geant4/share/Geant4-10.5.1/data
      
         As we supply the datasets packed in gzipped tar files,
         you will need the 'tar' utility to unpack them.
      
         Nota bene: Missing datasets will not affect or break
                    compilation and installation of the Geant4
                    libraries.
      
         The following Geant4 features are enabled:
         GEANT4_BUILD_CXXSTD: Compiling against C++ Standard '11'
    
         Configuring done`
    

then I setted in this way:

then I clicked again the “Configure” button and I got this log

    Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
Found OpenGL: opengl32   
Pre-configuring dataset G4NDL (4.5)
Pre-configuring dataset G4EMLOW (7.7)
Pre-configuring dataset PhotonEvaporation (5.3)
Pre-configuring dataset RadioactiveDecay (5.3)
Pre-configuring dataset G4PARTICLEXS (1.1)
Pre-configuring dataset G4PII (1.3)
Pre-configuring dataset RealSurface (2.1.1)
Pre-configuring dataset G4SAIDDATA (2.0)
Pre-configuring dataset G4ABLA (3.1)
Pre-configuring dataset G4INCL (1.0)
Pre-configuring dataset G4ENSDFSTATE (2.2)
  *WARNING*
    Geant4 has been pre-configured to look for datasets
    in the directory:
 
    C:/Program Files/geant4_10_05_p01_bin-install/share/Geant4-10.5.1/data
 
    but the following datasets are NOT present on disk at
    that location:
 
    G4NDL (4.5)
    G4EMLOW (7.7)
    PhotonEvaporation (5.3)
    RadioactiveDecay (5.3)
    G4PARTICLEXS (1.1)
    G4PII (1.3)
    RealSurface (2.1.1)
    G4SAIDDATA (2.0)
    G4ABLA (3.1)
    G4INCL (1.0)
    G4ENSDFSTATE (2.2)
 
    If you want to have these datasets installed automatically
    simply re-run cmake and set the GEANT4_INSTALL_DATA
    variable to ON. This will configure the build to download
    and install these datasets for you. For example, on the
    command line, do:
 
    cmake -DGEANT4_INSTALL_DATA=ON <otherargs>
 
    The variable can also be toggled in ccmake or cmake-gui.
    If you're running on a Windows system, this is the best
    solution as CMake will unpack the datasets for you
    without any further software being required
 
    Alternatively, you can install these datasets manually
    now or after you have installed Geant4. To do this,
    download the following files:
 
    https://cern.ch/geant4-data/datasets/G4NDL.4.5.tar.gz
    https://cern.ch/geant4-data/datasets/G4EMLOW.7.7.tar.gz
    https://cern.ch/geant4-data/datasets/G4PhotonEvaporation.5.3.tar.gz
    https://cern.ch/geant4-data/datasets/G4RadioactiveDecay.5.3.tar.gz
    https://cern.ch/geant4-data/datasets/G4PARTICLEXS.1.1.tar.gz
    https://cern.ch/geant4-data/datasets/G4PII.1.3.tar.gz
    https://cern.ch/geant4-data/datasets/G4RealSurface.2.1.1.tar.gz
    https://cern.ch/geant4-data/datasets/G4SAIDDATA.2.0.tar.gz
    https://cern.ch/geant4-data/datasets/G4ABLA.3.1.tar.gz
    https://cern.ch/geant4-data/datasets/G4INCL.1.0.tar.gz
    https://cern.ch/geant4-data/datasets/G4ENSDFSTATE.2.2.tar.gz
 
    and unpack them under the directory:
 
    C:/Program Files/geant4_10_05_p01_bin-install/share/Geant4-10.5.1/data
 
    As we supply the datasets packed in gzipped tar files,
    you will need the 'tar' utility to unpack them.
 
    Nota bene: Missing datasets will not affect or break
               compilation and installation of the Geant4
               libraries.
 
The following Geant4 features are enabled:
GEANT4_BUILD_CXXSTD: Compiling against C++ Standard '11'
GEANT4_USE_OPENGL_WIN32: Build OpenGL driver with Win32 support

Configuring done

I clicked on “Generate” button and I got

    Configuring done
Generating done
  1. VISUAL STUDIO
    Opening the Geant4.sln file, I get 40 projects then I compile the “Install” project

at the end, It just compile 16 and can’t compile 20

Here the full log
log.txt (1.3 MB)

Thanks for the detailed step-by-step and logs. The problem is at the build stage in trying to compile the project in Debug mode. Currently, this causes issues on Windows due to the number of symbols in the library, the LNK1189 error that’s reported.

To resolve this, try installing Geant4 in Release mode. That can be done via choosing the Release build type in Visual Studio then installing, or by running

> cmake --build . --config Release --target install

from the command prompt in the directory where the Geant4.sln file was generated.

Hi @bmorgan, thank you for your help. I installed by running the code in the command prompt, it ended the installation but there isn’t written how many packets were compilated.

  1. How can I check if the installation was ok ? (I can’t see Geant4 in the Windows list of installed programs, like for example it happens for Root)

  2. I should simulate an e+ 45GeV beam hitting a C target having 2cm thickness and to count how many 22GeV e+/- and how many 22GeV mu+/- are produced. How should I do? (I never used Geant4)…

Unless the installation from the command prompt produced error messages (and they’d usually be of similar form to the Visual Studio invocation) the installation should be o.k. Geant4 is a set of libraries (a toolkit) so is not a directly executable program like root can be.

Another way to test the installation, and also to get you familiar with Geant4, would be to walk through the Getting Started With Geant4 section of the main Application Developer’s Guide. To quickly test your installation, try following the guide under How to Make an Executable Program, which walks through building one of the examples, including a section for Windows Platforms. This will require the Geant4 data libraries, so make sure to follow the Post-install setup guide before trying the walkthrough.

I can’t immediately help with the specific simulation required, but the above walkthroughs will familiarise you with how Geant4 works. A large sample of examples are provided and documented here, so one may fir or be adaptable to your case, but the above tutorials should be followed to ensure understanding of the geometry and especially physics models.

Hi @bmorgan, then first I followed the post install page

I setted in this way


I’m not sure to do it good, but the geant4_10_05_bin-install directory is the directory that I genenrated by CMAKE when it asked “CMAKE_INSTAL_PREFIX”

And here i66.tinypic.com/2s6lhxj.png you can see the list of file in the C:\Program Files\geant4_10_05_p01_bin-install\bin directory

Later, I tried to compile the example B1 followinf the ** Building ExampleB1 with CMake on Windows with Visual Studio** section. After the command

> cmake --build . --config Release

I get this i64.tinypic.com/mtnfiw.png …then I get a warning, but I get the .exe file,but when I try to use the exe file (double click on it), it open this window i67.tinypic[DOT]com/j654k5.png that automatically closes in few seconds

Do you think that I didn’t install in correct mode?

ps. In the last pic i67.tinypic[DOT]com/j654k5.png I had to write [DOT] instead of “.” because I can’t insert more that 2 links. Then, to see the pic just write “.” instead of “[DOT]”

Please try and upload the pngs here, as the links aren’t working.

I @bmorgan, I cant’ upload pics here because I’m a new user then I can just insert 1 pic and 2 links! Anyway, I uploaded again the pics… Now I’m writing again my previous post writing the new links of pics!

I setted in this way


I’m not sure to do it good, but the geant4_10_05_bin-install directory is the directory that I genenrated by CMAKE when it asked “CMAKE_INSTAL_PREFIX”

And here i.postimg.cc/Pq0Hs1DX/Immagine.png you can see the list of file in the C:\Program Files\geant4_10_05_p01_bin-install\bin directory

Later, I tried to compile the example B1 followinf the ** Building ExampleB1 with CMake on Windows with Visual Studio** section. After the command

> cmake --build . --config Release

I get this i.postimg.cc/GmxNxVdn/mtnfiw.png…then I get a warning, but I get the .exe file,but when I try to use the exe file (double click on it), it open this window i.postimg.cc/cLz10vtJ/Immagine.png that automatically closes in few seconds

Do you think that I didn’t install in correct mode?

Hi @faca87, please note your are not required to double click the exampleB1.exe, please go to the command line, then your build directory of exampleB1, then in release folder where your exampleB1.exe file is available. Now you can run the exampleB1.exe by simply typing exampleB1.exe …\run1.mac
then you can see the output. You can run any macro in the parent folder of release depending upon what you want to analyse. I am also a new user but solved the problems up to this point. In exampleB1 case the output will start like given in the screenshot below

I hope this will help you.

Hi @Khalidhussain1134 thank you for your reply. Unfortunately I followed your help, but I get error too.

O.k., the PATH setting is fine, otherwise the example wouldn’t even start. The problem is that the environment variables needed to access the data files aren’t set, see Items 7 in the post install for windows

Hi @bmorgan…I didn’t understand how to do it…

Hi @faca87 Please see you did not set the environment variable G4ENSDFSTATEDATA,
You should set the environment variables which points to proper geant4 data library, it will fix your problem, same was happening with me.
You can see my environment variable in below figure.
environment-variable

Hopefully it will fix your problem

Hi @Khalidhussain1134 , thank you. Unfortunately I can’t find the …/data, …/dataG43NSDFSTATE2.2 etc directories…

This is my geant4 install/share directory…

Hi @faca87, you did not set the -DGEANT4_INSTALL_DATA=ON while configuring with cmake but no problem just create a folder data and place all data files inside this data folder and then set the environment variables as you see in my previous screenshot, it will work, if you still have some problem then please feel free to contact again.
I also attached short summary of step by step commands for whole process of geant4 installation and building example, may be it will help you.How to build Geant4 file-step by step and example step-by-step in windows.txt (1.7 KB)

One my sincere advise is to go for linux on virtual box rather then windows because in my opinion linux may have more support then window and in windows, you may face further problems when you want to visualize the geometry using QT or other tools like me, as same was happening with me, I completed the Gean4 installation with OpenGL but still facing problem with QT and I cannot visualize the geometry. After that I switched on Linux and now every thing is working with the help of @sanchitsharma and @bmorgan. I am thanks to these men for solving my problems.

Hi @Khalidhussain1134 and @bmorgan I setted the enviroment variables and I runned the B1 example.
In attachment there is all the process. I think it worked…please, can you confirm it?

B1.txt (62.4 KB)

Yeah, Now this is correct console output.

thank you the both @Khalidhussain1134 and @bmorgan