Overview Contents Previous Next

Installation Guide



3. Tips for installing on Windows





3.1 Windows with the Cygwin Toolset and Microsoft Visual C++

To compile and run Geant4 under Windows systems, some additional information and tools are required, although the installation produre is similar to that required on a UNIX based system. On Windows, the Cygwin toolset and the Microsoft Visual C++ compiler are used.
Cygwin32 is a UNIX development environment available for Microsoft Windows . You can freely obtain Cygwin32 from Cygwin.
We do not support direct use of Visual Studio; i.e. we do not provide Visual Studio workspace (.dsw) or project (.dsp) files, nor do we provide makefiles for the nmake application of MS Visual C++.

We use several of the tools provided by the Cygwin toolset:

For more details on the toolset, please see the documetation available on the Cygwin pages.

For this release of Geant4 we used MS Visual Studio Enterprise version 6.0, Service Pack 5. Due to severe limitations of the MS-VC++ optimizer, we suggest to perform the installation with debug flags turned on, i.e. G4DEBUG=1, and no optimisation. In some cases, tests showed problems both at compile and run time when optimisation was turned on.

The usage of cgywin32 for the build environment results in a build procedure similar to a UNIX system. Also the documentation in the User's Guide for Application Developers, Section 10.5 applies largely.

You should follow the following steps to install geant4:

  1. Install Cygwin32:
    We do not depend on any specific feature of the version of Cygwin, so newer versions (or slightly older) are expected to work.
  2. Set the environment for MS Visual C++, i.e. set the paths to libraries, include files, and executables for MS Visual C++. This can be done using the start-up batch file cygnus.bat of Cygwin32. This has to be modified to include all the MSDOS commands found in the file vcvars32.bat provided by the MS Visual C++ before the final invocation of the shell application bash.exe. For version 6 of Developer Studio this file is normally found in C:\Program Files\MS DeveloperStudio6\VC98\bin.
  3. Unpack the source code into a directory of your choice.
  4. Start a cygwin bash shell from the start menu.
  5. At this point you're ready to install Geant4. If the manual installation is chosen, you must set the necessary environment variables. There are various ways to do so; for example through a command file for the Cygwin bash shell. This command file could be named geant4-setup.sh , and you must execute it with
    	. geant4-setup.sh
        
    including the leading dot and blank space. You could also have this as your .bashrc file. The commands in the command file should be:
    	# Set G4SYSTEM 
    	export G4SYSTEM=WIN32-VC
    	#
    	# Turn on debug flags, note that testing was done for the debug version only.
    	export G4DEBUG=1
    	#
    	# Set Path to CLHEP
    	export CLHEP_BASE_DIR=C:/usr/local
    	#
    	# --- Other optional settings
    	#Turn on verbose to show command used for compilation
    	#export CPPVERBOSE=1
    	#
        
    Note, in the example above, CLHEP was installed in C:/usr/local, therefore include/CLHEP and lib/CLHEP.lib must be included therein.
  6. Once the environment is correctly set, the libraries are built using make from the geant4/source directory typing make from the cygwin bash shell prompt.
Examples can be built the same way as the libraries from one of the examples/novice/N01, ... again by typing make from the cygnus bash shell prompt.
Note that, depending on which external software is used, there may be some warnings in linking; e.g., we get "unrecognized source file type -file.o-, object file assumed", or warnings of conflictings libraries. This often seems to be caused by an external library compiled for a different run time environment.

The binary of the example by default is placed into the geant4/bin/WIN32-VC directory. You may run this either from this directory or from the examples/novice/N01 directory; sample input and output files are placed in each of the examples/novice directories. Some of the examples will need to read data files, and the place has to be given in environment variables again similar to the following example:

	#
	# Environment variables needed to find geant4 data files:
	#
	# Data for neutron scattering processes, 
	#    distributed in a separate tar file, then placed under data
	export NeutronHPCrossSections=c:/usr/local/geant4/data/G4NDL
	#
	# Nuclear Photon evaporation data,
	#    distributed with the source files under data 
	export G4LEVELGAMMADATA=c:/usr/local/geant4/data/PhotonEvaporation
	#
	# Data for radiative decay hadronic processes under data,
	#    distributed in a separate tar file
	export G4RADIOACTIVEDATA=c:/usr/local/geant4/data/RadiativeDecay
	#
	# Data for low energy electromagnetic processes,
	#    distributed in a separate tar file, then placed under data
	export G4LEDATA=c:/usr/local/geant4/data/G4EMLOW
	#

All compiler and linker options are set in config/sys/WIN32-VC.gmk. If you require options different from our choice, you should modify this file.


3.2 Linux and GNU

Geant4 is regularly tested on Linux RedHat distributions. For details on the installation please refer to chapter 1 and 2 of this Installation Guide.


About the authors