Menu

InstallationFromSource

James Edmondson

Introduction

Most users do not need to compile and install MADARA from source. This option is only intended for those users who would like to develop MADARA, create their own transports for MADARA, or potentially work on ACE. Any user who simply wants to use the MADARA libraries should use the Installing MADARA from binaries.

The resulting libraries of all build processes can be found in $MADARA_ROOT/lib. Executables are placed in $MADARA_ROOT/bin.


Prerequisites

You will need Perl, SVN, Git and a C++ compiler and linker. For Debian Linux, you can obtain these by typing something like "sudo apt-get install perl svn build-essentials". For other Linux-like operating systems, use the appropriate package manager.

For Windows, you will need ActivePerl for running perl scripts and you will need to install Tortoise SVN and TortoiseGit to download the ACE and MADARA code repositories.

If you only want to build MADARA from source and not ACE, feel free to download the pre-built ACE binaries for Linux or Windows from the Installing MADARA from binaries. You will need to focus on setting up the ACE_ROOT environment variables and extracting the compiled files from the archive files (.zip and .tar.gz, as appropriate to your target architecture), as is explained on that page.


MADARA Baseline

Doing the following will install MADARA with just the best effort IP multicast and broadcast transports. Here's the complete step-by-step:

MADARA Baseline for Linux

Copy and paste the following into a terminal. You can move the export statements into your .bashrc file and type ". ~/.bashrc" to reload the file, if you like. This assumes 4 cores. If you have less or more than this, you can change the CORES variable accordingly. All it's basically doing is causing make to create $CORES jobs to run the build process in parallel (which will be faster on multiple cores). Also, this will install everything in the $HOME directory. If you would like to install somewhere else, change all instances of $HOME to a variable that represents your target directory.

export ACE_ROOT=$HOME/ace/ACE_wrappers
export MADARA_ROOT=$HOME/madara
export LD_LIBRARY_PATH=$ACE_ROOT/lib:$MADARA_ROOT/lib:$LD_LIBRARY_PATH
export PATH=$ACE_ROOT/bin:$MADARA_ROOT/bin:$PATH

export CORES=4

#Make the ace and madara directories in $HOME

mkdir $HOME/ace $HOME/madara

#ACE

svn co svn://svn.dre.vanderbilt.edu/DOC/Middleware/sets-anon/ACE $HOME/ace        
cd $ACE_ROOT/ace
echo "#include \"ace/config-linux.h\"" > config.h
cd $ACE_ROOT/include/makeinclude
echo "include \$(ACE_ROOT)/include/makeinclude/platform_linux.GNU" > platform_macros.GNU
cd $ACE_ROOT/ace
perl $ACE_ROOT/bin/mwc.pl -type gnuace ace.mwc
make -j $CORES

#MADARA

git clone git://git.code.sf.net/p/madara/code $HOME/madara
cd $MADARA_ROOT
perl $ACE_ROOT/bin/mwc.pl -type gnuace MADARA.mwc
make tests=1 -j $CORES

MADARA Baseline for ARM Linux

Compiling MADARA for any architecture is the same as compiling ACE for any architecture. The main change from the above is that you will need to download an ARM toolchain that is appropriate for the target architecture. An example location to obtain a generic ARM gcc toolchain is from http://www.gnuarm.com (you would have to build gcc from here), or you could use the guide from the Chumby Wiki (http://wiki.chumby.com/index.php?title=GNU_Toolchain). For Parrot AR.Drone 2.0 toolchains, you will probably have to download a different ARM toolchain like the one from Sourcery CodeBench (http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/, requires site registration). Which toolchain you need will depend on the architecture you are compiling for.

PREPPING THE INSTALL

Once you obtain the ARM toolchain and extract it to a location, it is our recommendation that you update your path to include the bin directory where the g++/gcc binaries are for the toolchain. In the following we refer to that location as $ARM_BIN when setting to the PATH variable in line 6 in the Copy-and-Paste with ARM_BIN and PREFIX defined section.

The second key aspect of cross compilation for MADARA is that you will need to note the prefix for the build tools. Inside of the bin directory for Mentor Graphic's ARM toolchain, for instance, you will find a list of dozens of executables that look like this (assuming you've exported the ARM_BIN variable in your .bashrc or in some other way to define the ARM_BIN variable:

$> ls $ARM_BIN
...
arm-non-linux-gnueabi-g++
arm-non-linux-gnueabe-gcc
...

