Installation guides are available for a variety of different
Geant4 releases and operating systems.
Be sure to use the appropriate guide for your Geant4 release and system.
The full set of guides can be
found at:
http://geant4.slac.stanford.edu/installation
What are the three pieces of software required for building Geant4?
Getting and Installing Microsoft Visual C++ and Microsoft Platform SDK
Getting the Correct Version of Cygwin's make.exe
Making Cygwin aware of Microsoft Visual C++ and Microsoft Platform SDK
Selecting an Example Application
Building an Example Application
Single versus Multi-User Installation
Microsoft Visual C++ and Microsoft Platform SDK:
Microsoft C++ is the compiler that is recommended for Geant4 on Windows.
When you install this, you have the option of whether or not to also take Microsoft Platform SDK. The answer is yes, you need SDK. Without it, you can make something called a Microsoft .NET application, but you cannot actually make a Windows application (which is what you need for Geant4).
Cygwin:
Cygwin is a Linux shell environment that runs on top of
Windows.
While it is possible to run Geant4 without this (see Norman
Graf's notes on this, linked from the Geant4 home page), the officially
supported way to run Geant4 on Windows is with Cygwin.
By requiring Cygwin, we obtain a common, Linux-like baseline
for all of our users. This greatly
simplifies installation and configuration support.
Cygwin provides essential tools such as the make utility.
Cygwin also provides a C++ compiler, so you may wonder why
you also need the Microsoft C++ compiler mentioned above. The reason is that while the Cygwin
compiler does work for Geant4, the Microsoft compiler produces significantly
faster-running code. The Microsoft
compiler is therefore the officially supported Geant4 solution.
CLHEP:
CLHEP is a set of base libraries that have long provided great functionality for the particle physics community. They provide things like matrix manipulations and four-vector tools. The Geant4 collaboration has chosen to use these libraries rather than re-invent these wheels. Please note that while CLHEP and Geant4 both come out of the particle physics communities, they are separate products - the Geant4 collaboration is not responsible for maintenance, distribution or documentation of CLHEP.
There are basically two ways you can obtain it.
You can install the entire Microsoft Visual Studio.NET, 2003 or 2005.
Or you can install just the two components that you need, Visual C++ 2005 and the Microsoft SDK.
These two pieces are available in a stripped-down version that is free for one year and is entirely adequate for Geant4 compilation. This version is called "Visual C++ Express Edition."
The free version can be obtained from:
http://msdn.microsoft.com/vstudio/express/visualc/
Go there from Internet Explorer rather than some other
browser since Internet Explorer can run the installers directly for you.
Note: the Microsoft web pages change very often. If they have changed since the last
time this Geant4 installation guide was updated, you may have to look around
the Microsoft pages and use some ingenuity to interpret what is now the right
thing to do.
Click "Download" from over on the right.
Four steps are shown there:
Step 1. Make sure you are ready:
You don't need this unless you've previously installed a beta version of Visual C++.
Step 2. Download and install:
Select "Go" under where it says "Visual C++ 2005"
Click "Run" at the security warning.
After the download there will be another security warning. Again click "Run".
At "Welcome to setup", click "Next".
At "License Agreement", click "accept" and "Next".
At "Installation Options", unselect "Graphical IDE" (unless you want it, but you don't need it for Geant4), then ÔNext".
At "Destination Folder", accept the default and click "Install".
It will download and install two items, "Microsoft .NET Framework 2.0" and "Visual C++ 2005 Express Edition".
Step 3. Download Additional Components
You will need two of these "additional components."
Step 3a. Microsoft Visual Studio Express Editions 2005
Service Pack 1
This fixes some compilation problems.
Click on "Download Visual C++ 2005 Express SP1"
and do the installation.
Step 3b. The Microsoft Platform SDK for Microsoft Visual
C++ 2005 Express
Yes, you need this (see comments above).
Follow the "Instructions" link. It will take you to another page that says "Using Visual C++ 2005 Express Edition with the Microsoft Platform SDK".
Click on "Platform SDK" in Step 2.
This will take you to a page that says "Windows Server 2003 R2 Platform SDK Web Install".
Scroll down almost to the bottom.
Where it says "Files in This Download", click on "PSDK-x86.exe" (unless you think a different option is more appropriate for your CPU).
Click "Run" at both security warnings.
At "Welcome to setup", click "Next".
At "License Agreement", click "accept" and "Next".
At "User Information", Enter name and click
"Next".
At "Select an Installation Type", click "Custom" and "Next".
At "Select and Installation Location", accept the default and click "Next".
At "Custom Installation Tips", click "Next".
Change all of the pull down menus on the left side to X.
Expand "Microsoft Windows Core SDK"
Change the pull down menu next to "Build Environment (x86 32-bit)" to "Entire feature will be installed on local hard drive"
Click "Next"
At "Begin Installation", click "Next".
It will download and install a bunch of stuff and take a long time.
After that is done, you can ignore the rest of that "Using
Visual C++ 2005 Express Edition with the Microsoft Platform SDK"
page. Steps 3, 4 and 5 on that
page are not necessary for Geant4.
If, instead, you select "Typical" installation, it will also work but it will take much much longer to install and will take about 1GB of disk space.
Step 4. Register:
Not necessary.
Install Cygwin by downloading setup.exe from
Look for where it says "Install or update now!".
Download the setup file to the directory c:\Temp\cygwin
and then run setup.exe.
The setup.exe is very quick to download, but it is just a utility that facilitates the main download.
The main download is very time consuming. You are essentially downloading a whole extra operating system (a Linux emulator) that runs on top of Windows. Sorry it is so slow. On the plus side, Cygwin provides lots of useful utilities that you may want to use even without Geant4.
When you do the installation, pay close attention to the notes below. You will not be taking simply the default installation, but will instead be asking for extra, non-default, pieces, specifically the "Devel" package.
And make sure you get the "Default Text File Type" question right, otherwise you will get almost all the way through the installation procedure, and just at the moment that that you are about to have Geant4 running, you will find that you need to delete everything and back up all the way to here.
Select options as follows:
Choose A Download Source: Install from Internet
Root Directory: c:\cygwin
Install For: All Users
Default Text File Type: Unix / binary
(This is a very important distinction. The other option, DOS, no longer works for Geant4).
Local Package Directory: c:\Temp\cygwin
Select Your Internet Connection: Direct Connection
Choose A Download Site (any one will do)
User URL: leave blank
Select Packages: accept all defaults except
For the Developer tools, select Install instead of Default. Do this by clicking just one time on the circle of arrows next to the word Devel. It takes a moment to respond, be patient, eventually the word next to the circle of arrows will change from "Default" to "Install".
Select "Next" one more time and the installation will proceed.
The download will take a long time (but is worthwhile since Cygwin is a great product). After the download phase is complete, the installation phase begins automatically. When you are finished, you will find that Cygwin has been installed to c:\cygwin.
Cygwin will create an icon on your desktop. Use this to open a Cygwin window.
The first time you open a Cygwin window, Cygwin will perform some one time setup. Just let it go ahead (Starts with "Copying skeleton files").
By default, Cygwin will create a window that doesn't have much scroll back capacity.
You can greatly improve this as follows:
Right click on the Cygwin icon.
On the "Options" tab:
Change buffer size to the maximum, 999. This gives you longer command history.
Check "Quick Edit Mode" and "Insert Mode". This makes ctrl-c, ctrl-v work for cutting and pasting.
On the "Layout" tab:
Change "Screen Buffer SizeÉHeight" to the maximum, 9999. This gives longer scroll back.
Change "Window Size" if you want to.
Click "OK".
At "Apply Properties to Shortcut", select "Modify shortcut that started this window"
Click "OK".
The latest version of the "make" utility that comes with Cygwin is not compatible with Geant4. You must replace this version (make 3.81-1) with the previous version (make 3.80-1) by downloading the following file:
http://geant4.slac.stanford.edu/tutorial/installation/extras/cygwin/make.exe
to your Cygwin binaries directory:
c:\cygwin\bin
If you are using the free version of Visual Studio
described above:
Modify C:\cygwin\cygwin.bat to contain the following two lines (you can use an application like Notepad to edit this file).
Place these lines right under where you see:
chdir C:\cygwin\bin
call "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
call "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.cmd"
Opening a Cygwin window will now give a message like:
Setting environment for using Microsoft Visual Studio 2005 x86 tools.
Attempting to detect a Microsoft Visual Studio installation
Targeting Windows XP 32 DEBUG
If you don't see that message when you open a Cygwin window, you do not have the Microsoft products correctly integrated into your setup. Stop and sort that out before you proceed.
If, for example, you get:
The system cannot find the path specified
The problem is likely just that your particular version of Microsoft SDK lives in a slightly different directory (Microsoft is constantly changing these things). Look for a directory that looks roughly like the one mentioned above and that has a SetEnv.cmd. Refer to that directory in your cygwin.bat.
If you are using the full version of Visual Studio from
an installation CD:
Modify C:\cygwin\cygwin.bat to contain the following one line (you can use an application like Notepad to edit this file).
Place this line right under where you see:
chdir C:\cygwin\bin
call "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
Opening a Cygwin window will now give a message like:
Setting environment for using Microsoft Visual Studio 2005 x86 tools.
If you don't see that message when you open a Cygwin window, you do not have the Microsoft products correctly integrated into your setup. Stop and sort that out before you proceed.
Go to the CLHEP source download page:
http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/clhep.html
From the "Source" section near the bottom of the page, select "clhep-2.0.3.1.tgz"
which corresponds to:
http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/distributions/clhep-2.0.3.1.tgz
The file is about 5MB.
Put it into:
c:/CLHEP
From a Cygwin window,
navigate to this directory and unpack the file:
cd c:/CLHEP
tar –zxvf clhep-2.0.3.1.tgz
(note that Cygwin includes "tab completion", so
you just have to type the first part of the file name and then hit tab).
The unpacking process will begin, starting with:
2.0.3.1/
2.0.3.1/CLHEP/
2.0.3.1/CLHEP/CVS/
2.0.3.1/CLHEP/CVS/Root
2.0.3.1/CLHEP/CVS/Repository
And ending with:
2.0.3.1/CLHEP/install-sh
2.0.3.1/CLHEP/config.guess
2.0.3.1/CLHEP/config.sub
2.0.3.1/CLHEP/Makefile.in
2.0.3.1/CLHEP/configure
Now
navigate into the unpacked directory and begin the configuration process:
cd 2.0.3.1/CLHEP
For
the following step, be very careful what you enter for "prefix".
Do
NOT forget the two dashes in a row before the word "prefix".
Do NOT use Windows-style path: C:/CLHEP/
Do NOT point at the subdirectory of CLHEP/2.0.3.1 that also happens to be named CLHEP Run configure as follows:
./configure --prefix /cygdrive/c/CLHEP/
You should get a response that starts with:
checking
build system type... i686-pc-cygwin
checking
host system type... i686-pc-cygwin
checking
target system type... i686-pc-cygwin
checking
for a BSD-compatible install... /usr/bin/install -c
checking
whether build environment is sane... yes
And ends with:
config.status:
creating test/exctest4.sh
config.status:
creating test/exctestNothrow.sh
config.status:
creating test/excDblThrow.sh
config.status:
creating Exceptions/defs.h
config.status:
executing depfiles commands
The complete output from the above command can be found in this same web directory as:
Run the build process:
make
You should get a response that starts with:
Making
all in Units
make[1]:
Entering directory `/cygdrive/c/CLHEP/2.0.3.1/CLHEP/Units'
Making
all in Units
make[2]:
Entering directory `/cygdrive/c/CLHEP/2.0.3.1/CLHEP/Units/Units'
make all-am
And ends with:
make[1]:
Entering directory `/cygdrive/c/CLHEP/2.0.3.1/CLHEP'
./build-clheplib
Units Vector Evaluator GenericFunctions Geometry Random Matrix RandomObjects
RefCount Cast Exceptions
rm
-f CLHEP-2.0.3.1.lib
liblist=`./getObjectList
-shared Units Vector Evaluator GenericFunctions Geometry Random Matrix
RandomObjects RefCount Cast Exceptions`; \
lib
/NOLOGO /OUT:CLHEP-2.0.3.1.lib $liblist
make[1]:
Leaving directory `/cygdrive/c/CLHEP/2.0.3.1/CLHEP'
The complete output from the above command can be found in this same web directory as:
If you got a response that "make" was an unknown command, it is likely that you forgot to ask for the "Devel" part of Cygwin. The default Cygwin installation does not include several of the tools that you will need. Go back to the above instructions about installing Cygwin, rerun the "setup.exe" utility that you already downloaded, and follow the above instructions about "Devel". Cygwin does a nice job of remembering what you have already installed and will not make you download everything all over again.
If you got a response such as:
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... configure: error:
cannot compute suffix of executables: cannot compile and link
See `config.log' for more details.
configure: error: /bin/sh './configure' failed for Units
It probably means you used the wrong form of path in
./configure
--prefix.
Review the notes above.
Move the build products to their installation area:
make install
You should get a response that starts with:
Making
install in Units
make[1]:
Entering directory `/cygdrive/c/CLHEP/2.0.3.1/CLHEP/Units'
Making
install in Units
make[2]:
Entering directory `/cygdrive/c/CLHEP/2.0.3.1/CLHEP/Units/Units'
make[3]:
Entering directory `/cygdrive/c/CLHEP/2.0.3.1/CLHEP/Units/Units'
make[3]:
Nothing to be done for `install-exec-am'.
And ends with:
test
-z "C:/CLHEP//lib" || mkdir -p -- "C:/CLHEP//lib"
/usr/bin/install -c 'CLHEP-2.0.3.1.lib'
'C:/CLHEP//lib/CLHEP-2.0.3.1.lib'
make[2]:
Nothing to be done for `install-data-am'.
make[2]:
Leaving directory `/cygdrive/c/CLHEP/2.0.3.1/CLHEP'
make[1]:
Leaving directory `/cygdrive/c/CLHEP/2.0.3.1/CLHEP'
The complete output from the above command can be found in this same web directory as:
You will now have directories such as:
~/CLHEP/include
and
~/CLHEP/lib
You're done setting up CLHEP.
Much more detailed instructions on installation of CLHEP are available from the CLHEP web site:
http://proj-clhep.web.cern.ch/proj-clhep/INSTALLATION/newCLHEP-install.html
From the top of the Geant4 home page:
http://geant4.web.cern.ch/geant4/
Select "Download" from near the top right corner of the page.
Assuming You Have a Zip Utility
Assuming you have a utility to open "zip" format
files, such as the Windows Extraction Wizard, WinZip or Alladin Expander,
you should then select "Zip format",
which corresponds to:
http://geant4.web.cern.ch/geant4/support/source/geant4_8_3.zip
The file is about 25M.
Save it to:
cd c:/Geant4
Then use whatever zip extraction tool you like to make the files end up in
c:\Geant4\geant4_8_3
but NOT in:
c:\Geant4\geant4_8_3\geant4_8_3
For example, if you have the Windows Extraction Wizard,
you can just right click on the file, select "Extract All",
tell it to extract files to c:\Geant4
(NOT the default that it offers, which is c:\Geant4\geant4_8_3)
and hit "Next".
Be patient, the extraction process involves a very large number of files.
If You Don't Have a Zip Utility
In the unlikely chance that you don't have a utility to open "zip" format files,
you can instead select "Unix tar format, compressed using gzip"
which corresponds to:
http://geant4.web.cern.ch/geant4/support/source/geant4.8.3.tar.gz
The file is about 16M.
Save it to:
cd c:/Geant4
From a Cygwin window,
navigate to this directory and unpack the file:
cd c:/Geant4
tar –zxvf geant4.8.3.tar.gz
The unpacking process will begin, starting with:
geant4.8.3/
geant4.8.3/ReleaseNotes/
geant4.8.3/ReleaseNotes/Patch4.4.0-1.txt
geant4.8.3/ReleaseNotes/Patch4.4.0-2.txt
geant4.8.3/ReleaseNotes/Patch4.4.1-1.txt
And ending with:
geant4.8.3/source/visualization/modeling/src/G4TrajectoryOriginVolumeFilter.cc
geant4.8.3/source/visualization/modeling/src/G4TrajectoryParticleFilter.cc
geant4.8.3/source/visualization/modeling/src/G4VModel.cc
geant4.8.3/source/visualization/modeling/src/G4VTrajectoryModel.cc
geant4.8.3/source/visualization/modeling/src/G4VisTrajContext.cc
From here on, we'll show how things look if you had used the zip file.
If you had instead used the gzip file, things will still work, but the file names you actually see and the strings you will have to type will have periods, ".", where the file names in our example printouts below have underscores, "_",
(so, for example, where we show: geant4_8_3, you will have geant4.8.3).
Depending on the physics of your particular application, you may need to install additional data files. These data files can be downloaded separately from the Geant4 source distribution page (the same place where you got Geant4 itself).
Create a new folder within c:\Geant4\geant4_8_3 to hold any of these required data files.
c:\Geant4\geant4_8_3\data
For now, pick up the "data files for low energy electromagnetic processes":
http://geant4.web.cern.ch/geant4/support/source/G4EMLOW.4.2.tar.gz
The file is about 7.6M.
Put the file into your new data directory.
From a Cygwin window,
navigate to this directory and unpack the file:
cd c:/Geant4/geant4_8_3/data
tar –zxvf G4EMLOW.4.2.tar.gz
The unpacking process will begin, starting with:
G4EMLOW4.2/
G4EMLOW4.2/README
G4EMLOW4.2/auger/
G4EMLOW4.2/auger/au-tr-pr-10.dat
G4EMLOW4.2/auger/au-tr-pr-11.dat
And ending with:
G4EMLOW4.2/tripdata/pp-trip-cs-9.dat
G4EMLOW4.2/photoelectric_angular/
G4EMLOW4.2/photoelectric_angular/ftab0.dat
G4EMLOW4.2/photoelectric_angular/ftab1.dat
G4EMLOW4.2/History
TAKE YOUR TIME AT THIS STAGE, DON'T RUSH IT.
Mistakes made at this stage can be very time-consuming to correct. Slow down.
Maybe get a cup of coffee (or a glass of wine) before you proceed. Breathe.
Finally, unless you're absolutely sure you are starting from a nice clean system, make sure you don't have any pre-existing Geant4 environment variables. You can use the "set" command to show all variables, and filter this with a "grep" for the string G4 as follows:
From a Cygwin window:
printenv | grep G4
If any variables show up, find out what is setting them and remove them. They might be coming from your c:/Cygwin/cybwin.bat, from your Windows environment variable setup or from some other script that you invoke upon login for some other project. Take the time now to find the cause and resolve it.
From a Cygwin window:
cd c:/Geant4/geant4_8_3
./Configure -build
You will be asked a series of questions.
In most cases, you can just take the default response (by hitting carriage return).
But pay close attention so that you do not accept the default for the following questions:
When it says:
Could
not find CLHEP installed on this system!
Please,
specify where CLHEP is installed:
First, confirm that you have installed your CLHEP to
c:/CLHEP
Make sure you have lib, bin and include subdirectories in c:/CLHEP.
If not, recheck your CLHEP installation. If so, proceed.
Enter: c:/CLHEP
Take the default for everything else except:
When it asks about:
G4UI_BUILD_WIN32_SESSION
G4UI_USE_WIN32
Enter: y
This tells Geant4 that you want to include the optional
Windows GUI. You don't actually
need this, but it has the useful effect of forcing a particular flag to be set
that solves a bug in the Windows version of the OpenGL Visualization
driver. This trick will probably
not be required in future Geant4 releases.
When it asks about:
G4VIS_BUILD_OPENGLWIN32_DRIVER
G4VIS_USE_OPENGLWIN32
Enter: y
This tells Geant4 that you want to include the optional OpenGL Visualization driver.
Take the default for everything else.
Once all of the questions have been answered, you will be told:
WARNING:
the generated configuration file
can
be edited if necessary!
You
can introduce any change to the configuration file
/cygdrive/c/Geant4/geant4_8_3/.config/bin/WIN32-VC/config.sh
before the final installation.
To
do so, use a shell escape now (e.g. !vi
/cygdrive/c/Geant4/geant4_8_3/.config/bin/WIN32-VC/config.sh).
Press
[Enter] to start installation or use a shell escape to edit config.sh:
At this point, what you have seen in this question and answer session should match what you find in this web directory as:
You are ready to proceed with the build.
Hit Enter.
You will then see:
Now
starting Geant4 libraries build...
On
this machine the G4SYSTEM=WIN32-VC
On
this machine the G4INSTALL=c:/Geant4/geant4_8_3
On
this machine the G4TMP=c:/Geant4/geant4_8_3/tmp
On
this machine the G4LIB=c:/Geant4/geant4_8_3/lib
On
this machine the
G4LEVELGAMMADATA=c:/Geant4/geant4_8_3/data/PhotonEvaporation2.0
On
this machine the
G4RADIOACTIVEDATA=c:/Geant4/geant4_8_3/data/RadioactiveDecay3.1
On
this machine the G4LEDATA=c:/Geant4/geant4_8_3/data/G4EMLOW4.2
On
this machine the NeutronHPCrossSections=c:/Geant4/geant4_8_3/data/G4NDL3.10
On
this machine the CLHEP_BASE_DIR=c:/CLHEP
On
this machine the CLHEP_INCLUDE_DIR=c:/CLHEP/include
On
this machine the CLHEP_LIB_DIR=c:/CLHEP/lib
On
this machine the CLHEP_LIB=CLHEP.lib
On
this machine the G4UI_BUILD_WIN32_SESSION=1
On
this machine the G4UI_USE_WIN32=1
On
this machine the G4VIS_BUILD_OPENGLWIN32_DRIVER=1
On
this machine the G4VIS_USE_OPENGLWIN32=1
On
this machine the XMFLAGS=
On
this machine the XMLIBS=
On
this machine the XMFLAGS=
On
this machine the XAWFLAGS=
On
this machine the XAWLIBS=
On
this machine the G4LIB_BUILD_STATIC=1
On
this machine the G4LIB_USE_GRANULAR=1
Starting
build...
*************************************************************
Installation Geant4 version :
geant4-08-03
Copyright (C) 1994-2007 Geant4
Collaboration
*************************************************************
Making
dependency for file src/G4ios.cc ...
Making
dependency for file src/G4coutDestination.cc ...
Making
dependency for file src/G4VStateDependent.cc ...
Making
dependency for file src/G4VNotifier.cc ...
Making
dependency for file src/G4VExceptionHandler.cc ...
Making
dependency for file src/G4UnitsTable.cc ...
Making
dependency for file src/G4Timer.cc ...
Making
dependency for file src/G4StateManager.cc ...
Making
dependency for file src/G4SliceTimer.cc ...
Making
dependency for file src/G4PhysicsVector.cc ...
Making
dependency for file src/G4PhysicsTable.cc ...
Making
dependency for file src/G4PhysicsOrderedFreeVector.cc ...
Making
dependency for file src/G4PhysicsLogVector.cc ...
Making
dependency for file src/G4PhysicsLnVector.cc ...
Making
dependency for file src/G4PhysicsLinearVector.cc ...
Making
dependency for file src/G4PhysicsFreeVector.cc ...
Making
dependency for file src/G4OrderedTable.cc ...
Making
dependency for file src/G4LPhysicsFreeVector.cc ...
Making
dependency for file src/G4Exception.cc ...
Making
dependency for file src/G4DataVector.cc ...
Making
dependency for file src/G4AllocatorPool.cc ...
Compiling
G4AllocatorPool.cc ...
G4AllocatorPool.cc
Compiling
G4DataVector.cc ...
G4DataVector.cc
Compiling
G4Exception.cc ...
G4Exception.cc
If you get a response such as:
On this machine the G4LIB_BUILD_STATIC=1
On this machine the G4LIB_USE_GRANULAR=1
e:/Geant4/geant4_8_3/config/common.gmk:36: *** target pattern contains no `%'. Stop.
Starting build...
GNUmakefile:108: *** target pattern contains no `%'. Stop.
You probably just have the wrong version of the Cygwin make
utility. The latest version,
3.81-1, does not work for Geant4.
You instead need the previous version, 3.80-1. Go back to the above
instructions about installing Cygwin, rerun the "setup.exe" utility
that you already downloaded, and follow the above instructions about how to
select the specific version of make.
Cygwin does a nice job of remembering what you have already installed
and will not make you download everything all over again. Once you have the correct version of
make, clean up your failed Geant4 build by removing the tmp, lib and bin
directories and redo the ./Configure -build.
Once you see any lines like:
Compiling G4AllocatorPool.cc ...
with no errors,
the compilation is successfully under way.
Adjust your machine's power management properties so that it doesn't go to sleep, and then walk away for a long long time. Wait, and wait, and wait, for the initial compilation to run.
The same information that is showing on the console is also being written to a log file so that you can review it later if necessary. The information will appear in:
c:/Geant4/geant4_8_3/.config/bin/WIN32=VC
An example of how this log file should look can be found in this same web directory as:
Eventually, you will see messages stating that libname.map has been built, then you will see messages about successful completion:
Libmap
stage. Searching for GNUmakefiles and sorting ...
Weeding
out paths and files ...
Making
libname.map starter file ...
Making
libname.map ...
Reading library name map file...
Reading dependency files...
Checking for circular dependencies...
Reordering according to dependencies...
Writing new library map file...
Libraries
installation completed !
####################################################
#
Your Geant4 installation seems to be successful!
#
To be sure please have a look into the log file:
#
/cygdrive/c/Geant4/geant4_8_3/.config/bin/WIN32-VC/g4make.log
####################################################
Here are some hints for some of the most common problems you might encounter:
Hint 1: If you get a response such as:
Libmap stage. Searching for GNUmakefiles and sorting ...
Weeding out paths and files ...
: No such file or directoryfile
: No such file or directoryr/GNUmakefile
: No such file or directoryGNUmakefile
: No such file or directoryement/GNUmakefile
: No such file or directorying/GNUmakefile
Making libname.map ...
Reading library name map file...
ERROR: "source/<unique-sub-path>/GNUmakefile" expected.
make[1]: *** [libmap] Error 1
make: *** [all] Error 2
you probably selected the wrong "Default Text File Type" when you did the Cygwin installation. You should have selected "File Type: Unix / binary".
What you really need to do now is delete everything and go all the way back to "Getting and Installing Cygwin".
Hint 2: If you get a response that includes:
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\INCLUDE\utility(54) : error C2079: 'std::pair<_Ty1,_Ty2>::second' uses undefined class 'G4AttDef'
with
[
_Ty1=const G4String,
_Ty2=G4AttDef
]
É h:/geant4/geant4_8_3/source/graphics_reps/include\G4AttHolder.hh(75) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
with
[
_Ty=const std::map<G4String,G4AttDef> *
]
make: *** [c:/geant4/tmp/WIN32-VC/G4vis_management/G4VSceneHandler.o] Error 2
you probably forgot to include the "SP1" patch to
Microsoft Visual Studio.
Review step 3a of the instructions above for Visual
Studio. Or just work around this
Microsoft compiler problem by adding one line to one Geant4 file:
In the file:
c:/geant4/source/visualization/management/src/G4VSceneHandler.cc
add the following line near all of the other include statements:
#include "G4AttDef.hh"
and then redo the ./Configure build (don't worry, Configure
will not spend time recompiling everthing, it will only redo the parts that had
problems).
Hint 3: If you get a message early in the compilation
that says something about a missing "windows.h":
you probably have one of the following problems involving Platform SDK:
a) you forgot to do the "Platform SDK" part of the Microsoft Visual Studio installation (review step 3b of the instructions above for Visual Studio),
b) the Platform SDK installation was not successful (try again)
c) you did not correctly reference the Platform SDK in your
cygwin.bat file (see the section above titled "Making Cygwin aware of
Microsoft Visual C++ and Microsoft Platform SDK").
The configure process has set up some environment variables that you will want to have in future sessions. Have configure make you an environment setup script by typing:
./Configure
(that was with no options, as opposed to ./Configure -build that you typed earlier).
You will see the following:
--- Geant4 Toolkit Installation ---
(setting environments for USER )
---------------------------------------------------
The Geant4 toolkit installation was found.
The files env.[c]sh will be copied to your current directory.
For setting Geant4 environments you should make:
source env.csh
or
. env.sh
It will also check G4WORKDIR setting and set it to
your HOME if needed.
You can use these files also for further modifications
(adding your own environments).
---------------------------------------------------
Your directory c:/Geant4/geant4_8_3 will now contain two scripts:
env.sh
and
env.csh
You have now built the Geant4 toolkit. If you have learned a little about
Geant4, you will know that Geant4 is not an application but rather a toolkit
from which you can build any number of applications. So before you can test Geant4, you need an example application.
You should create a new directory, outside of your Geant4
installation area, where you will keep your example applications. This separation of spaces will help you
avoid accidentally messing up your main Geant4 installation, and will insure that
if you eventually update your main Geant4 installation (for example when a
newer Geant4 release is available), your personal application work will not be
disturbed.
Create a new directory for your work, and designate it as
your G4WORKDIR.
For example, if you want your work to be in c:/g4work:
export G4WORKDIR=c:/g4work
Be sure to specify the G4WORKDIR using the c:/ notation rather than the Cygwin-specific notation, /cygdrive/c. The make utility does not understand the /cygdrive/c notation.
You can try any of the Geant4 examples. Some suggested starting points are any of the Novice examples
c:/Geant4/geant4_8_3/examples/novice
or the analysis example
c:/Geant4/geant4_8_3/examples/extended/analysis/A01
Each example is described in a detailed README it the example's top level directory.
Don't start with exampleN03. It has some peculiarities on Windows that are discussed later in this section. Pick some other example for now.
Whichever example you choose, copy it to your Geant4 work directory.
For
example, you might end up with:
c:/g4work/A01
Note that this step needs to be redone any time you start a fresh Cygwin window.
Type:
export G4WORKDIR=c:/g4work
source c:/Geant4/geant4_8_3/env.sh
It will respond:
On
this machine the G4SYSTEM=WIN32-VC
On
this machine the G4INSTALL=c:/Geant4/geant4_8_3