Installing GEANT4 (version 4.9.2) on Kubuntu 8.10 (Intrepid Ibex) with KDE 4.1
------------------------------------
Comments on Kubuntu Versions since 7.04
The information on this page is valid for versions 7.04 (Feisty Fawn) to the current version. I started this page with Feisty Fawn and have done installs on all flavours since with this page being my reference point, so if you have any version between 7.04 and the current, these notes will work for you. I have updated the commands and K Menu lists for the default KDE 4 install, so you may have to root around in KDE 3.5 to find these programs.
At one point, I had to reinstall a fresh Kubuntu after a failed upgrade to Gutsy. Starting from scratch, the following information may help:
When you get to the point in the installation below where you type
./configure --prefix /usr/share/CLHEP and it fails with gcc unable to
make an output, then your C-libraries are not installed. Type:
username@kubuntu:~$ sudo aptitude
install build-essential
By following the instructions below, I was able to avoid the invisible detector problem in Kubuntu since Gutsy Gibbon (7.10). I read that the Ubuntu developers have decided to shift away from the rigourous open-source philosophy and have allowed Ubuntu to detect devices that use proprietary drivers. When Gutsy was first installed, it noted my Intel card and loaded the appropriate restricted driver. After building GEANT4, example A01 showed the detector without further fixes.
------------------------------------
Document Pre-amble
I wrote this site both as a reference for people in my lab (and myself) as well as an additional resource for people who may be having trouble installing GEANT4 on their systems where I may have indicated a step that helps to debug their own installation, especially for the
Invisible Detector problem with OpenGL. This document is written for the newbie as much as possible (no assumptions on previous knowledge other than you got your system installed).
Warning/Disclaimer/Note of "Be Reasonable": I have listed commands as I have used while installing GEANT4 and the associated visualization packages: they are only here for reference specifically for my installations on Kubuntu Linux machines in our lab. Refer to the installation guides for their use and expected output, I am not responsible for the GEANT4 application, source files or command lines nor claim original authorship with regards to the GEANT4 commands in this document.
The installation steps here were adapted from Joseph Perl's information on the SLAC website
[1], where the expected output from each installation step was provided. I
highly recommend using that site as your default installation site and this site for information if you run into trouble with Kubuntu specifically. I am not a GEANT expert nor a Kubuntu expert, just a user trying to be helpful. I have installed GEANT4 on 3 different computer "architectures" running Kubuntu and have seen several problems repeatedly.
Table of Contents
1.
Introduction
2.
Package Installations through Adept
3.
GEANT4 and CLHEP Installation
4.
Visualization Installation
    4.1.
OpenGL and the Invisible Detector
    4.2.
HepRep
    4.3.