The prefix in the above directory is "arm-non-linux-gnueabi-". It's everything that comes before gcc and g++ in that directory listing. So, here's the two pieces of information that are different from Linux on your system to Linux for ARM that you'll need to understand about building MADARA for the ARM platform:

  • ARM_BIN: where the binaries are for the toolchain you've downloaded
  • LOCAL_CROSS_PREFIX: the prefix that goes in front of g++ and gcc in ARM_BIN listings

Copy-and-Paste with ARM_BIN and LOCAL_CROSS_PREFIX defined

export ACE_ROOT=$HOME/ace/ACE_wrappers
export MADARA_ROOT=$HOME/madara
export LD_LIBRARY_PATH=$ACE_ROOT/lib:$MADARA_ROOT/lib:$LD_LIBRARY_PATH
export PATH=$ACE_ROOT/bin:$MADARA_ROOT/bin:$PATH
export PATH=$ARM_BIN:$PATH

export CORES=4

#Make the ace and madara directories in $HOME

mkdir $HOME/ace $HOME/madara

#ACE

svn co svn://svn.dre.vanderbilt.edu/DOC/Middleware/sets-anon/ACE $HOME/ace
cd $ACE_ROOT/ace
echo "#include \"ace/config-linux.h\"" > config.h
cd $ACE_ROOT/include/makeinclude
echo -e "ARM=1\nCROSS_COMPILE=\$(LOCAL_CROSS_PREFIX)\ninclude \$(ACE_ROOT)/include/makeinclude/platform_linux.GNU" > platform_macros.GNU
cd $ACE_ROOT/ace
perl $ACE_ROOT/bin/mwc.pl -type gnuace ace.mwc
make -j $CORES

#MADARA

git clone git://git.code.sf.net/p/madara/code $HOME/madara
cd $MADARA_ROOT
perl $ACE_ROOT/bin/mwc.pl -type gnuace MADARA.mwc
make tests=1 -j $CORES

MADARA Baseline for Android Linux

PREPPING THE INSTALL

