Skip to content

Compiling Installing

Vicente Adolfo Bolea Sanchez edited this page Nov 16, 2017 · 1 revision

COMPILING & INSTALLING

Dependencies

  • autoconf, automake and libtool up to dated to a recent version.
  • C++ Boost library (>= 1.56), check [Boost download site] [boost].
  • GNUcompiler (>= 4.4)
  • Ruby interpreter (>= 2.2.0), check [Ruby version Manager] [rvm].

How to compile the project

You will want to have an independent different folder for Autotools to place all the temporary files (objects files) so that the repository folder does not get full of useless files (Making hard using git).

$ mkdir -p local_eclipse/{tmp,sandbox}                 # Create a sandbox directories
$ cd local_eclipse                                     # enter in the directory
$ git clone [email protected]:DICL/VeloxDFS.git           # Clone the project from github
$ sh autogen.sh                                        # Generate configure script 
$ cd ../tmp                                            # Go to building folder
$ sh ../VeloxDFS/configure --prefix=`pwd`/../sandbox   # Generate Makefile

In case that boost library is in a non standard place

$ sh ../VeloxDFS/configure --prefix=`pwd`/../sandbox --with-boost=/pathtoboostheaders  # Generate Makefile

Lastly,

### This last command will be needed whenever you want to recompile the source
$ make [-j#] install                                   # Compile & install add -j flag to speed up

Now edit in your ~/.bashrc or ~/.profile:

export PATH="/home/*..PATH/To/eclipse/..*/sandbox/bin":$PATH
export LIBRARY_PATH="/home/*..PATH/To/eclipse/..*/sandbox/lib"
export C_INCLUDE_PATH="/home/*..PATH/To/eclipse/..*/sandbox/include"

Configure custom flags

Our configure script supports the following flags:

  • --with-boost=PATH, location of boost library, if boost is in /usr/local/lib it will be in /usr/local.
  • --disable-samples, does not copy reference .eclipse.json.
  • --enable-lblocks, enable support for logical blocks.
  • CXX CXXFLAGS, add custom compiler/compiler flags.

GNU/Autotools 101

What's the deal with Autotools and why are we using it

When it comes to C++ we do not have much of a choice for Building Systems. How can we make our Project compatible with other computers (Lets think only within Linux). VeloxDFS depends on Boost ASIO, UnitTest++, and C++14.

How can you check that the computer you are installing it contains those libraries? Or, if the libraries are in a different location how can you find them?.

Regular Makefiles are not enough since while it let you do some complex things, you will endup with a giant Makefile that would be harder to maintain the the source code itself.

GNU/Autotools creates this crazy big and complex Makefile for you, only calling the following standard commands that all the Linux community is familiar with:

$ ./configure "many options here"  # Generate Makefile
$ ./make
$ sudo make install

It will compile and install the software in your computer. It will also deal with many differences between plataforms.

Learning GNU/Autotools is hard and boring, but if you will use Linux for some years, it worth learn it.

How is VeloxDFS using Autotools

VeloxDFS is using Autotools by the files configure.ac, Makefile.am, and lesser important autogen.sh.

  • configure.ac is where we set important variables for our project like should we include this code? Should I install the system in this location.... It is a template for the final configure script.

  • Makefile.am is a template for the final Makefile (Huge and complex). Normally this Makefile.am is rather small and simple compared to the output Makefile.

  • autogen.sh generates the configure script from configure.ac

Here is a diagram which explain the workflow of creating the Makefile:

  +-------------+               +-------------+
  | configure.ac+---------------> configure   +-----+
  +-------------+  ./autogen.sh +-------------+     |
                                                    |      +-------------+
                                                    +----->+ Makefile    |
                                                    |      +-------------+
                                +-------------+     |
                                | Makefile.am +-----+
                                +-------------+