DAWN
1. Introduction
These instructions are adapted from the instructions provided by the SLAC team
[1] specifically for a user who is installing GEANT4 on a fresh install of Kubuntu. This installation has been tested on our computers, one running with an AMD64 processor and one with an Intel 2.4 GHz Pentium 4.
If you have a currently running version of Kubuntu, it should suffice to go through this site to verify the components you already have installed before installing GEANT4.
Being new to Linux and Kubuntu, I found the following websites very helpful (click on each reference number) [
2,
3]
2. Package Installations through Adept
Ensure the following packages are installed on your computer using Adept (default repositories):
- autoconf
- automake1.9
- tcl8.4
- tk8.4
- g++ (supposed to have 3.4, but you will get 4.1)
- libglu1-mesa-dev
- libxt-dev
- libxmu-dev
- xlibs-dev (comes with many dependent libraries--may no longer exist for recent versions of Kubuntu)
Adept is found by either using the KDE Menu (K &rarr System &rarr Adept Manager) or you can do direct installs from the terminal and separate the package anmes with a space. The program will grab the package and its dependencies and ask whether to install or not (Y/n). You will often see more packages than in your list. The console is found by (K &rarr System &rarr Konsole Terminal):
username@kubuntu:~$ sudo aptitude install < package >
Example:
username@kubuntu:~$ sudo aptitude install autoconf automake1.9 libglu1-mesa-dev libxt-dev
NOTE: The Ubuntu family of operating systems does not have a root user by default, we will set that later. As a user doing an install or other administrative tasks, you use the "sudo" command to accomplish a task as a "super-user" with the password being your own password.
3. GEANT4 and CLHEP Installation
For my installation, I preferred to install GEANT4 like any other program in Kubuntu by placing the program in /usr/share. I have also used Firefox to download my files, which are stored by default to my Desktop directory (Konqueror as the default browser will likely put this in your home directory: /home/username). All of these instructions are based on the conditions stated above and at each point below, the commands start from the home directory (~).
- Enable the root password and choose a different password than your own with a high difficulty level (numbers, symbols, etc.) [4]
Linux@kubuntu:~$ sudo passwd root
- Download the zipped tarball of CLHEP 2.0.4.2 from the CLHEP Home Page
(clhep-2.0.4.2.tgz) in Downloading &rarr Source code and precompiled binary distribution kits. Now we will make a CLHEP folder in /usr/share
for all users by typing the following in a terminal window and place the contents of the zipped file into that folder:
username@kubuntu:~$ su (enter your root password)
root@kubuntu:~# cd /usr/share
root@kubuntu:/usr/share# mkdir CLHEP
root@kubuntu:/usr/share# cd CLHEP
root@kubuntu:/usr/share/CLHEP# tar zxvf /home/username/Desktop/clhep-2.0.4.2.tgz
- Now that CLHEP is unzipped in /usr/share/CLHEP, we will build it by doing the following:
root@kubuntu:/usr/share/CLHEP# cd 2.0.4.2/CLHEP
root@kubuntu:/usr/share/CLHEP/2.0.4.2/CLHEP# ./configure --prefix /usr/share/CLHEP
root@kubuntu:/usr/share/CLHEP/2.0.4.2/CLHEP# make
root@kubuntu:/usr/share/CLHEP/2.0.4.2/CLHEP# make install
- Download the GEANT4.9.2 source file by getting the zipped tarball file from the GEANT4 Download Page and clicking on the "GNU or Linux tar format" button.
- Make the GEANT4 directory and unpack the tarball in the following way to have the contents placed in the GEANT4 folder (still as root):
root@kubuntu:/usr/share/CLHEP/2.0.4.2/CLHEP# mkdir /usr/share/GEANT4
root@kubuntu:/usr/share/CLHEP/2.0.4.2/CLHEP# cd /usr/share/GEANT4
root@kubuntu:/usr/share/GEANT4# tar zxvf /home/username/Desktop/geant4.9.2.tar.gz
- Download the GEANT4 Low Energy Physics Data source from the GEANT4 Download Page by clicking on the "Data files for low energy electromagnetics processes" button. Make a directory for the files in the GEANT4 install folder and unzip the data package there:
root@kubuntu:/usr/share/GEANT4# mkdir geant4.9.2/data
root@kubuntu:/usr/share/GEANT4# cd geant4.9.2/data
root@kubuntu:/usr/share/GEANT4/geant4.9.2/data# tar zxvf /home/username/Desktop/G4EMLOW.6.2.tar.gz
- Now that GEANT4 is unzipped in /usr/share/GEANT4/geant4.9.2, we will build it by doing the following steps. At this point, you need to follow the instructions on the installation guide for doing the initial build.
root@kubuntu:/usr/share/GEANT4/geant4.9.2/data# cd ..
root@kubuntu:/usr/share/GEANT4/geant4.9.2# ./Configure -build
&rarr CLHEP_BASE_DIR=/usr/share/CLHEP
&rarr Your OGLHOME should be located in /usr if you had the above packages installed.
- Set up the GEANT4 environment variables by typing:
./Configure
- Log out of root by typing exit.
- Make a work directory (not supposed to be in your install directory, each user will have their own work directory):
username@kubuntu:~# mkdir /home/username/GEANT4
username@kubuntu:~# mkdir /home/username/GEANT4/work
- Set up .bashrc. This is a hidden file (hence the . that precedes the filename) that sets up your console to your personal preferences (plus some default stuff). In Kubuntu, the console is BASH by default (I believe), which is why I set up the .bashrc found in /home/username. Type:
username@kubuntu:~$ nano .bashrc
Note: You could also type "pico .bashrc". I use nano(pico) because I am already in the terminal and I find this text editor simple to use. If you prefer something more graphical you could type "kate .bashrc" and get a simple text editor or call up Kate yourself by navigating in the KDE menu to (K &rarr Utilities &rarr Kate), going to File/Open, hitting F8 (to view hidden files) and opening .bashrc.
Add the following lines to the end of .bashrc:
export G4WORKDIR=/home/username/GEANT4/work/
export LD_LIBRARY_PATH=/usr/share/CLHEP/lib
source /usr/share/GEANT4/geant4.9.1.p01/env.sh
You should now have an installed GEANT4 system! Open a new shell to start working with GEANT4.
4. Visualization
I prefer using the instructions from the
GEANT4 SLAC Tutorial, May 2007 to install the visualization software for GEANT4. I copy novice example A01 to my work directory
username@kubuntu:~$ cp -r /usr/share/GEANT4/geant4.9.2/examples/extended/analysis/A01 /home/username/GEANT4/work
username@kubuntu:~$ cd /home/username/GEANT4/work/A01
username@kubuntu:/home/username/GEANT4/work/A01$ make
username@kubuntu:/home/username/GEANT4/work/A01$ ../bin/Linux-g++/A01app
This example will allow to follow the instructions on the tutorial page for OpenGL. After loading the program, you get the Idle prompt and type:
Idle> /vis/open OGLIX
Idle> /vis/drawVolume
And you should see the detector!!
  4.1 OpenGL and the Invisible Detector