You will need to build the Android NDK (http://developer.android.com/tools/sdk/ndk/index.html) to compile MADARA for Android.

First, Set the NDK environment variable to the root directory of your NDK. Next, build the NDK toolchain, which should produce a cross compile prefix that begins with arm-linux-androideabi. Add the bin directory that includes the "arm-linux-androideabi" binaries to your path. We'll call this NDK_BIN for convenience.

If you are confused, try following the ACE-INSTALL.html instructions for Android. You will need to build the standalone toolchain and then point NDK_BIN to the place you just built the standalone toolchain to. Essentially, we will want to be able to reference the results of the build on the command line (adding this NDK_BIN directory to PATH)

Copy-and-Paste with NDK and NDK_BIN defined

export ACE_ROOT=$HOME/ace/ACE_wrappers
export MADARA_ROOT=$HOME/madara
export LD_LIBRARY_PATH=$ACE_ROOT/lib:$MADARA_ROOT/lib:$LD_LIBRARY_PATH
export PATH=$ACE_ROOT/bin:$MADARA_ROOT/bin:$PATH
export PATH=$NDK_BIN:$PATH

export CORES=4

#Make the ace and madara directories in $HOME

mkdir $HOME/ace $HOME/madara

#ACE

svn co svn://svn.dre.vanderbilt.edu/DOC/Middleware/sets-anon/ACE $HOME/ace
cd $ACE_ROOT/ace
echo "#include \"ace/config-android.h\"" > config.h
cd $ACE_ROOT/include/makeinclude
echo -e "versioned_so=0\nstatic_libs_only=0\ninclude \$(ACE_ROOT)/include/makeinclude/platform_android.GNU" > platform_macros.GNU
cd $ACE_ROOT/ace
perl $ACE_ROOT/bin/mwc.pl -type gnuace ace.mwc
make -j $CORES

#MADARA

git clone git://git.code.sf.net/p/madara/code $HOME/madara
cd $MADARA_ROOT
perl $ACE_ROOT/bin/mwc.pl -type gnuace -features java=1,android=1,tests=0 MADARA.mwc
make tests=0 java=1 android=1 -j $CORES

MADARA Baseline for Windows

The installation now defaults to not include DDS. If you want to include DDS, you'll need to edit the default.features file inside of %MADARA_ROOT% and enable the opensplice, ndds or kats features. However, installation on Windows looks something like this:

Set your environment variables to:

PROJECTS_DIR=C:
MADARA_ROOT=%PROJECTS_DIR%\madara\code
ACE_ROOT=%PROJECTS_DIR%\ace
PATH=%ACE_ROOT%\lib;%ACE_ROOT%\bin;%MADARA_ROOT%\lib;%MADARA_ROOT%\bin

Setting environment variables in Windows is done by going to your Start menu, right clicking Computer, then clicking Properties, clicking Advanced System Systems, and then Environment Variables. See the following image for an example of setting the above variables.

Setting environment variables

Now, we're going to install MADARA from source. Create a new directory in %PROJECTS_ROOT% called "madara" (C:\madara, if %PROJECTS_ROOT% is set to C:). If using Tortoise Git on Windows, you will want to right click on C:\madara, select Git Clone and put git://git.code.sf.net/p/madara/code into the appropriate input location. If you're using cygwin, you'll get into a terminal and type "git clone git://git.code.sf.net/p/madara/code \madara".

Now, open a terminal ("cmd" at the run prompt in your start menu) and type:

cd %ACE_ROOT%\ace
echo "#include \"ace/config-win32.h\"" > config.h
%ACE_ROOT%\bin\mwc.pl -type vc12 ace.mwc

cd %MADARA_ROOT%
mwc.pl -type vc12 MADARA.mwc

Open the ACE.sln file inside of %ACE_ROOT%\ace and hit build in Visual Studio. Once finished, ACE will be installed. Then open the MADARA.sln file inside of C:\madara and hit build in Visual Studio. Once finished, Madara will be installed.


MADARA with ZeroMQ

MADARA includes support for ZeroMQ for reliable transports using TCP, multicast, interprocess, etc.

Doing the following will install MADARA with reliable ZeroMQ.

MADARA with ZeroMQ for Linux

Copy and paste the following into a terminal. You can move the export statements into your .bashrc file and type ". ~/.bashrc" to reload the file, if you like. This assumes 4 cores. If you have less or more than this, you can change the CORES variable accordingly. All it's basically doing is causing make to create $CORES jobs to run the build process in parallel (which will be faster on multiple cores).

export ZMQ_ROOT=/usr/local
export ACE_ROOT=$HOME/ace/ACE_wrappers
export MADARA_ROOT=$HOME/madara
export LD_LIBRARY_PATH=$ACE_ROOT/lib:$MADARA_ROOT/lib:$ZMQ_ROOT/lib:$LD_LIBRARY_PATH
export PATH=$ACE_ROOT/bin:$MADARA_ROOT/bin:$PATH

export CORES=4

#Make the ace and madara directories in $HOME

mkdir $HOME/ace $HOME/madara

#ACE

svn co svn://svn.dre.vanderbilt.edu/DOC/Middleware/sets-anon/ACE $HOME/ace
cd $ACE_ROOT/ace
echo "#include \"ace/config-linux.h\"" > config.h
cd $ACE_ROOT/include/makeinclude
echo "include \$(ACE_ROOT)/include/makeinclude/platform_linux.GNU" > platform_macros.GNU
cd $ACE_ROOT/ace
perl $ACE_ROOT/bin/mwc.pl -type gnuace ace.mwc
make -j $CORES

#ZeroMQ

sudo apt-get update
sudo apt-get install
sudo apt-get install git libtool pkg-config build-essential autoconf automake uuid-dev

git clone https://github.com/zeromq/libzmq
cd libzmq
./autogen.sh && ./configure && make -j 4
make check && sudo make install && sudo ldconfig

#MADARA

git clone git://git.code.sf.net/p/madara/code $HOME/madara
cd $MADARA_ROOT
perl $ACE_ROOT/bin/mwc.pl -type gnuace -features zmq=1 MADARA.mwc
make tests=1 zmq=1 -j $CORES

MADARA with ZeroMQ for Windows

To install MADARA with ZeroMQ, you'll have to download ZeroMQ separately. However, installation on Windows looks something like this (assuming you install ZeroMQ to C:\zeromq:

Set your environment variables to:

PROJECTS_DIR=C:
MADARA_ROOT=%PROJECTS_DIR%\madara\code
ACE_ROOT=%PROJECTS_DIR%\ace
ZMQ_ROOT=C:\zeromq
PATH=%ACE_ROOT%\lib;%ACE_ROOT%\bin;%MADARA_ROOT%\lib;%MADARA_ROOT%\bin;%ZMQ_ROOT%\lib

Setting environment variables in Windows is done by going to your Start menu, right clicking Computer, then clicking Properties, clicking Advanced System Systems, and then Environment Variables.

cd %ZMQ_ROOT%
cd builds\msvc\vs2013
libzmq.sln

Build the ZMQ project with the settings you will be using. We recommend setting the project to Release and x64 output targets.

mkdir %ZMQ_ROOT%\lib

::if you have compiled for Release x64 output
cp %ZMQ_ROOT%\bin\x64\Release\v120\dynamic\libzmq.dll %ZMQ_ROOT%\lib\zmq.dll
cp %ZMQ_ROOT%\bin\x64\Release\v120\dynamic\libzmq.lib %ZMQ_ROOT%\lib\zmq.lib

::if you have compiled for Debug x64 output
cp %ZMQ_ROOT%\bin\x64\Debug\v120\dynamic\libzmq.dll %ZMQ_ROOT%\lib\zmqd.dll
cp %ZMQ_ROOT%\bin\x64\Debug\v120\dynamic\libzmq.lib %ZMQ_ROOT%\lib\zmqd.lib
cp %ZMQ_ROOT%\bin\x64\Debug\v120\dynamic\libzmq.pdb %ZMQ_ROOT%\lib\libzmq.pdb

::you can compile for both in Visual Studio

Now, we're going to install MADARA from source. Create a new directory in %PROJECTS_ROOT% called "madara" (C:\madara, if %PROJECTS_ROOT% is set to C:). If using Tortoise Git on Windows, you will want to right click on C:\madara, select Git Clone and put git://git.code.sf.net/p/madara/code into the appropriate input location. If you're using cygwin, you'll get into a terminal and type "git clone git://git.code.sf.net/p/madara/code /madara".

Now, open a terminal ("cmd" at the run prompt in your start menu) and type:

cd %ACE_ROOT%\ace
echo "#include \"ace/config-win32.h\"" > config.h
%ACE_ROOT%\bin\mwc.pl -type vc12 ace.mwc

cd %MADARA_ROOT%
mwc.pl -type vc12 -features zmq=1 MADARA.mwc

Open the ACE.sln file inside of %ACE_ROOT%\ace and hit build in Visual Studio. Be sure to select settings that you had used in the ZeroMQ installation (e.g., Release and x64 targets). Once finished, ACE will be installed. Then open the MADARA.sln file inside of C:\madara and hit build in Visual Studio. Once finished, Madara will be installed


MADARA with Open Splice DDS

MADARA includes support for multiple vendors of the OMG DDS standard, including PrismTech's open sourced version (which we have a sample download of here in the Downloads section) and also RTI's DDS option.

Doing the following will install MADARA with reliable PrismTech DDS and best effort IP multicast and broadcast transports. Here's the complete step-by-step:

MADARA with Open Splice DDS for Linux

Copy and paste the following into a terminal. You can move the export statements into your .bashrc file and type ". ~/.bashrc" to reload the file, if you like. This assumes 4 cores. If you have less or more than this, you can change the CORES variable accordingly. All it's basically doing is causing make to create $CORES jobs to run the build process in parallel (which will be faster on multiple cores).

export ACE_ROOT=$HOME/ace/ACE_wrappers
export MADARA_ROOT=$HOME/madara
export LD_LIBRARY_PATH=$ACE_ROOT/lib:$MADARA_ROOT/lib:$LD_LIBRARY_PATH
export PATH=$ACE_ROOT/bin:$MADARA_ROOT/bin:$PATH

export CORES=4

#Make the ace and madara directories in $HOME

mkdir $HOME/ace $HOME/madara

#ACE

svn co svn://svn.dre.vanderbilt.edu/DOC/Middleware/sets-anon/ACE $HOME/ace
cd $ACE_ROOT/ace
echo "#include \"ace/config-linux.h\"" > config.h
cd $ACE_ROOT/include/makeinclude
echo "include \$(ACE_ROOT)/include/makeinclude/platform_linux.GNU" > platform_macros.GNU
cd $ACE_ROOT/ace
perl $ACE_ROOT/bin/mwc.pl -type gnuace ace.mwc
make -j $CORES

#Open Splice

export OSPL_HOME=$HOME/splice/HDE/x86.linux2.6
export OSPL_TARGET=x86.linux2.6
export OSPL_TMPL_PATH=$OSPL_HOME/etc/idlpp
export OSPL_URI=file://$OSPL_HOME/etc/config/ospl.xml

export LD_LIBRARY_PATH=$OSPL_HOME/lib:$LD_LIBRARY_PATH
export PATH=$OSPL_HOME/bin:$PATH

cd $HOME
mkdir $HOME/splice
wget http://madara.googlecode.com/files/OpenSpliceDDSV5.4.1-x86_64.linux2.6-gcc412-gnuc25-HDE.tar.gz
tar xvf OpenSpliceDDSV5.4.1-x86_64.linux2.6-gcc412-gnuc25-HDE.tar.gz -C $HOME/splice

#MADARA

git clone git://git.code.sf.net/p/madara/code $HOME/madara
cd $MADARA_ROOT
perl $ACE_ROOT/bin/mwc.pl -type gnuace -features opensplice=1 MADARA.mwc
make tests=1 opensplice=1 -j $CORES

If you are interested in also compiling in RTI DDS support, you will need to first ensure that you have the libraries downloaded and installed correctly (NOTE: We do not provide these libraries and you would need to check the RTI webpage for more information on how to download/acquire/license this software). Then type the following 3 lines instead of the last three lines of the above section:

cd $MADARA_ROOT
perl $ACE_ROOT/bin/mwc.pl -type gnuace -features opensplice=1,ndds=1 MADARA.mwc
make tests=1 cid=1 opensplice=1 ndds=1 -j $CORES

MADARA with Open Splice DDS for Windows

The installation now defaults to not include DDS. If you want to include DDS, you'll need to enable the opensplice, ndds or kats features (which we'll show later on the command line. However, installation on Windows looks something like this (assuming you install Open Splice DDS to C:\splice:

Set your environment variables to:

PROJECTS_DIR=C:
MADARA_ROOT=%PROJECTS_DIR%\madara\code
ACE_ROOT=%PROJECTS_DIR%\ace
OSPL_HOME=C:\splice\HDE\x86.win32
OSPL_TARGET=x86.win32
OSPL_TMPL_PATH=\splice\HDE\x86.win32\etc\idlpp
OSPL_URI=file:///splice/HDE/x86.win32/etc/config/ospl.xml
PATH=%ACE_ROOT%\lib;%ACE_ROOT%\bin;%MADARA_ROOT%\lib;%MADARA_ROOT%\bin;%OSPL_HOME%\lib;%OSPL_HOME%\bin

Setting environment variables in Windows is done by going to your Start menu, right clicking Computer, then clicking Properties, clicking Advanced System Systems, and then Environment Variables. See the following image for an example of setting the above variables.

Setting environment variables

Now, we're going to install MADARA from source. Create a new directory in %PROJECTS_ROOT% called "madara" (C:\madara, if %PROJECTS_ROOT% is set to C:). If using Tortoise Git on Windows, you will want to right click on C:\madara, select Git Clone and put git://git.code.sf.net/p/madara/code into the appropriate input location. If you're using cygwin, you'll get into a terminal and type "git clone git://git.code.sf.net/p/madara/code /madara".

Now, open a terminal ("cmd" at the run prompt in your start menu) and type:

cd %ACE_ROOT%\ace
echo "#include \"ace/config-win32.h\"" > config.h
%ACE_ROOT%\bin\mwc.pl -type vc12 ace.mwc

cd %MADARA_ROOT%
mwc.pl -type vc12 -features opensplice=1 MADARA.mwc

Open the ACE.sln file inside of %ACE_ROOT%\ace and hit build in Visual Studio. Once finished, ACE will be installed. Then open the MADARA.sln file inside of C:\madara and hit build in Visual Studio. Once finished, Madara will be installed.


MADARA with Java

Doing the following will install MADARA for use with Java. Here's the complete step-by-step:

MADARA with Java for Linux

You should use the Oracle JDK for version 8. For Ubuntu, here are the instructions:
http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

Copy and paste the following into a terminal. You can move the export statements into your .bashrc file and type ". ~/.bashrc" to reload the file, if you like. This assumes 4 cores. If you have less or more than this, you can change the CORES variable accordingly. All it's basically doing is causing make to create $CORES jobs to run the build process in parallel (which will be faster on multiple cores). Also, this will install everything in the $HOME directory. If you would like to install somewhere else, change all instances of $HOME to a variable that represents your target directory. Be careful to specify the correct location of your Java Development Kit (JDK) installation. After installation of the Madara library, you must add $MADARA_ROOT/port/java/lib/MadaraJNI.jar to your java project's build path

export ACE_ROOT=~/ace/ACE_wrappers
export MADARA_ROOT=~/madara

#JAVA_HOME will change depending on your system, make sure to set the correct value
export JAVA_HOME=/usr/lib/jvm/java-8-oracle

export LD_LIBRARY_PATH=$ACE_ROOT/lib:$MADARA_ROOT/lib:$LD_LIBRARY_PATH
export PATH=$ACE_ROOT/bin:$MADARA_ROOT/bin:$PATH

#Make the ace and madara directories in $HOME
cd ~

#ACE

svn co svn://svn.dre.vanderbilt.edu/DOC/Middleware/sets-anon/ACE ace
cd $ACE_ROOT/ace
echo "#include \"ace/config-linux.h\"" > config.h
cd $ACE_ROOT/include/makeinclude
echo "include \$(ACE_ROOT)/include/makeinclude/platform_linux.GNU" > platform_macros.GNU
cd $ACE_ROOT/ace
$ACE_ROOT/bin/mwc.pl -type gnuace ace.mwc
make

#MADARA

git clone git://git.code.sf.net/p/madara/code madara
cd $MADARA_ROOT
$ACE_ROOT/bin/mwc.pl -type gnuace -features java=1 MADARA.mwc
make java=1

MADARA with Python

Doing the following will install MADARA for use with Python. Here's the complete step-by-step:

MADARA with Python for Linux

Install Python Dev, likely with a package manager (e.g. apt-get install python-dev). Install Boost from source (the Ubuntu package does not seem to work properly). We'd recommend inside of your home directory, inside of a "boost" folder. You can see how we reference this in the first couple of export statements

Execute the following in a new terminal (you can also copy all the exports to .bashrc or .profile or whatever your shell prefers to automatically load these variables--which is important for using the libraries).

# Please change PYTHON_VERSION and BOOST_VERSION if you are using a different version of either

export PYTHON_VERSION=33
export PYTHON_ROOT=/usr/bin/python
export BOOST_VERSION=1_55
export BOOST_ROOT=$HOME/boost/boost_${BOOST_VERSION}_0
export ACE_ROOT=$HOME/ace/ACE_wrappers
export MADARA_ROOT=$HOME/madara
export LD_LIBRARY_PATH=$ACE_ROOT/lib:$MADARA_ROOT/lib:$LD_LIBRARY_PATH
export PATH=$ACE_ROOT/bin:$MADARA_ROOT/bin:$PATH
export PYTHONPATH=$MADARA_ROOT/lib:$PYTHONPATH

export CORES=4

#Make the ace and madara directories in $HOME

mkdir $HOME/ace $HOME/madara

#ACE

svn co svn://svn.dre.vanderbilt.edu/DOC/Middleware/sets-anon/ACE $HOME/ace
cd $ACE_ROOT/ace
echo "#include \"ace/config-linux.h\"" > config.h
cd $ACE_ROOT/include/makeinclude
echo "include \$(ACE_ROOT)/include/makeinclude/platform_linux.GNU" > platform_macros.GNU
cd $ACE_ROOT/ace
perl $ACE_ROOT/bin/mwc.pl -type gnuace ace.mwc
make -j $CORES

#BOOST.PYTHON

cd $BOOST_ROOT
./bootstrap
./b2 --with-python link=shared threading=multi stage

#MADARA

git clone git://git.code.sf.net/p/madara/code $HOME/madara
cd $MADARA_ROOT
perl $ACE_ROOT/bin/mwc.pl -type gnuace -features python=1 MADARA.mwc
make tests=1 python=1 -j $CORES

MADARA with Python for Windows

Download Python. The version we are currently using is 3.3, but most recent versions should work. We would recommend putting Python in the C: root directory and not in Program Files to reduce your PATH variable length.
Download Boost. The version we are currently using is 1.5.5, but most recent versions should work. We would recommend putting Boost in the C: root directory and not in Program Files to reduce your PATH variable length.

Update the following environment variables

PYTHON_ROOT=The location of your Python install folder
PYTHON_VERSION=The major and minor version number (e.g. 33 for 3.3). PYTHON_VERSION is used to locate the python{PYTHON_VERSION).lib
PYTHONPATH+=%MADARA_ROOT%\lib. PYTHONPATH tells the Python interpreter where to look for additional modules. We need to add MADARA_ROOT\lib as this will be where our madara.pyd file will be located (though you can move it manually to another directory already in PYTHONPATH if you like).
BOOST_ROOT=The location of your Boost install folder
BOOST_VERSION=The version number (e.g. 1_55). BOOST_VERSION is used to locate the boost.python library
PATH=%BOOST_ROOT%;%PYTHON_ROOT%

Setup your user-config.jam file in your home directory

Note that we are setting up for Visual Studio 2012, but this also works for Visual Studio 2013 (in fact, don't change this as the underlying boost build system forces the naming of the boost python module to be named a very specific thing for Windows).

# MSVC configuration
using msvc : 12.0 ;
# Python configuration:
using python : 3.4 : C:\\Python34 : C:\\Python34\\include : C:\\Python34\\libs ;

Perform the following actions (in a new terminal with the BOOST_ROOT, PYTHON_ROOT, PYTHON_VERSION and BOOST_VERSION variables set

cd %BOOST_ROOT%
.\bootstrap
.\b2 --with-python link=static link=shared threading=multi address-model=64 stage

Setup MADARA normally (but change your mwc.pl to the following:

cd %MADARA_ROOT%
%ACE_ROOT%/bin/mwc.pl -type vc10 -features python=1 MADARA.mwc

Open the Visual Studio solution file named MADARA.sln in %MADARA_ROOT% and compile your project for Release mode. If you want debug mode, you will need to generate debug libraries in the Boost b2 step. Release mode will be the optimized library, so it's more recommended.

Do the following to rename the madara.pyd.dll file to madara.pyd

cd %MADARA_ROOT%\lib
ren madara.pyd.dll madara.pyd

Check the python interpreter to see if the madara module shows up

python
help ('modules')

Test the module

python
import madara
knowledge = madara.knowledge.KnowledgeBase ()
knowledge.print ()

MADARA with OpenSSL

Doing the following will install MADARA for use with OpenSSL encryption options. Here's the complete step-by-step:

MADARA with SSL for Windows

The installation defaults to not include SSL. If you want to include SSL, you'll need to compile OpenSSL for Windows (or find a distribution at https://www.openssl.org/related/binaries.html that includes /include and /lib folders).

Setting up OpenSSL

Feel free to either use a binary distribution or compile your own. Either is relatively easy to do.

OpenSSL Binary Distributions

If using a binary distribution, create the following folders (helps with following the later parts to use same directories we are):

# Copy the include directory to this location
%PROJECTS_DIR%\openssl\include

# Copy the .dll and/or .lib files to here
%PROJECTS_DIR%\openssl\libs

Make sure you download the appropriate architecture (e.g. 32 bit SSL or 64 bit SSL, depending on what you want to compile MADARA as).

Alternatively, you can do OpenSSL Source Compilation. Move on to "Set your environment variables" if you have already done the above Binary Distribution step.

OpenSSL Source Compilation

Download a source tarball from https://www.openssl.org/source/ and open it with 7zip or some other zip program that can handle .tar.gz. Extract the source to a directory (preferably %PROJECTS_DIR%\openssl, which should result in something like %PROJECTS_DIR%\openssl\openssl-1.0.2a).

Inside of the source tarball are a set of INSTALL files. We assume you want to build 64 bit SSL here (INSTALL.W64), but the 32 bit SSL instructions can be found in INSTALL.W32. The compilation system for OpenSSL uses the Visual Studio nmake program, which is only really usable via the Visual Studio Command Line Tools (usually accessible via the Start Menu). For instance, Visual Studio 2013 has the command line tool available at "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts" and is called "VS2013 x64 Cross Tools Command Prompt". Find the x64 Cross Tools Command Prompt on your system, and then do the following in a terminal window (cmd at Start->Run):

# change this change directory to be wherever the OpenSSL tar
cd %PROJECTS_DIR%\openssl\openssl-1.0.2a
perl Configure VC-WIN64A
ms\do_win64a
nmake -f ms\ntdll.mak

If you compiled everything correctly with no errors, you should see a inc32 and out32dll directory inside of your %PROJECTS_DIR%\openssl\openssl-1.0.2a directory (or wherever else you might have installed things to).

Set your environment variables to:

PROJECTS_DIR=C:
MADARA_ROOT=%PROJECTS_DIR%\madara\code
ACE_ROOT=%PROJECTS_DIR%\ace

# if SSL binaries, set this type of location (or wherever your include and lib dirs are that you create)
SSL_ROOT=%PROJECTS_DIR%\openssl

# if SSL compilation, try something like the following (this directory should have
# inc32 and out32dll directories inside of it)
SSL_ROOT=%PROJECTS_DIR%\openssl\openssl-1.0.2a

PATH=%ACE_ROOT%\lib;%ACE_ROOT%\bin;%MADARA_ROOT%\lib;%MADARA_ROOT%\bin;%SSL_ROOT%\out32dll;%SSL_ROOT%

Setting environment variables in Windows is done by going to your Start menu, right clicking Computer, then clicking Properties, clicking Advanced System Systems, and then Environment Variables. See the following image for an example of setting the above variables.

Setting environment variables

Now, we're going to install MADARA from source. Create a new directory in %PROJECTS_ROOT% called "madara" (C:\madara, if %PROJECTS_ROOT% is set to C:). If using Tortoise Git on Windows, you will want to right click on C:\madara, select Git Clone and put git://git.code.sf.net/p/madara/code into the appropriate input location. If you're using cygwin, you'll get into a terminal and type "git clone git://git.code.sf.net/p/madara/code \madara".

Now, open a terminal ("cmd" at the run prompt in your start menu) and type:

cd %ACE_ROOT%\ace
echo "#include \"ace/config-win32.h\"" > config.h
%ACE_ROOT%\bin\mwc.pl -type vc12 ace.mwc

cd %MADARA_ROOT%
mwc.pl -type vc12 -features ssl=1 MADARA.mwc

Open the ACE.sln file inside of %ACE_ROOT%\ace and hit build in Visual Studio. Once finished, ACE will be installed. Then open the MADARA.sln file inside of C:\madara and hit build in Visual Studio. Once finished, Madara will be installed.


Verifying the installation

Open two terminals.

Terminal 1

test_multicast -i 1

Terminal 2

test_multicast

If your firewall is configured correctly and MADARA has been installed properly, you should see:

Knowledge in Knowledge Base:
.id=1
.updates_required=<depends on order you call the tests>
var1=0
var2=1
var3=1
var4=0.666667

Updating an existing installation

Linux

cd $MADARA_ROOT
svn update
perl $ACE_ROOT/bin/mwc.pl -type gnuace -features <features you installed> MADARA.mwc
make tests=1 <features you installed> -j $CORES

"features you installed" can be any of the features you previously installed. For instance, "zmq=1" or "docs=1" for doxygen documentation. If you are not installing any extra features, simply remove the "-features " part of the perl command but keep in the MADARA.mwc.


Compiling a MADARA application

C++ Platform neutral

MADARA comes with a platform-neutral workspace generator called mpgen for Makefile Project Creator workspaces and projects. You can use this tool to create makefiles and Visual Studio solutions with the appropriate library paths, include paths, and libraries for new MADARA applications.

To print help and usage information, try -h, --help, or an invalid argument.

$MADARA_ROOT/bin/mpgen --help

To generate and compile a brand new MADARA project in the current directory with a sample Hello World application, you can do the following (Linux):

$MADARA_ROOT/bin/mpgen -c
perl $ACE_ROOT/bin/mwc.pl -type gnuace program.mwc
make

Windows with Visual Studio 2010 example:

$MADARA_ROOT/bin/mpgen -c
perl $ACE_ROOT/bin/mwc.pl -type vc10 program.mwc
<open your Visual Studio program.sln file in the directory and compile for 32 bit or 64 bit mode (whichever your ACE/MADARA library was compiled for)>

To generate a new project in the subdirectory "projects/hello_world", with a project name of "hello_world", try the following (Linux):

$MADARA_ROOT/bin/mpgen -c -o projects/hello_world -p hello_world
cd projects/hello_world
perl $ACE_ROOT/bin/mwc.pl -type vc10 hello_world.mwc
make

The mpgen will create any directories that are uncreated when specifying the -o option.

See the Linux section if you want to make your own custom makefiles or compile files individually, instead of using the platform-neutral process.


C++ Linux

To compile any examples in g++, you'll need to specify the following options (where "my_program" will be changed to whatever your application file name is).

g++ my_program.cpp -I$ACE_ROOT -I$MADARA_ROOT/include -L$ACE_ROOT/lib -L$MADARA_ROOT/lib -lMADARA -lACE -o my_program

This is easily automated via make or other programs. We internally use MPC, which is included in the $ACE_ROOT/bin directory, to produce make files, Visual Studio solutions, etc. from a single project file. However, MADARA will work with any build solution, including Ant, Cook, Maven, etc., though we do not directly support those build systems.


Related Articles


Related

Wiki: Home
Wiki: InstallationFromBinaries
Wiki: InteractingWithTheTransport

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.