Skip to content

Building and Installing from Source

Anatoly Boshkin edited this page Feb 3, 2022 · 4 revisions

Quick instructions for building and installing ncbi-vdb from source.

  1. Dependencies:
    ncbi-vdb will attempt to utilize 3rd party libraries and development headers from your system if they can be located:
    libxml2 (needed for many loaders)
    libmagic (needed for copycat)
    libhdf5 (needed for pacbio-load)
    If any of these libraries cannot be located, their functionality will be missing from our library.

  2. Create an ncbi source directory if needed.
    While this is not strictly required, our configuration scripts will benefit by being able to locate related projects without asking for explicit paths:
    $ mkdir ncbi

  3. Check out the sources:
    $ cd ncbi
    $ git clone https://github.com/ncbi/ncbi-vdb.git

  4. If you have not yet installed ngs, please get the sources at this point. It is not necessary to build and install ngs yet, but since ncbi-vdb contains an ngs "engine", it needs some header files:
    $ git clone https://github.com/ncbi/ngs.git

  5. Configure the build:
    $ cd ncbi-vdb
    $ ./configure
    By default, configure will select a build-output directory under your $HOME and will install under /usr/local/ncbi-vdb on Linux. The default settings can be changed, of course. For all options, you can run:
    $ ./configure --help

  6. Make the libraries:
    $ make

  7. Install the libraries and includes (you may be asked for an admin password):
    $ sudo make install

At this point, the installation should be complete, although you will probably have to login again before all changes take place. If the installation is successful, you should find library code installed and an update to shell variables (only AFTER logging in again). To verify update of your environment:
$ echo $LD_LIBRARY_PATH # should now have the path to your installed ncbi-vdb libraries

UPCOMING CHANGES

Starting with Release 3.0.0:

How To Build From Source

To build from source, you need one of the supported operating systems (Linux, Windows, MacOS) and CMake (minimum version 3.16). On Linux and MacOS you need the GNU C/C++ toolchain (On MacOS, you may also use CMake to generate an XCode project), on Windows a set of MS Build Tools for Visual Studio 2017 or 2019.

Linux, MacOS (gmake)

  1. In the root of the ncbi-vdb checkout, run:
./configure

Use ./configure -h for the list of available optins

  1. Once the configuration script has successfully finished, run:
make

This will invoke a Makefile that performs the following sequence:

  • retrieve all the settings saved by the configuration script
  • pass the settings to CMake
    • if this is the first time CMake is invoked, it will generate a project tree. The project tree will be located underneath the directory specified in the --build-prefix option of the configuration. The location can be displayed by running make config or make help inside the source tree.
    • build the CMake-generated project

Running make from any directory inside the source tree will invoke the same sequence but limit the scope of the build to the sub-tree with the current directory as the root.

The make command inside the source tree supports several additional targets; run make help for the list and short descriptions.

MacOS (XCode)

To generate an XCode project, check out ncbi-vdb and run the standard CMake out-of-source build. For that, run CMake GUI, point it at the checkout directory and choose Xcode as the generator. Once the CMake generation succeeds, there will be an XCode project file ncbi-vdb.xcodeproj in the build's binary directory. You can open it with XCode and build from the IDE.

Alternatively, you can configure and build from the command line:

cmake <path-to-ncbi-vdb> -G Xcode
cmake --build . --config Debug      # or Release

Windows (Visual Studio)

To generate an MS Visual Studio solution, check out ncbi-vdb and run the standard CMake out-of-source build. For that, run CMake GUI, point it at the checkout directory, choose one of the supported Visual Studio generators (see NOTE below) and a 64-bit generator, and click on "Configure" and then "Generate". Once the CMake generation succeeds, there will be an MS VS solution file ncbi-vdb.sln in the current directory. You can open it with the Visual Studio and build from the IDE.

NOTE: This release supports generators Visual Studio 15 2017 and Visual Studio 16 2019, only for 64 bit platforms.

Alternatively, you can configure and build from the command line (assuming the correct MSVS Build Tools are in the %PATH%), e.g.:

cmake <path-to-ncbi-vdb> -G "Visual Studio 16 2019" -A x64
cmake --build . --config Debug      # or Release
Clone this wiki locally