Software/Geant4/Installation/Coin3D
Introduction
Coin3D
is a high-level, retained-mode toolkit for effective 3D graphics development.
It is API compatible with Open Inventor 2.1.
Geant4
requires the Coin3D
headers and libraries in order to provide support for Open Inventor visualisations.
In order to function correctly, Coin3D
requires the following additional components to be installed:
- The
simage
library with image format loaders and front-ends to common import libraries.simage
is meant for use with applications which read image files as textures.simage
must be installed beforeCoin3D
. - The
SoXt
open source InventorXt library, which is a GUI binding for using Open Inventor with Xt/Motif.SoXt
has been developed for use withCoin3D
.SoXt
needs to be installed afterCoin3D
. SoXt
open sourceQt
GUI component toolkit library forCoin3D
.SoQt
needs to be installed afterCoin3D
.
Details
Coin3D
- Website
- https://bitbucket.org/Coin3D/coin/
- Source URL
- https://bitbucket.org/Coin3D/coin/downloads
- Installed version
- 3.1.3 (13 February 2012)
- Source tarball
src/geant4-prerequisites/coin3d/Coin3d-3.1.3.tar.gz
simage
- Website
- https://bitbucket.org/Coin3D/simage
- Source URL
- https://bitbucket.org/Coin3D/coin/downloads/simage-1.7.0.tar.gz
- Installed Production version
- 1.7.0 (13 February 2012)
- Source tarball
src/geant4-prerequisites/coin3d/simage-1.7.0.tar.gz
- Installed development version
- 1.7.1a (20 October 2017)
- Central Repository
- https://bitbucket.org/Coin3D/simage
SoXt
- Website
- https://bitbucket.org/Coin3D/soxt
- Source URL
- https://bitbucket.org/Coin3D/coin/downloads/SoXt-1.3.0.tar.gz
- Installed version
- 1.3.0 (13 February 2012)
- Source tarball
src/geant4-prerequisites/coin3d/SoXt-1.3.0.tar.gz
SoQt
- Website
- https://bitbucket.org/Coin3D/soqt
- Source URL
- https://bitbucket.org/Coin3D/coin/downloads/SoQt-1.5.0.tar.gz
- Installed version
- 1.5.0 (13 February 2012)
- Source tarball
src/geant4-prerequisites/coin3d/SoXt-1.5.0.tar.gz
Installation Notes
The Coin3D
documentation provides some useful instructions on building and installing Coin3D
.
For installation, Coin3D
and the required libraries do not support installation into a sandbox directory (i.e. there are no options prefix
or DESTDIR
defined for command make install
) and must be given the installation directory with the --prefix
option.
As such, to recompile Coin3D
for different target directories, the configure
script must be rerun with a modified --prefix /path/to/dest
option.
This has to be managed manually as can be seen in the installation commands below.
Coin3D
and each of the components contain a number of programming errors.
Most can be ignored and skipped over by adding the compiler flag -fpermissive
at the configuration step.
However, there is an error in the Coin3D
source code that needs to be fixed before the code will compile: details on how to do so are given below.
SoXt
may require the following modifications to install correctly:
- The configuration tool cannot find the libraries it needs unless the environment variable LD_RUN_PATH is manually set to include
/unix/pbt/software/prod-sl6/lib
(set automatically by the environment scripts on the UCL HEP Linux Cluster). - For older versions of SoXt and SoQt, part of the code required for compilation was removed to a separate project called
SoGUI
. This GUI code needed to be incorporated into the library code before compilation. TheSoGUI
source code is available in a separate tarball,src/geant4- prerequisites/coin3d/sogui-2011-12-03.tar.gz
. The more recent versions of theCoin3D
components now incorporate this code by default.
Installation
When downloading software, the downloaded tarball (or other Zip
archive) should be placed in an appropriately named directory in /unix/pbt/software/src
: the instructions below assume that the directory is /unix/pbt/software/src/geant4-prerequisites/coin3d
.
The source code should then be extracted into a suitable subdirectory in /unix/pbt/software/build
.
The extracted source code directory can only be deleted once the software has been built and installed.
Instructions are given for compiling each component of Coin3D
: these must be followed in order.
Source Code Extraction
cd /unix/pbt/software/src/geant4-prerequisites/coin3d tar -xvz -f simage-1.7.0.tar.gz tar -xvz -f Coin-3.1.3.tar.gz tar -xvz -f SoXt-1.3.0.tar.gz tar -xvz -f SoQt-1.5.0.tar.gz
Fix Errors In Coin3D
Code
Coin3D
and each of the components contain a number of programming errors.
Most can be ignored and skipped over by adding the compiler flag -fpermissive
at the configuration step.
However, there is an error in the Coin3D
source code that needs to be fixed before the code will compile:
- In the
Coin3D
source directory, find the directorysrc/fonts/
and open the filesrc/fonts/freetype.cpp
. - Insert the following two lines in
src/fonts/freetype.cpp
before the line#include fonts/freetype.h
:#include <cstdlib>
#include <cmath>
The code should now compile successfully.
Further modifications to enable compiling Geant4 with OpenInventor
Geant4 compilation with OpenInventor enabled will fail unless an additional modification is made to the Coin3D source code.
Open the file /include/Inventor/SbBasic.h
inside the Coin3D source, and add the following line below #include <Inventor/C/basic.h>
:
#include <Inventor/C/errors/debugerror.h>
Build And Install
It is possible to build for the Production environment without deleting the Coin3D build
directory created for the Development installation, meaning that significant time is saved when running make
.
However, it isn't recommended to do so as the Production installation ends up referencing components within /unix/pbt/software/dev
which is not desirable as the two environments are no longer independent.
As such, these instructions assume one is building from scratch for each environment: to do so, make sure that the build/coin3d
directory is deleted before recreating it for the subsequent build and install.
Also, although it is possible to install straight to the Production environment, it is highly discouraged to do so without first compiling a Development version.
Installing simage
from its Central Repository
After the latest version has been pulled from its central repository and placed within /unix/pbt/software/src/geant4-prerequisites/simage, create a build directory within the PBT software directory from which you can compile the code:
cd /unix/pbt/software/build/ mkdir simage-1.7.1a cd simage-1.7.1a
simage
is then compiled using its /configure script with the following options. Note: Here, the software is to be installed into the development software directory using the command --prefix=/unix/pbt/software/dev/simage-1.7.1a
. Define this as appropriate for your system.
../../../src/geant4-prerequisites/simage/configure \ --prefix=/unix/pbt/software/dev/simage-1.7.1a
simage
can then be compiled and installed using the usual commands:
make make install
Development Environment: simage
cd /unix/pbt/software/build mkdir -pv coin3d/simage-1.7.0 cd coin3d/simage-1.7.0 ../../../src/geant4-prerequisites/coin3d/simage-1.7.0/configure --prefix /unix/pbt/software/dev/simage-1.7.0 CXXFLAGS=-fpermissive make make install
Development Environment: Coin3D
cd /unix/pbt/software/build mkdir -pv coin3d/Coin-3.1.3 cd coin3d/Coin-3.1.3 ../../../src/geant4-prerequisites/coin3d/Coin-3.1.3/configure --prefix /unix/pbt/software/dev/Coin-3.1.3 CXXFLAGS=-fpermissive make make install
Development Environment: SoXt
cd /unix/pbt/software/build mkdir -pv coin3d/SoXt-1.3.0 cd coin3d/SoXt-1.3.0 ../../../src/geant4-prerequisites/coin3d/SoXt-1.3.0/configure --prefix /unix/pbt/software/dev/SoXt-1.3.0 CXXFLAGS=-fpermissive make make install
Development Environment: SoXt
cd /unix/pbt/software/build mkdir -pv coin3d/SoQt-1.5.0 cd coin3d/SoQt-1.5.0 ../../../src/geant4-prerequisites/coin3d/SoQt-1.5.0/configure --prefix /unix/pbt/software/dev/SoQt-1.5.0 CXXFLAGS=-fpermissive make make install
Production Environment: simage
cd /unix/pbt/software/build mkdir -pv coin3d/simage-1.7.0 cd coin3d/simage-1.7.0 ../../../src/geant4-prerequisites/coin3d/simage-1.7.0/configure --prefix /unix/pbt/software/prod-sl6 CXXFLAGS=-fpermissive make make install
Production Environment: Coin3D
cd /unix/pbt/software/build mkdir -pv coin3d/Coin-3.1.3 cd coin3d/Coin-3.1.3 ../../../src/geant4-prerequisites/coin3d/Coin-3.1.3/configure --prefix /unix/pbt/software/prod-sl6 CXXFLAGS=-fpermissive make make install
Production Environment: SoXt
cd /unix/pbt/software/build mkdir -pv coin3d/SoXt-1.3.0 cd coin3d/SoXt-1.3.0 ../../../src/geant4-prerequisites/coin3d/SoXt-1.3.0/configure --prefix /unix/pbt/software/prod-sl6 CXXFLAGS=-fpermissive make make install
Production Environment: SoQt
cd /unix/pbt/software/build mkdir -pv coin3d/SoQt-1.5.0 cd coin3d/SoQt-1.5.0 ../../../src/geant4-prerequisites/coin3d/SoQt-1.5.0/configure --prefix /unix/pbt/software/prod-sl6 CXXFLAGS=-fpermissive make make install