在Ubuntu上配置Geant4开发环境,需要安装一系列依赖项,并进行环境变量配置。以下是详细的步骤:
安装编译工具:
sudo apt-get install build-essential
安装CMake:
wget http://www.cmake.org/files/v3.28/cmake-3.28.3.tar.gz
tar -xvf cmake-3.28.3.tar.gz
cd cmake-3.28.3
./configure
make
sudo make install
安装CLHEP:
mkdir geant4
cd geant4
wget http://proj-clhep.web.cern.ch/proj-clhep/clhep23.html
tar -xvf clhep-2.4.7.1.tgz
cd 2.4.7.1
mkdir build
cd build
cmake ../CLHEP
sudo make install
安装其他依赖库:
sudo apt-get install git dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev gfortran libssl-dev libpcre3-dev xlibmesa-glu-dev libglew1.5-dev libftgl-dev libmysqlclient-dev libfftw3-dev libcfitsio-dev graphviz-dev libavahi-compat-libdnssd-dev libldap2-dev python-dev libxml2-dev libkrb5-dev libgsl0-dev libqt4-dev
安装QT:
sudo apt-get install qt5-default
安装Geant4:
下载Geant4的源码压缩包,解压后按照中的步骤进行编译安装。
设置Geant4环境变量:
编辑~/.bashrc
文件,添加以下内容:
export GEANT4=/path/to/geant4-v11.1.1-build
source $GEANT4/bin/geant4.sh
更新环境变量:
source ~/.bashrc
完成以上步骤后,Geant4开发环境应已正确配置。可以通过运行geant4
命令来验证安装是否成功。