On two Linux boxes running Kubuntu, I have seen the Invisible Detector problem as noted on the HyperNews discussion forum [5]. In each case, I have had a successful OpenGL install in GEANT4, but could only see the trajectories when running the examples. Originally, on HyperNews, I had stated that installing the Mesa libraries and having the following line in .bashrc would fix the problem:
LD_LIBRARY_PATH=/usr/share/CLHEP/lib:/usr/share/Mesa/lib
The problem is that I could not replicate this procedure on a different computer (nor could other users). This procedure worked on a Toshiba Satellite Laptop (with the Intel chipset) where, at the SLAC Tutorial in May 2007, I had installed everything Mesa and OpenGL related and finally after following the point made by M. Ito on his Wiki site [6], linked LD_LIBRARY_PATH as above and solved the problem.
On an AMD64 with an ATI card, I found the following solution that may also fix problems associated with NVIDIA cards that users have mentioned on HyperNews. Kubuntu, by default, does not use restricted modules/drivers so you need to install a program called restricted-manager in Adept [7]. The restricted-manager program will identify your ATI or NVIDIA card and install and configure the appropriate driver in xorg.conf (at least it did for me for an ATI card and an NVIDIA card).
This removed the Invisible Detector problem on the AMD64 computer. When the card is detected it often has a comment window that says enabling the driver will allow for 3D graphics for your computer; doing this beforehand on the P4 with an NVIDIA card resulted in A01 running properly (detector was visible) immediately after installation.
After installing the restricted-manager, go to the terminal to backup your X windows configuration file and enable the driver:
username@kubuntu:~$ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_bkup
username@kubuntu:~$ sudo /usr/bin/restricted-manager
For ATI, I followed this with sudo ati-config --initial and solved the invisible detector problem. For the NVIDIA card, I had a hiccup (I am using a widescreen monitor) and made sure I was using the nv driver (not nvidia) and that I also had ddcprobe installed from Adept. These last two points I am not perfectly clear on, maybe someone else had a similar issue that can clarify this further (sorry).
  4.2 HepRApp
When installing Java for this program, BE CAREFUL!!! If you do not scroll down to accept the user agreement, you will cause major disruptions in your installation!!
You will get a window called Debconf. Scroll down until you see "Do you agree with the license terms" and click it BEFORE hitting Next. If you don't do this and you are lucky, an update icon in your system tray will appear (as though you have upgrades) and running this may fix the error (it worked for me).
In Adept, install sun-java6-jre and sun-java6-bin and then download HepRApp from the SLAC Tutorial site. I placed the HepRep browser in my GEANT4 work directory. To test the installation, I run the vis.mac Macro for A01 to generate HepRep files:
username@kubuntu:~/GEANT4/work$ ../bin/Linux-g++/A01/A01app vis.mac
username@kubuntu:~/GEANT4/work$ java -jar HepRApp.jar
  4.3 DAWN
On the DAWN install site, you are asked to install ActiveTcl; however if you have installed tcl8.4 and tk8.4 from Adept as requested above, you already have what you need to run DAWN. You can test this by typing wish in the terminal. A small window should appear if you have a proper installation. Ghostview came by default with Kubuntu (check for kghostview in Adept).
Download the DAWN source code, and using this procedure here, I made a DAWN directory in /usr/share as well.
username@kubuntu:~$ sudo mkdir /usr/share/DAWN
username@kubuntu:~$ cd /usr/share/DAWN
username@kubuntu:/usr/share/DAWN$ su
root@kubuntu:/usr/share/DAWN# tar zxvf /home/username/Desktop/dawn_3_88a.taz
root@kubuntu:/usr/share/DAWN# cd dawn_3_88a
root@kubuntu:/usr/share/DAWN# make clean
root@kubuntu:/usr/share/DAWN# make guiclean
root@kubuntu:/usr/share/DAWN# make
root@kubuntu:/usr/share/DAWN# exit
Then I added the PATH comment (export PATH=$PATH:/usr/share/DAWN/dawn_3_88a) to my .bashrc and tested my installation by running the following:
username@kubuntu:~$ dawn /usr/share/DAWN/dawn_3_88a/prim1.prim
References
[1] J. Perl, "Installing Geant4 Release 4.8.3 on Linux", accessed June 26, 2007.
[2] Psychocats.net, "Ubuntu Linux Resources", accessed June 26, 2007.
[3] Ubuntuguide.org, Unofficial Ubuntu 7.04 (Feisty Fawn) Starter Guide", accessed June 27, 2007.
[4] A.G. Reinhold, The Diceare Passphrase Home Page", accessed June 27, 2007.
[5] GEANT4 HyperNews, "OpenGL vis: cannot see detector shape, only particle tracks", accessed June 27, 2007.
[6] M. Ito, "Invisible detector problem", accessed June 27, 2007.
[7] Ubuntu Documentation, "BinaryDriverHowto/ATI", accessed June 27, 2007.