Clone wiki

bgen / Troubleshooting compilation


The core BGEN implementation is designed to compile under C++03 - this means it should compile on older compilers e.g. gcc versions before gcc 4.7. However, we've used C++11 features in the tests, in the example code, and in the provided applications; thus a full build of all the tools will require a recent compiler.

BGEN uses the zlib library for compression - this will need to be installed with appropriate headers on your system.

The BGEN apps also rely on three other libraries: sqlite3, boost, and zstandard. Code for these is included in the repository so you should not need to install them seperately.


The best way to build BGEN using gcc is to use the bundled waf script (see the waf homepage for more information). Build is split into two steps - configure (which sets up the environment) and build, and can be run like so:

./waf configure
./waf build

Results of the build are placed in the build/ subdir.

By default waf will use the g++ compiler to compile - if you want to use a different compiler, specify it to the configure step like so:

CXX=g++-4.8 ./waf configure

A couple of C (not C++) libraries are used by BGEN - you may want to specify the C compiler as well:

CXX=g++-4.8 CC=gcc-4.8 ./waf configure

Code development

For development you may want to produce debug builds - these are compiled without optimisation and will be slower, but have debug stubs included for use with lldb or gdb. This can be accomplished using the --mode flag:

./waf configure --mode=debug

Building only the library

If you don't have access to a recent compiler that supports C++11, you can still build the core BGEN implementation. To do this, specify it as a target:

./waf --targets=bgen

this produces build/libbgen.a.

Creating the R package


./waf build_rbgen

to create the rbgen R source package in a temporary folder. The location of the built package will be output. This can then be compiled and installed using R CMD INSTALL as described on the rbgen page.