By courtesy of Cimne classroom ITESM-CIMNE
Warning: This is an old tutorial. If you look for the new one, please visit http://kratos-wiki.cimne.upc.edu/index.php/Installing_kratos_in_macOS.
The following steps shown how to install Kratos on Mac OS X running Leopard. This tutorial assume that the user have some basic knowledge about Unix OS and how to run command line tools using Terminal. This procedure has been tested with Kratos source code revision 158 (March, 2009).
MacOSX - Leopard came with his own version of SVN and Python pre installed, you can get gcc/g++ compiler by Installing XCode 3.0 development tool that came with the system installation Disks. To check this requirements type the following commands on a Terminal Window, you should receive the following output:
$ gcc -v Using built-in specs. Target: i686-apple-darwin9 Configured with: /var/tmp/gcc/gcc-5484~1/src/configure --disable- checking -enable-werror --prefix=/usr --mandir=/share/man --enable- languages=c,objc,c++,obj-c++ --program-transform-name= /^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with -slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with- tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9 Thread model: posix gcc version 4.0.1 (Apple Inc. build 5484)
$ g++ -v Using built-in specs. Target: i686-apple-darwin9 Configured with: /var/tmp/gcc/gcc-5484~1/src/configure --disable- checking -enable-werror --prefix=/usr --mandir=/share/man --enable- languages=c,objc,c++,obj-c++ --program-transform-name= /^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with -slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with- tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9 Thread model: posix gcc version 4.0.1 (Apple Inc. build 5484)
$ svn --version svn, version 1.4.4 (r25188) compiled Sep 23 2007, 22:32:34 Copyright (C) 2000-2006 CollabNet. Subversion is open source software, see http://subversion.tigris.org/ This product includes software developed by CollabNet (http://www.Collab.Net/). The following repository access (RA) modules are available: * ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol. - handles 'http' scheme - handles 'https' scheme * ra_svn : Module for accessing a repository using the svn network protocol. - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme
$ python --version Python 2.5.1
Download source code
Download Kratos from svn repository
Open a Terminal window and move to the desired kratos location, type the following command to download kratos latest release. In this example kratos will be located at /Applicacions/Utilities
$ cd /Applications/Utilities $ svn checkout http://kratos.cimne.upc.es/svn/kratos/
The download could take a while, depending of your connection speed. When download completes a folder inside /Applications/Utilities named kratos will be created. From time to time kratos source code could be updated by typing the following commands.
$ cd /Applications/Utilities/kratos $ svn update
At the end of both procedures you should receive the following message (note that revision 158 was the current revision at the time this tutorial was created)
$ Updated to revision 158.
Using a web browser, go to http://www.boost.org/users/history/ and select Boost version 1.34.1. The link will redirect to Sourceforge download page. Select the package with zip format to download (boost_1_34_1.zip). When download completes double click the zip file to uncompress its contents (usually located at ~/Downloads/boost_1_34_1.zip). Move the unpacked folder to external_libraries inside kratos folder so the path becomes /Applications/Utilities/kratos/kratos/external_libraries/boost_1_34_1
Download Boost Jam
Also go to http://www.boost.org/users/download/ and download Boost Jam 3.1.17. The link will also redirect to Sourceforge download page. Select the zip version to download (boost-jam-3.1.17.zip). When download completes double click the zip file to uncompress its contents (usually located at ~/Downloads/boost-jam-3.1.17.zip). Move the unpacked folder to external_libraries inside kratos folder so the path becomes /Applications/Utilities/kratos/kratos/external_libraries/boost-jam-3.1.17
Set environment variables
Some environment variables must be created in order to make the compilation process much easier. First open your .bash_login file to add the environment variables values, note there is a dot (.) at the beginning of the file name, which means it is a system file and it is usually hidden on a regular Finder window, so you could open it by typing the following command on Terminal
$ open ~/.bash_login
If you receive a message from the console telling you the file does not exist then you will have to create it, then open it. If that your case type the following command.
$ echo “# My Bash Login File” > ~/.bash_login $ open ~/.bash_login
When .bash_login is open add the following lines and save it.
export KRATOS_ROOT=/Applications/Utilities/kratos export KRATOS_EXTLIB=$KRATOS_ROOT/external_libraries export BOOST_ROOT=$KRATOS_EXTLIB/boost_1_34_1 export BJAM_ROOT=$KRATOS_EXTLIB/boost-jam-3.1.17 export PATH=$PATH:$BJAM_ROOT/bin.macosxx86
Note that if you downloaded kratos on a different location than /Applications/Utilities (See Step 1) you must replace /Applications/Utilities for the absolute path where kratos is located. (for example, if you downloaded kratos in your document folder use export KRATOS_ROOT=$HOME/Documents/kratos).
Also note that the path $BJAM_ROOT/bin.macosxx86 does not exists, yet; that location will be created during the compilation process.
This variables will be useable next time you open a Terminal window, for instance, you could type the following command to test it.
$ $BOOST_ROOT -bash: /Applications/Utilities/kratos/external_libraries/boost_1_34_1: is a directory
This variables will be valid only within the current Terminal session, if you planning to use it elsewhere (for example using the function getenv() on a C source code) is preferable to create them on environment.plist located at $HOME/.MacOSX).
Compile the auxiliary libraries
Build bjam command-line tool
Using terminal, go to BJAM_ROOT, and run the script bluid.sh with the option darwin, maybe it is necessary to change the mode of bluid.sh to executable before running the process. The following commands illustrate how:
$ cd $BJAM_ROOT $ chmod +x build.sh $ ./build.sh darwin
When process is complete a folder named bin.macosxx86 inside BJAM_ROOT will be created, inside is the executable bjam tool which location is referred with the PATH created inside .bjam_login, to test it simple type the following command on a Terminal window, you should receive the next message:
$ bjam --version Boost.Build V2 (Milestone 11) Boost.Jam 03.1.17
Build Boost.Python Library
Using terminal, go to BOOST_ROOT, and run bjam with the option toolset=darwin --with-python. This process could take a while.
$ cd $BOOST_ROOT $ bjam toolset=darwin --with-python
After the process is complete, a folder named bin.v2 will be created inside BOOST_ROOT with the boost.python library compiled. It is necessary to update the library and include folder with the location of boost and boost.ptyhon libraries; use the following command for such task (it is necessary to type user password).
$ sudo ln -s $BOOST_ROOT/boost /usr/include/boost $ sudo ln -s $BOOST_ROOT/bin.v2/libs/python/build/darwin/debug/link-static/threading-multi/libboost_python-mt-d-1_34_1.a /usr/lib/libboost_python-mt-d.a $ sudo ln -s $BOOST_ROOT/bin.v2/libs/python/build/darwin/release/link-static/threading-multi/libboost_python-mt-1_34_1.a /usr/lib/libboost_python-mt.a
Build GidPost Library
Using Terminal go to $KRATOS_EXTLIB/gidpost/unix folder and type the following commands
$ cd $KRATOS_EXTLIB/gidpost/unix $ make clean $ make
When process is complete a folder named release will be created inside $KRATOS_EXTLIB/gidpost/unix which contains the file libgidpost.a
Build Super LU Library
Using terminal, got to SuperLU_3.0 directory located at $KRATOS_ROOT/applications/ExternalSolversApplication/custom_external_libraries/SuperLU_3.0, download make.zip, extract its contents and raplace the file make.inc inside SupelLU_3.0 directory
Build the Blas and SuperLU Library by typing the followings command (LIB folder must be created)
$ mkdir LIB $ make blaslib $ make superlulib
When this processes are completed, two libraries are created inside LIB. libblas.a and subsupelu_3.0.a. The next step is to put a symbolic link of this libraries inside /usr/lib directory (it is necessary to type user password).
$ sudo ln -s $KRATOS_ROOT/applications/ExternalSolversApplication/custom_external_libraries/SuperLU_3.0/LIB/libblas.a /usr/lib/libblas.a $ sudo ln -s $KRATOS_ROOT/applications/ExternalSolversApplication/custom_external_libraries/SuperLU_3.0/LIB/libsuperlu_3.0.a /usr/lib/libsuperlu_3.0.a
Go to KRATOS_ROOT and copy the file Common_Jamroot, rename it to Jamroot. At kratos revision 158 it is not necessary to update/customize anything in Jamroot.
Using Terminal go to KRATOS_ROOT and type the following commands
$ cd $KRATOS_ROOT $ bjam toolset=darwin threading=multi -d2
Be aware when the process says “patience...”, I mean it, because if everything were set correctly the compilation process could take a while (approximately an hour or so).
The command -d2 is optional, it allows to se the compilation process in “verbose” mode which is easier to see the nature of an error when a compilation process fails. During compilation procedure a bunch of warnings came up, please ignore them. At the end of the compiling process should not be any “...failed” or “..skipped” message.
Now it's time to test it.