Difference between revisions of "Compiling on Linux and Mac OS X"

From Avogadro - Free cross-platform molecule editor
Jump to: navigation, search
m (Building OpenBabel)
(major reworking)
Line 1: Line 1:
These instructions are inteded to help users to build Avogadro from the latest code. Be aware that Avogadro may fail to build or work properly at any given time when built using the instructions below. <br/>
+
These instructions are intended to help users build Avogadro from the latest code. Be aware that Avogadro may fail to build or work properly at any given time when built using the instructions below. <br/>
 
For the adventurous, there are also [[Compiling_on_Windows|Windows Visual Studio 2008]] instructions that may or may not work.
 
For the adventurous, there are also [[Compiling_on_Windows|Windows Visual Studio 2008]] instructions that may or may not work.
  
Line 6: Line 6:
  
 
== Dependencies ==
 
== Dependencies ==
 +
You should be able to find most of these dependencies in your distribution's repositories or as binary downloads for Mac from the homepages linked below. Make sure that you satisfy any version requirement given.
  
 
;[http://subversion.tigris.org/ Subversion]
 
;[http://subversion.tigris.org/ Subversion]
;[http://git.or.cz/ Git]
+
;[http://git.or.cz/ Git] (optional, but recommended)
 
;[http://www.cmake.org CMake] (>=2.4.7)
 
;[http://www.cmake.org CMake] (>=2.4.7)
 
;[http://trolltech.com/products/qt Qt4] (>=4.4.0)
 
;[http://trolltech.com/products/qt Qt4] (>=4.4.0)
;[[#Installing Eigen|Eigen]] (>=2.0_beta3)
+
;[http://eigen.tuxfamily.org/ Eigen2]] (>=2.0_beta3) (more instructions [[#Installing Eigen|below]])
;[[#Building OpenBabel|OpenBabel]] (>=2.2.0)
+
;[http://openbabel.org/ OpenBabel] (>=2.2.0) (more instructions [[#Building OpenBabel|below]])
  
It is likely that Subversion, Git, CMake and Qt4 will be available from your distribution's repositories, or in binary form on the Mac.
+
For  optional Python console/bindings:
 +
;[http://www.riverbankcomputing.co.uk/software/pyqt/download PyQt4]
 +
;[http://www.riverbankcomputing.co.uk/software/sip/download SIP]
 +
;[http://www.boost.org/users/download/ Boost]
  
{| align="left" style="border-spacing:8px;margin:0px -8px"
+
For optional OpenGL shader support:
|-
+
;[http://glew.sourceforge.net/ GLEW]
|width="50%" class="MainPageBG" style="border: 1px solid #FFC435; background-color: #f8fff8; vertical-align:top;"|
 
<h3 style="background:#FFC435;margin:-2px;padding:4px;"> ''How should I install Avogadro?'' </h3>
 
<div style="padding: 2px 10px 6px;">
 
'''There are two different ways to install Avogadro, depending on your needs and your user privileges.'''
 
 
 
If you have superuser rights and want to provide Avogadro for all users on your computer, choose '''[[#Method A: Install Avogadro for all users|Method A]] to install Avogadro globally''' (to /usr/local).<br/>
 
If you don't have superuser rights or you don't want to install files to locations outside your home directory or you're the only user of Avogadro, choose '''[[#Method B: Install Avogadro to your home diretory|Method B]] to install Avogadro into your home directory'''.
 
</div>
 
|}
 
 
 
== Method A: Install Avogadro for all users ==
 
 
 
=== Installing Eigen ===
 
  
 +
== Installing Eigen2 ==
 +
Obtain the [http://eigen.tuxfamily.org/index.php?title=Main_Page#Download Eigen2 source] and enter the eigen2 source directory. Then build using:
 
<code><pre>
 
<code><pre>
svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen2
 
cd eigen2
 
 
mkdir build
 
mkdir build
 
cd build
 
cd build
Line 41: Line 32:
 
</pre></code>
 
</pre></code>
  
=== Building OpenBabel ===
+
'''Note:''' If you are either unable or do not want to install Eigen globally you can install in your home directly using:
Avogadro makes heavy use of code and features from the [http://openbabel.org OpenBabel] chemistry toolbox. To ensure you have the latest OpenBabel code you should build it from the code repository. It is sufficient to use OpenBabel 2.2.0 or more recent:
+
 
 +
<code><pre>
 +
cd $HOME/src
 +
svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen2 eigen2
 +
cd eigen2
 +
mkdir $HOME/build/eigen2
 +
cd $HOME/build/eigen2
 +
cmake $HOME/src/eigen2
 +
make
 +
</pre></code>
 +
 
 +
== Building OpenBabel ==
 +
Avogadro makes heavy use of code and features from the [http://openbabel.org OpenBabel] chemistry toolbox. Avogadro needs OpenBabel 2.2.0 or more recent. If your distribution does not have a sufficiently recent version you may obtain it by:
  
 
<code><pre>
 
<code><pre>
 
svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/branches/openbabel-2-2-x openbabel-2.2
 
svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/branches/openbabel-2-2-x openbabel-2.2
cd openbabel
+
</pre></code>
 +
 
 +
Once you have the source code you can build it using:
 +
<code><pre>
 
./configure  
 
./configure  
 
make
 
make
Line 52: Line 58:
 
</pre></code>
 
</pre></code>
  
=== Building Avogadro ===
+
'''Note:''' If you are either unable or do not want to install OpenBabel globally you can install in your home directly using:
 +
 
 +
<code><pre>
 +
cd $HOME/src
 +
svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/branches/openbabel-2-2-x openbabel-2.2
 +
cd openbabel-2.2
 +
./configure
 +
make -j3
 +
</pre></code>
 +
 
 +
== Building Avogadro ==
  
 
Avogadro's version control system is now Git, with hosting provided by GitHub. If you would rather not install Git it is possible to download a tar or zip file containing the latest sources from [http://github.com/cryos/avogadro/ here] by clicking on the download link. Generally you will want to clone the git repository,
 
Avogadro's version control system is now Git, with hosting provided by GitHub. If you would rather not install Git it is possible to download a tar or zip file containing the latest sources from [http://github.com/cryos/avogadro/ here] by clicking on the download link. Generally you will want to clone the git repository,
Line 66: Line 82:
 
</pre></code>
 
</pre></code>
  
=== Running ===
+
'''Note:'''If you are either unable or do not want to install Avogadro globally you can install in your home directory using the following instructions. The instructions assume you have built Eigen and OpenBabel in your home directory.
  
<code><pre>avogadro</pre></code>
+
'''Setting up the environment'''
On Mac OS X Avogadro will be in your Applications folder.
 
 
 
== Method B: Install Avogadro into your home diretory ==
 
 
 
These steps are designed to allow you build Avogadro without having to install ('make install') the dependencies. For the purposes of this example we check out all entries to <nowiki>$HOME/src</nowiki>.
 
 
 
=== Setting up the Environment ===
 
  
 
If you set these environment variables Avogadro and OpenBabel will use special directories for runtime plugin loading. Avogadro will search the subdirectories colors, engines, extensions and tools for suitable plugins. The environment variables can point to multiple directories separated by colons, i.e. "$HOME/.avogadro/plugins:/usr/local/lib/avogadro". All of them are optional, if they are installed then there is no need to set any environment variables.
 
If you set these environment variables Avogadro and OpenBabel will use special directories for runtime plugin loading. Avogadro will search the subdirectories colors, engines, extensions and tools for suitable plugins. The environment variables can point to multiple directories separated by colons, i.e. "$HOME/.avogadro/plugins:/usr/local/lib/avogadro". All of them are optional, if they are installed then there is no need to set any environment variables.
Line 83: Line 92:
 
export BABEL_DATADIR=$HOME/src/openbabel/data                                                        #Openbabel Data Files</pre></code>
 
export BABEL_DATADIR=$HOME/src/openbabel/data                                                        #Openbabel Data Files</pre></code>
  
=== Installing Eigen ===
+
'''Building Avogadro'''
 
 
<code><pre>
 
cd $HOME/src
 
svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen2 eigen2
 
cd eigen2
 
mkdir $HOME/build/eigen2
 
cd $HOME/build/eigen2
 
cmake $HOME/src/eigen2
 
make -j3
 
</pre></code>
 
 
 
=== Building OpenBabel===
 
This will build the relatively stable 2.2 branch of OpenBabel and allow you to use OpenBabel from the build directory rather than having to install it.
 
<code><pre>
 
cd $HOME/src
 
svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/branches/openbabel-2-2-x openbabel-2.2
 
#svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/trunk openbabel
 
cd openbabel-2.2
 
./configure
 
make -j3
 
</pre></code>
 
 
 
=== Building Avogadro ===
 
 
 
 
<code><pre>
 
<code><pre>
 
cd $HOME/src
 
cd $HOME/src
Line 120: Line 105:
 
</pre></code>
 
</pre></code>
  
=== Running ===
+
== Running ==
 +
 
 +
<code><pre>avogadro</pre></code>
 +
On Mac OS X Avogadro will be in your Applications folder.
  
<code><pre>$HOME/svn/avogadro/build/avogadro/src/avogadro</pre></code>
+
'''Note:''' If you've built Avogadro using the directions in the previous section then run Avogadro using:
 +
<code><pre>$HOME/build/avogadro/build/avogadro/src/avogadro</pre></code>
  
 
[[Category:User]]
 
[[Category:User]]

Revision as of 17:30, 26 December 2008

These instructions are intended to help users build Avogadro from the latest code. Be aware that Avogadro may fail to build or work properly at any given time when built using the instructions below.
For the adventurous, there are also Windows Visual Studio 2008 instructions that may or may not work.

Generally, users should first try the binary installers or packages available on the download page, made using a released version of Avogadro.


Dependencies

You should be able to find most of these dependencies in your distribution's repositories or as binary downloads for Mac from the homepages linked below. Make sure that you satisfy any version requirement given.

Subversion
Git (optional, but recommended)
CMake (>=2.4.7)
Qt4 (>=4.4.0)
Eigen2] (>=2.0_beta3) (more instructions below)
OpenBabel (>=2.2.0) (more instructions below)

For optional Python console/bindings:

PyQt4
SIP
Boost

For optional OpenGL shader support:

GLEW

Installing Eigen2

Obtain the Eigen2 source and enter the eigen2 source directory. Then build using:

mkdir build
cd build
cmake ..
make install # must be run as root or with sudo

Note: If you are either unable or do not want to install Eigen globally you can install in your home directly using:

cd $HOME/src
svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen2 eigen2
cd eigen2
mkdir $HOME/build/eigen2
cd $HOME/build/eigen2
cmake $HOME/src/eigen2
make

Building OpenBabel

Avogadro makes heavy use of code and features from the OpenBabel chemistry toolbox. Avogadro needs OpenBabel 2.2.0 or more recent. If your distribution does not have a sufficiently recent version you may obtain it by:

svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/branches/openbabel-2-2-x openbabel-2.2

Once you have the source code you can build it using:

./configure 
make
make install # must be run as root or with sudo

Note: If you are either unable or do not want to install OpenBabel globally you can install in your home directly using:

cd $HOME/src
svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/branches/openbabel-2-2-x openbabel-2.2
cd openbabel-2.2
./configure 
make -j3

Building Avogadro

Avogadro's version control system is now Git, with hosting provided by GitHub. If you would rather not install Git it is possible to download a tar or zip file containing the latest sources from here by clicking on the download link. Generally you will want to clone the git repository,

git clone git://github.com/cryos/avogadro.git
cd avogadro
mkdir build
cd build
cmake ..
make -j3
make install # must be run as root or with sudo

Note:If you are either unable or do not want to install Avogadro globally you can install in your home directory using the following instructions. The instructions assume you have built Eigen and OpenBabel in your home directory.

Setting up the environment

If you set these environment variables Avogadro and OpenBabel will use special directories for runtime plugin loading. Avogadro will search the subdirectories colors, engines, extensions and tools for suitable plugins. The environment variables can point to multiple directories separated by colons, i.e. "$HOME/.avogadro/plugins:/usr/local/lib/avogadro". All of them are optional, if they are installed then there is no need to set any environment variables.

export AVOGADRO_PLUGINS=$HOME/build/avogadro/libavogadro/src                                         #Avogadro Plugins
export BABEL_LIBDIR=$HOME/src/openbabel/src/formats/.libs:$HOME/src/openbabel/src/formats/xml/.libs  #Openbabel Formats
export BABEL_DATADIR=$HOME/src/openbabel/data                                                        #Openbabel Data Files

Building Avogadro

cd $HOME/src
git clone git://github.com/cryos/avogadro.git
mkdir $HOME/build/avogadro
cd $HOME/build/avogadro
cmake \
-DOPENBABEL2_INCLUDE_DIR=$HOME/src/openbabel-2.2/include \
-DOPENBABEL2_LIBRARIES=$HOME/src/openbabel-2.2/src/.libs/libopenbabel.so \
-DOPENBABEL2_VERSION_MET=true $HOME/src/avogadro
make -j3

Running

avogadro

On Mac OS X Avogadro will be in your Applications folder.

Note: If you've built Avogadro using the directions in the previous section then run Avogadro using:

$HOME/build/avogadro/build/avogadro/src/avogadro