Building from source¶
For downloading Tarantool source and building it, the platforms can differ and the preferences can differ. But the steps are always the same. Here in the manual we’ll explain what the steps are, and after that you can look at some example scripts on the Internet.
Get tools and libraries that will be necessary for building and testing.
The absolutely necessary ones are:
- A program for downloading source repositories.
For all platforms, this isgit
. It allows to download the latest complete set of source files from the Tarantool repository at GitHub. - A C/C++ compiler.
Ordinarily, this isgcc
andg++
version 4.6 or later. On Mac OS X, this isClang
version 3.2 or later. - A program for managing the build process.
For all platforms, this isCMake
. The CMake version should be 2.8 or later. - Command-line interpreter for Python-based code (namely, for Tarantool test
suite).
For all platforms, this ispython
. The Python version should be greater than 2.6 – preferably 2.7 – and less than 3.0.
Here are names of tools and libraries which may have to be installed in advance, using
sudo apt-get
(for Ubuntu),sudo yum install
(for CentOS), or the equivalent on other platforms. Different platforms may use slightly different names. Ignore the ones marked optional, only in Mac OS scripts unless the platform is Mac OS.- gcc and g++, or clang # see above
- git # see above
- cmake # see above
- python # see above; for test suite
- libreadline-dev or libreadline6-dev or readline-devel # for interactive mode
- libssl-dev # for digest module
- autoconf # optional, only in Mac OS scripts
- zlib1g or zlib # optional, only in Mac OS scripts
- A program for downloading source repositories.
Set up Python modules for running the test suite.
This step is optional. Python modules are not necessary for building Tarantool itself, unless you intend to use the «Run the test suite» option in step 7.
You need the following Python modules:
- pip, any version
- dev, any version
- pyYAML version 3.10
- argparse version 1.1
- msgpack-python version 0.4.6
- gevent version 1.1b5
- six version 1.8.0
On Ubuntu, you can get the modules from the repository:
sudo apt-get install python-pip python-dev python-yaml <...>
On CentOS 6, you can likewise get the modules from the repository:
sudo yum install python26 python26-PyYAML <...>
If some modules are not available on a repository, it is best to set up the modules by getting a tarball and doing the setup with
python setup.py
, thus:# On some machines, this initial command may be necessary: # wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python # Python module for parsing YAML (pyYAML), for test suite: # (If wget fails, check at http://pyyaml.org/wiki/PyYAML # what the current version is.) cd ~ wget http://pyyaml.org/download/pyyaml/PyYAML-3.10.tar.gz tar -xzf PyYAML-3.10.tar.gz cd PyYAML-3.10 sudo python setup.py install
Finally, use Python
pip
to bring in Python packages that may not be up-to-date in the distro repositories. (On CentOS 7, it will be necessary to installpip
first, withsudo yum install epel-release
followed bysudo yum install python-pip
.)pip install tarantool\>0.4 --user
Use
git
to download the latest Tarantool source code from the GitHub repositorytarantool/tarantool
, branch 1.6. For example, to a local directory named ~/tarantool:git clone https://github.com/tarantool/tarantool.git ~/tarantool
Use
git
again so that third-party contributions will be seen as well.The build depends on the following external libraries:
- Readline development files (
libreadline-dev/readline-devel
package). - OpenSSL development files (
libssl-dev/openssl-devel
package). libyaml
(libyaml-dev/libyaml-devel
package).liblz4
(liblz4-dev/lz4-devel
package).- GNU
bfd
which is the part of GNUbinutils
(binutils-dev/binutils-devel
package).
This step is only necessary once, the first time you do a download.
cd ~/tarantool git submodule init git submodule update --recursive cd ../
On rare occasions, the submodules will need to be updated again with the command:
git submodule update --init --recursive
Note: There is an alternative – to say
git clone --recursive
earlier in step 3, – but we prefer the method above because it works with older versions ofgit
.- Readline development files (
Use CMake to initiate the build.
cd ~/tarantool make clean # unnecessary, added for good luck rm CMakeCache.txt # unnecessary, added for good luck cmake . # start initiating with build type=Debug
On some platforms, it may be necessary to specify the C and C++ versions, for example:
CC=gcc-4.8 CXX=g++-4.8 cmake .
The CMake option for specifying build type is
-DCMAKE_BUILD_TYPE=type
, wheretype
can be:Debug
– used by project maintainersRelease
– used only if the highest performance is requiredRelWithDebInfo
– used for production, also provides debugging capabilities
The CMake option for hinting that the result will be distributed is
-DENABLE_DIST=ON
. If this option is on, then latermake install
will install tarantoolctl files in addition to tarantool files.Use
make
to complete the build.make
This creates the „tarantool“ executable in the directory src/
Next, it’s highly recommended to say
make install
to install Tarantool to the /usr/local directory and keep your system clean. However, it is possible to run the Tarantool executable without installation.Run the test suite.
This step is optional. Tarantool’s developers always run the test suite before they publish new versions. You should run the test suite too, if you make any changes in the code. Assuming you downloaded to
~/tarantool
, the principal steps are:# make a subdirectory named `bin` mkdir ~/tarantool/bin # link python to bin (this may require superuser privilege) ln /usr/bin/python ~/tarantool/bin/python # get on the test subdirectory cd ~/tarantool/test # run tests using python PATH=~/tarantool/bin:$PATH ./test-run.py
The output should contain reassuring reports, for example:
====================================================================== TEST RESULT ------------------------------------------------------------ box/bad_trigger.test.py [ pass ] box/call.test.py [ pass ] box/iproto.test.py [ pass ] box/xlog.test.py [ pass ] box/admin.test.lua [ pass ] box/auth_access.test.lua [ pass ] ... etc.
To prevent later confusion, clean up what’s in the bin subdirectory:
rm ~/tarantool/bin/python rmdir ~/tarantool/bin
Make an rpm package.
This step is optional. It’s only for people who want to redistribute Tarantool. Package maintainers who want to build with
rpmbuild
should consult therpm-build
instructions for the appropriate platform.Verify your Tarantool installation.
tarantool $ ./src/tarantool
This will start Tarantool in the interactive mode.
For your added convenience, we provide OS-specific README files with example scripts at GitHub:
- README.FreeBSD for FreeBSD 10.1
- README.MacOSX for Mac OS X El Capitan
- README.md for generic GNU/Linux
These example scripts assume that the intent is to download from the 1.6 branch, build the server and run tests after build.