Installation details

From Yade

Revision as of 10:28, 18 September 2009 by Richefeu (talk | contribs) (Bazaar and scons installation)

Installation browse

<categorytree mode=pages>Installation</categorytree>

Bazaar and scons installation

In order to install yade on a computeur, it is first necessary to get the sources. This is achieved through the python software called bazaar (version >= 1.7). Yade "modules" are then compiled with an other python software called scons. Most recent stable versions of these softwares can easily be downloaded on their respective sites: bazaar(http://bazaar-vcs.org/Download) and scons(). Assuming that python is ok, the installation is also simple. cd into the downloaded folder and type:

$ sudo python setup.py install

Systemwide installation as root

By default yade installs in directory /usr/local, but to install there you need a root access. So running just scons some options should be enough. However, since you want to install yade systemwide as root, it might be better if you built a debian package instead.

Installing from debian source packages

This repository contains weekly snapshots from svn in the form of debian source packages. To compile and install these (assuming that you already have required packages installed), you need to add repository source do your '/etc/apt/sources.list':

deb-src http://geo.hmg.inpg.fr/~smilauer/yade ./

Pick a revision number you want (eg. 1234), based on the repository contents - see http://geo.hmg.inpg.fr/~smilauer/yade, then run:

apt-get source yade-svn1234
sudo apt-get build-dep yade-svn1234
cd yade-svn1234-1
fakeroot-tcp debian/rules binary

Once compiled, you will have optimized (yade-svn1234), debug (yade-svn1234-dbg) and development (yade-svn1234-dev) packages in ../, which you can install by:

sudo dpkg -i ../yade-svn1234*.deb

Scons options

Scons is the tool used to build and install yade. Always run it from the top directory of yade.

Scons options
parameter default value description
PREFIX /usr/local The directory where yade will be installed. Different yade versions will not overwrite each other in PREFIX directory. See version and variant below. This parameter is passed to the preprocessor as PREFIX macro (expands to quoted string).
version auto Scons autodetects svn revision or release number, so it will be "svn1144" or "0.11.0", for example. If this fails, it will be "unknown". It is used to build `SUFFIX` (see `variant`).
variant empty Free-form name that describes variant of this version (usually something like "-debug", "-optimized" etc. May be empty. SUFFIX is a macro defined by the preprocessor (as quoted string) that has the form "$version$variant", i.e. svn1144-debug if version=svn1144 and variant=debug.
debug 1 Pass debugging flags to the compiler (generates debugging symbols in binaries), defines YADE_DEBUG symbols. Defaults to true.
optimize 0 Defines YADE_CAST (YADE_PTR_CAST) as static_cast (static_pointer_cast) and pass optimization flags to the compiler. Use together with debug to get fast code with debug symbols included. Defaults to false.
buildPrefix .. Specify where to put the build-0.11.0 directory, which will hold all files created during compilation. This ensures that the source tree remains clean and that different builds (like optimized and debugging) are strictly separated, like build-0.11.0 and build-0.11.0-debug
jobs 4 How many compilations should run in parallel. Defaults to four, if your computer is weak you may want a lower number. Equivalent to make -j4
CXX g++ C++ compiler you want to use. You can say CXX="distcc g++" to have distributed build, if that is configured.
CPPPATH empty Additional paths for the c proprocessor (whitespace separated). Use it for locally-installed libraries, eg.: CPPPATH="/usr/local/include /home/fred/build/log4cxx/include"
LIBPATH empty Additional paths for linker (whitespace separated).

To see all the options, along with their default and current values, say `scons -h`.

As an example, to compile yade I use following command

scons jobs=10 pretty=0 debug=1 optimize=0 profile=0 CXX="distcc g++" PREFIX=/home/janek/YADE useMiniWm3=0 CPPPATH=/usr/include/wm3

The last two options are related to the wildmagic 3 library. All options are stored inside scons.config file, so the next time you compile yade, you can really just issue scons command, unless you want to change something.

Automatic library detection

Scons will attempt detection of necessary libraries on your system at every run. If it fails, you can look at the $buildDir/config.log (eg.: ../build-0.11.0/config.log) file to see what went wrong. If you have some of the dependencies (like lib3dviewer) installed locally in /usr/local, you will have to use:

scons CPPPATH=/usr/local/include/wm3 LIBPATH=/usr/local/lib

so that scons will find it.

Installing the wildmagic 3 library on debian

The wildmagic 3.11 library is used by Lattice Geometrical Model when it's available. It's only to have dalaunay triangulation in 2D and 3D during specimen generation.

Add the following line at the end of your /etc/apt/sources.list:

deb-src http://geo.hmg.inpg.fr/~smilauer/yade ./

Then donwload, compile and install wildmagic library:

sudo apt-get update 
apt-get source wildmagic 
sudo apt-get build-dep wildmagic 
cd wildmagic-3p11/ 
fakeroot debian/rules binary 
sudo dpkg -i ../wildmagic-dev*.deb

To tell scons that wildmagic is installed you need to add those parameters to scons: useMiniWm3=0.

Backward compatibility options

If you have older software installed, you can use:

Compatibility options
parameter description
CXXFLAGS='-DNO_GLUTINIT' Older versions of libglut do not have function glutInit(), you should use this compilation flag then.
CXXFLAGS='-DQGLVIEWER20' If you are using older QGLViewer (version 2.0) you should use this flag, otherwise you will get error about setFileName().
CXXFLAGS='-pthread -lpthread' If you are compiling with gcc3.3 (an older compiler).
CXXFLAGS='-fPIC' When compiling on AMD64.

You can connect several CXXFLAGS by spaces: CXXFLAGS='-DNO_GLUTINIT -DQGLVIEWER20'

Cleaning and uninstalling

To clean the compilation invoke from yade-0.11.0/:

scons -c

You can remove the compilation directory of yade, usually located in upper directory and starting with name build, like this one:

rm -rf ../build-svn1144

If yade was installed manually, the you can delete files from

/usr/local/lib/yade/
/usr/local/include/yade/
/usr/local/bin/yade

or from (depending where yade was installed):

/home/username/YADE/lib/
/home/username/YADE/include/
/home/username/YADE/bin/yade

If yade was installed from debian package, you can simply remove the package, and that's all.

Install paths

All files installed are versioned so that different versions and variants don't clash with each other - you can have as many version as you want installed at the same time. Supposing that we have variant=-dbg and version=svn1234 (note that $SUFFIX=-$version$variant) and PREFIX=/usr/local, we have

Paths
what kind path used example
executable $PREFIX/bin/yade$SUFFIX /usr/local/bin/yade-svn1144-debug
default plugins $PREFIX/lib/yade$SUFFIX/lib/*/lib*.so /usr/local/lib/yade-svn1144-debug/*/lib*.so
pkg-config script $PREFIX/lib/pkgconfig/yade$SUFFIX /usr/local/lib/pkgconfig/yade-svn1144-debug.pc
user configuration directory $HOME/.yade$SUFFIX /home/fred/.yade-svn1144-debug
headers (note: common for a particular version, regardless of variant) $PREFIX/include/yade$version/yade/*/*.hpp /usr/local/include/yade-svn1144/yade/*/*.hpp


See also