OrthoDB 1.6 Installation On Ubuntu 14.04 (And Related) – Build Errors And The Simple Fixes

UPDATE: 20 May 2016 – With thanks to OrthoDB's very own Fredrik Tegenfeldt, here's a more distro-complete fix for the Makefile.rules file.

# BRH flags
ifeq ($(USE_BRH),1)
BRH_DIR        = $(BASE_DIR)
CPPFLAGS    += -I$(BRH_DIR)/src
ifeq ($(WITH_RPATH),1)
LDFLAGS        += -L$(LIB_DIR) -Wl,-rpath,$(LIB_INSTDIR)
else
LDFLAGS        += -L$(LIB_DIR)
endif
LDLIBS        += -lbrh
endif

ifeq ($(USE_BOOST_THREAD),1)
CPPFLAGS    += -pthread -DHAS_BOOST_THREADS
LDFLAGS        += -pthread
LDLIBS      += -L$(DIR_BOOST_LIB) -lboost_system -L$(DIR_BOOST_THREAD) -l$(LIB_BOOST_THREAD) -lpthread
endif

And Happy New Year,

Yet another random Ubuntu-centric bioinformatics aside in the event others run into the same build issues (with errors included below, as you likely googled those first). For those wondering…

The Hierarchical Catalog of Orthologs v8

Orthology (website, download) is the cornerstone of comparative genomics and gene function prediction. OrthoDB aims to classify protein-coding genes from the increasing number of available sequenced genomes into groups of orthologs descended from a single gene of the last common ancestor (LCA) of each clade of species. Applying this concept to the hierarchy of LCAs along the species phylogeny results in multiple levels of orthology: the more closely-related the species, the more finely-resolved the orthologous relations.

The build here was on a fresh installation of 64-bit Ubuntu 14.04 (Trusty Tahr). All of the errors produced come from running on that clean install, meaning you'll run into dumb errors (like missing build-essential), didn't-know-we-needed-that errors (boost), and that's-probbly-an-Ubuntu-oddity errors (with a modified Makefile.rules file with explicit boost calls linked to below; I suspect the developers are working on a non-Ubuntu distro).

Relevant apt-get's

sudo apt-get install build-essential libboost-all-dev

Relevant Downloads

* tclap (1.2.1) – tclap.sourceforge.net/

Stage 1 – Just Trying The Easy Install

I build everything in /opt by default and propose you do the same (whatever). First steps included.

username@ubuntu:~$ cd Downloads/
username@ubuntu:~/Downloads$ sudo mv OrthoDB_soft_1.6.tgz /opt/
username@ubuntu:~/Downloads$ cd /opt/
username@ubuntu:/opt$ sudo tar xvf OrthoDB_soft_1.6.tgz 

OrthoDB_soft_1.6/
OrthoDB_soft_1.6/BRHCLUS-1.12.7/
...
OrthoDB_soft_1.6/README
OrthoDB_soft_1.6/LICENSE
username@ubuntu:/opt$ cd OrthoDB_soft_1.6/
username@ubuntu:/opt/OrthoDB_soft_1.6$ sudo make WITH_RPATH=1 prefix=$(pwd) all
make: *** No rule to make target `all'.  Stop.

If you read the README file, you figure out to move to the BRHCLUS folder, then discover the need for the boost libraries, available via an apt-get:

username@ubuntu:/opt/OrthoDB_soft_1.6$ cd BRHCLUS-1.12.7/
username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo ./configure.sh 
FATAL: cannot find boost libraries!
- Is boost installed (boost_system) ?
- Is boost installed in any of the search paths ?
  If not, add the path to PATH_SEARCH_LIB at the top of this script.

Stage 2 – sudo apt-get install libboost-all-dev

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo apt-get install libboost-all-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  account-plugin-windows-live libupstart1
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  icu-devtools libboost-atomic-dev libboost-atomic1.54-dev
  libboost-atomic1.54.0 libboost-chrono-dev libboost-chrono1.54-dev
...
  libxml2-dev mpi-default-bin mpi-default-dev ocl-icd-libopencl1 openmpi-bin
  openmpi-common zlib1g-dev
0 upgraded, 102 newly installed, 0 to remove and 14 not upgraded.
Need to get 46.7 MB of archives.
After this operation, 262 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libboost-atomic1.54.0 amd64 1.54.0-4ubuntu3.1 [8,076 B]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libboost-chrono1.54.0 amd64 1.54.0-4ubuntu3.1 [12.5 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/universe libboost-context1.54.0 amd64 1.54.0-4ubuntu3.1 [8,028 B]
Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libboost-filesystem1.54.0 amd64 1.54.0-4ubuntu3.1 [34.2 kB]
...
Setting up libboost-wave-dev:amd64 (1.54.0.1ubuntu1) ...
Setting up libboost-all-dev (1.54.0.1ubuntu1) ...
Setting up libhwloc-plugins (1.8-1ubuntu1.14.04.1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...

The configure stage now works…

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo ./configure.sh 
OK - boost libraries
OK - boost thread libraries
OK - boost include dir
OK - tclap include dir
OK - thread pool include dir
Config file (/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/Makefile.config) successfully created

But, right off the bat, a clean install is missing build tools.

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo make WITH_RPATH=1 prefix=$(pwd) all
  Compiling brh_version.cpp
/bin/sh: 1: g++: not found
make[2]: *** [.linux/brh_version.o] Error 127
make[1]: *** [src] Error 2
make: *** [all] Error 2

Stage 3 – sudo apt-get install build-essential

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo apt-get install build-essential 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  account-plugin-windows-live libupstart1
...
0 upgraded, 9 newly installed, 0 to remove and 14 not upgraded.
Need to get 15.9 MB of archives.
After this operation, 27.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main g++-4.8 amd64 4.8.4-2ubuntu1~14.04 [15.0 MB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main g++ amd64 4:4.8.2-1ubuntu6 [1,490 B]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main dpkg-dev all 1.17.5ubuntu5.5 [726 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty/main build-essential amd64 11.6ubuntu6 [4,838 B]
...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
Setting up libalgorithm-diff-perl (1.19.02-3) ...
Setting up libalgorithm-diff-xs-perl (0.04-2build4) ...
Setting up libalgorithm-merge-perl (0.08-2) ...

And the build process now takes steps forward.

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo make WITH_RPATH=1 prefix=$(pwd) all
  Compiling brh_version.cpp
  Compiling brh_common.cpp
  Compiling pairdataset.cpp
  Compiling brh_functions.cpp
  Compiling keymap.cpp
  Compiling inparalog.cpp
  Compiling clusterdata.cpp
  Compiling cluster.cpp
  Compiling clusterize.cpp
  Compiling cluster_functions.cpp
  Compiling modularity.cpp
  Compiling tri4algo.cpp
  Linking libbrh.so
  Compiling brhclus.cpp
  Linking brhclus
.linux/brhclus.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:224: undefined reference to `boost::system::system_category()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::detail::get_current_thread_data()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::disable_interruption::disable_interruption()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::interruption_point()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::start_thread_noexcept()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::interrupt()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::hiden::sleep_until(timespec const&)'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::join_noexcept()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `vtable for boost::detail::thread_data_base'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::native_handle()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::detach()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::disable_interruption::~disable_interruption()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: error: ld returned 1 exit status
make[2]: *** [/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/bin/brhclus] Error 1
make[1]: *** [tools/brhclus] Error 2
make: *** [all] Error 2

Stage 4 – tclap Install

A quick google search produces the following from info.circ.rochester.edu/BlueHive/Software/Bioinformatics/orthodb.html indicating that tclap is an OrthoDB dependency that needs to be satisfied. The version I've built below (1.2.1) can be downloaded from tclap.sourceforge.net

username@ubuntu:/opt$ ls
OrthoDB_soft_1.6  OrthoDB_soft_1.6.tgz  tclap-1.2.1.tar.gz

Extract and expand.

username@ubuntu:/opt$ sudo tar xvf tclap-1.2.1.tar.gz 
tclap-1.2.1/
tclap-1.2.1/aclocal.m4
tclap-1.2.1/AUTHORS
tclap-1.2.1/ChangeLog
...
tclap-1.2.1/config/Makefile.am
tclap-1.2.1/config/Makefile.in
tclap-1.2.1/config/missing
tclap-1.2.1/config/mkinstalldirs

The build process goes without issue.

username@ubuntu:/opt$ cd tclap-1.2.1/
username@ubuntu:/opt/tclap-1.2.1$ sudo ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
...
config.status: creating tests/Makefile
config.status: creating config/config.h
config.status: executing depfiles commands
config.status: executing default commands

Onto make…

username@ubuntu:/opt/tclap-1.2.1$ sudo make
Making all in include
make[1]: Entering directory `/opt/tclap-1.2.1/include'
Making all in tclap
make[2]: Entering directory `/opt/tclap-1.2.1/include/tclap'
make[2]: Nothing to be done for `all'.
...
make[1]: Leaving directory `/opt/tclap-1.2.1/config'
make[1]: Entering directory `/opt/tclap-1.2.1'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/opt/tclap-1.2.1'

And make install…

username@ubuntu:/opt/tclap-1.2.1$ sudo make install
Making install in include
make[1]: Entering directory `/opt/tclap-1.2.1/include'
Making install in tclap
make[2]: Entering directory `/opt/tclap-1.2.1/include/tclap'
...
test -z "/usr/local/lib/pkgconfig" || /bin/mkdir -p "/usr/local/lib/pkgconfig"
 /usr/bin/install -c -m 644 'tclap.pc' '/usr/local/lib/pkgconfig/tclap.pc'
make[2]: Leaving directory `/opt/tclap-1.2.1'
make[1]: Leaving directory `/opt/tclap-1.2.1'

Stage 5 – Re-attempt The OrthoDB Build

The configure goes without issue again…

username@ubuntu:/opt$ cd OrthoDB_soft_1.6/
username@ubuntu:/opt/OrthoDB_soft_1.6$ cd BRHCLUS-1.12.7/
username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo make clean
username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo ./configure.sh 
OK - boost libraries
OK - boost thread libraries
OK - boost include dir
OK - tclap include dir
OK - thread pool include dir
Config file (/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/Makefile.config) successfully created

But there's still an error at the make stage.

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo make all
  Compiling brh_version.cpp
  Compiling brh_common.cpp
  Compiling pairdataset.cpp
  Compiling brh_functions.cpp
  Compiling keymap.cpp
  Compiling inparalog.cpp
  Compiling clusterdata.cpp
  Compiling cluster.cpp
  Compiling clusterize.cpp
  Compiling cluster_functions.cpp
  Compiling modularity.cpp
  Compiling tri4algo.cpp
  Linking libbrh.so
  Compiling brhclus.cpp
  Linking brhclus
.linux/brhclus.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:224: undefined reference to `boost::system::system_category()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::detail::get_current_thread_data()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::disable_interruption::disable_interruption()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::interruption_point()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::start_thread_noexcept()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::interrupt()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::hiden::sleep_until(timespec const&)'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::join_noexcept()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `vtable for boost::detail::thread_data_base'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::native_handle()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::detach()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::disable_interruption::~disable_interruption()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: error: ld returned 1 exit status
make[2]: *** [/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/bin/brhclus] Error 1
make[1]: *** [tools/brhclus] Error 2
make: *** [all] Error 2

Stage 6 – Google Says Make Some Symbolic Links

A first fix for the boost error was to make symbolic links for libboost_thread.so and libboost_timer.so in /usr/lib.

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ cd /usr/lib/x86_64-linux-gnu/
username@ubuntu:/usr/lib/x86_64-linux-gnu$ sudo ln -s libboost_thread.so /usr/lib
username@ubuntu:/usr/lib/x86_64-linux-gnu$ sudo ln -s libboost_timer.so /usr/lib
username@ubuntu:/usr/lib/x86_64-linux-gnu$ cd /opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/
username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo make clean
username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo ./configure.sh 
OK - boost libraries
OK - boost thread libraries
OK - boost include dir
OK - tclap include dir
OK - thread pool include dir
Config file (/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/Makefile.config) successfully created

But this didn't work either.

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo make all
  Compiling brh_version.cpp
  Compiling brh_common.cpp
  Compiling pairdataset.cpp
  Compiling brh_functions.cpp
  Compiling keymap.cpp
  Compiling inparalog.cpp
  Compiling clusterdata.cpp
  Compiling cluster.cpp
  Compiling clusterize.cpp
  Compiling cluster_functions.cpp
  Compiling modularity.cpp
  Compiling tri4algo.cpp
  Linking libbrh.so
  Compiling brhclus.cpp
  Linking brhclus
.linux/brhclus.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:224: undefined reference to `boost::system::system_category()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::detail::get_current_thread_data()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::disable_interruption::disable_interruption()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::interruption_point()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::start_thread_noexcept()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::interrupt()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::hiden::sleep_until(timespec const&)'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::join_noexcept()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `vtable for boost::detail::thread_data_base'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::native_handle()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::thread::detach()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `boost::this_thread::disable_interruption::~disable_interruption()'
/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib/libbrh.so: undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: error: ld returned 1 exit status
make[2]: *** [/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/bin/brhclus] Error 1
make[1]: *** [tools/brhclus] Error 2
make: *** [all] Error 2

Stage 7 – The Boost Issue May Be Ubuntu-Specific

The final solution was to modify the Makefile.rules file to explicitly call on boost in Ubuntu. Make a backup copy of the Makefile.rules in the OrthoDB folder, then place this new Makefile.rules file into the same folder. The modified Makefile.rules is below for copy+paste, else you can download it here: 2016mar25_orthodb_Makefile_rules.txt (just rename the file and place into OrthoDB_soft_1.6/BRHCLUS-1.12.7).

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo nano Makefile.rules 
#
# Build rules
#

# Keep secondary files
.SECONDARY:

include $(ROOT_DIR)/Makefile.config
ifeq ($(strip $(DIR_TCLAP)),)
$(error "Build requires TCLAP package (http://tclap.sourceforge.net)")
endif

# if install, read build details
ifeq "$(MAKE-TARGET)" "install"
include $(ROOT_DIR)/.makefile.build
endif

# Object directory
OBJ_DIR		= .linux

# Use gcc4
CXX		= g++

# Use rpath or not
WITH_RPATH	?= 1

LDFLAGS		= 
ifeq "$(MAKE-TARGET)" "static"
WITH_RPATH	= 0
LDFLAGS		+= -static -lboost_system -lboost_thread -lpthread
endif

# check BOOST
USE_BOOST ?= 1

# check boost threads
USE_BOOST_THREAD ?= 1

ifeq ($(strip $(LIB_BOOST_THREAD)),)
USE_BOOST_THREAD = 0
USE_THREADPOOL = 0
endif

ifeq ($(strip $(DIR_THREADPOOL)),)
USE_THREADPOOL = 0
endif

# Library and binary directories
BASE_DIR	:= $(shell cd $(ROOT_DIR) ; pwd)

# Install directories
# With rpath, enforce install dir same as build
# Without, use same as build as default
# prefix - install topdir
# libdir/bindir - install lib/bin
# BASE_DIR - build top dir
# LIB_DIR/BIN_DIR - build top dir
#
# with rpath :
#   build and install dirs are the same
#   default top is BASE_DIR
# else :
#   build is always under BASE_DIR
#   install under prefix (default BASE_DIR)
#
#ifeq ($(WITH_RPATH),1)
#prefix		?= $(BASE_DIR)
#libdir		= $(prefix)/lib
#bindir		= $(prefix)/bin
##LIB_DIR		:= $(shell mkdir -p $(libdir) ; cd $(libdir) ; pwd)
##BIN_DIR		:= $(shell mkdir -p $(bindir) ; cd $(bindir) ; pwd)
#LIB_DIR		:= $(libdir)
#BIN_DIR		:= $(bindir)
#else
#LIB_DIR		:= $(shell mkdir -p $(BASE_DIR)/lib ; cd $(BASE_DIR)/lib ; pwd)
#BIN_DIR		:= $(shell mkdir -p $(BASE_DIR)/bin ; cd $(BASE_DIR)/bin ; pwd)
#prefix		?= $(BASE_DIR)
#libdir		?= $(LIB_DIR)
#bindir		?= $(BIN_DIR)
#endif
LIB_DIR		:= $(shell mkdir -p $(BASE_DIR)/lib ; cd $(BASE_DIR)/lib ; pwd)
BIN_DIR		:= $(shell mkdir -p $(BASE_DIR)/bin ; cd $(BASE_DIR)/bin ; pwd)
prefix		?= $(BASE_DIR)
libdir		?= $(LIB_DIR)
bindir		?= $(BIN_DIR)
LIB_INSTDIR := $(prefix)/lib
BIN_INSTDIR := $(prefix)/bin

# Install user/group
INST_USR	 = $(shell whoami)
INST_GRP	?= $(shell groups | cut -f 1 -d ' ' )

# Establish install command
# if rpath -> always chown
# else
#   if targetdir==installdir -> chown
#   else install
# endif
#ifeq ($(WITH_RPATH),1)
#INST_CMD	 = chown $(INST_USR).$(INST_GRP)
#else
TARGET_DIR	= $(dir $(TARGET))
rpTARGET	= $(realpath $(firstword $(TARGET_DIR)))
rpINSTDIR	= $(realpath $(prefix)/$(INSTDIR))
ifeq ($(rpTARGET),$(rpINSTDIR))
INST_CMD	 = chown $(INST_USR).$(INST_GRP)
else
INST_CMD	 = mkdir -p $(prefix)/$(INSTDIR); install -D -m 755 -g $(INST_GRP) -t $(prefix)/$(INSTDIR)
endif
#endif

# Definitions concerning build environment
CPPFLAGS	+= -DBRH_BUILD_ENV="\"$(shell uname -s -r -v -m -i -p -o)\""
CPPFLAGS	+= -DBRH_BUILD_TIME="\"$(shell date)\""

# Default pre-processor flags
CPPFLAGS	+= -DBASE_DIR="\"$(BASE_DIR)\""
CPPFLAGS	+= -D_REENTRANT
CPPFLAGS	+= -D_XOPEN_SOURCE

# c++ standard
CPPFLAGS	+= -std=c++11
CXXFLAGS	+= -std=c++11

# debug flag
ifeq ($(USE_DEBUG),3)
CXXFLAGS	+= -fno-inline -fbounds-check
else ifeq ($(USE_DEBUG),2)
CPPFLAGS	+= -DBRH_DEBUG
CXXFLAGS	+= -fno-inline -fbounds-check
else ifeq ($(USE_DEBUG),1)
CPPFLAGS	+= -DBRH_CHECK_IT
CXXFLAGS	+= -finline-functions -fbounds-check
else
CXXFLAGS	+= -finline-functions
endif

# Default compiler flags
CXXFLAGS	+= -fPIC
CXXFLAGS	+= -MMD
CXXFLAGS	+= -g
CXXFLAGS	+= -Wall -Werror
CXXFLAGS	+= -fexceptions
#CXXFLAGS	+= -fno-inline
CXXFLAGS	+= -O3
#CXXFLAGS	+= -O0
CXXFLAGS	+= -I$(BASE_DIR)/src
#CXXFLAGS	+= -std=c++11
#CXXFLAGS	+= -pg
#LDFLAGS		+= -pg

# BRH flags
ifeq ($(USE_BRH),1)
BRH_DIR		= $(BASE_DIR)
CPPFLAGS	+= -I$(BRH_DIR)/src
ifeq ($(WITH_RPATH),1)
LDFLAGS		+= -L$(LIB_DIR) -Wl,-rpath,$(LIB_INSTDIR) -lboost_system -lboost_thread -lpthread
else
LDFLAGS		+= -L$(LIB_DIR) -lboost_system -lboost_thread -lpthread
endif
LDLIBS		+= -lbrh -lboost_system -lboost_thread -lpthread
endif

ifeq ($(USE_BOOST_THREAD),1)
CPPFLAGS	+= -pthread -DHAS_BOOST_THREADS
LDFLAGS		+= -pthread -L$(DIR_BOOST_LIB) -lboost_system -lboost_thread -lpthread -L$(DIR_BOOST_THREAD) -l$(LIB_BOOST_THREAD)
endif

ifeq ($(USE_THREADPOOL),1)
CPPFLAGS	+= -DHAS_BOOST_THREADPOOL
CPPFLAGS	+= -I$(DIR_THREADPOOL)
endif

ifeq ($(USE_BOOST),1)
CPPFLAGS	+= -I$(DIR_BOOST_INC)
endif

# TCLAP flags
ifeq ($(USE_TCLAP),1)
CPPFLAGS	+= -I$(DIR_TCLAP)
endif

# BOOST flags
ifeq ($(USE_THREAD),1)
endif

# Check file type
ifeq ($(suffix $(firstword $(SOURCES))),.cpp)
IS_CPP		= 1
else
IS_CPP		= 0
endif

# List of objects
ifeq ($(IS_CPP),1)
OBJECTS		= $(SOURCES:%.cpp=$(OBJ_DIR)/%.o)
endif

# Default build
default:	all

ifeq ($(IS_CPP),1)
# Build a binary
$(BIN_DIR)/%: $(OBJECTS) Makefile $(BASE_DIR)/Makefile.rules
	@echo "  Linking $(@F)"
	@mkdir -p $(@D)
	@$(LINK.cc) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)

# Build a shared library
$(LIB_DIR)/%.so: $(OBJECTS) Makefile $(BASE_DIR)/Makefile.rules
	@echo "  Linking $(@F)"
	@mkdir -p $(@D)
	@$(LINK.cc) -shared -o $@ $(OBJECTS) $(LDLIBS)

# Build a static library
$(LIB_DIR)/%.a: $(OBJECTS) Makefile $(BASE_DIR)/Makefile.rules
	@echo "  Linking $(@F)"
	@mkdir -p $(@D)
	@ar rcs $@ $(OBJECTS)

# Include dependency files
-include $(OBJECTS:%.o=%.d)

# Build an object file
$(OBJ_DIR)/%.o: %.cpp Makefile
	@echo "  Compiling $< "
	@mkdir -p $(@D)
	@$(COMPILE.cc) -o $@ $<
else
$(BIN_DIR)/%.py: %.py
	@echo "  Copying $< to target dir"
	@cp -f $< $@
endif



# Main targets are phony
.PHONY: default all clean_target clean_obj doc clean_doc clean install static

# Build target
all:	$(TARGET)

static:	$(TARGET)

# Clean objects
clean_obj:
	@$(RM) -r $(OBJ_DIR)

# Clean build
clean_target:
	@$(RM) -r $(OBJ_DIR) $(TARGET)

# Build documentation
doc:
	@$(MAKE) -C $(BASE_DIR) $@

# Clean build
clean: clean_target

# Install
install:
#	@echo "rpT   : $(rpTARGET)"
#	@echo "rpI   : $(rpINSTDIR)"
#	@echo "rpath : $(WITH_RPATH)"
#	@echo "inst  : $(INST_CMD) $(TARGET)"
	@target="$(TARGET)"; \
	[ $${#target} -gt 0 ] || target="$(OUTPUT)"; \
	for f in $${target}; do \
	    fname=`basename $$f`; \
	    if [ -f $$f ]; then \
	       echo "Installing in $(prefix)/$(INSTDIR)    <$$fname>"; \
	       $(INST_CMD) $$f; \
	    fi; \
	done

The configure step runs fine…

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo make clean
username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo ./configure.sh 
OK - boost libraries
OK - boost thread libraries
OK - boost include dir
OK - tclap include dir
OK - thread pool include dir
Config file (/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/Makefile.config) successfully created

…and the build itself runs fine.

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo make all
  Compiling brh_version.cpp
  Compiling brh_common.cpp
  Compiling pairdataset.cpp
  Compiling brh_functions.cpp
  Compiling keymap.cpp
  Compiling inparalog.cpp
  Compiling clusterdata.cpp
  Compiling cluster.cpp
  Compiling clusterize.cpp
  Compiling cluster_functions.cpp
  Compiling modularity.cpp
  Compiling tri4algo.cpp
  Linking libbrh.so
  Compiling brhclus.cpp
  Linking brhclus
  Compiling evolrate.cpp
  Linking evolrate
  Compiling statbrh.cpp
  Linking statbrh
  Compiling brh2x.cpp
  Linking brh2x
  Compiling statclus.cpp
  Linking statclus
  Compiling cmpclus.cpp
  Linking cmpclus
  Compiling getclus.cpp
  Linking getclus
  Compiling cmpbrh.cpp
  Linking cmpbrh
  Compiling cmpinpar.cpp
  Linking cmpinpar
  Compiling renumclus.cpp
  Linking renumclus
  Compiling getinpar.cpp
  Linking getinpar
  Compiling mergeinpar.cpp
  Linking mergeinpar
  Compiling align2brh.cpp
  Linking align2brh
  Compiling findbrh.cpp
  Linking findbrh
  Copying parsedump.py to target dir
  Copying getbrh.py to target dir
  Copying plot_brhclus_progress.py to target dir

Stage 8 – Build The Tests

Just to make sure all is working, make globaltest.

username@ubuntu:/opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7$ sudo make globaltest 

-------------------------------------------------------------
Binary  dir : /opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/bin
Library dir : /opt/OrthoDB_soft_1.6/BRHCLUS-1.12.7/lib
-------------------------------------------------------------

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST MACHINE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uname [ Linux ubuntux 3.16.0-59-generic #79~14.04.1-Ubuntu SMP Mon Jan 18 15:41:27...]
cpu   [ Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz]
mem   [ MemTotal:        3949740 kB]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST BRHCLUS
with option --single
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
run default setup
------------------------------
------------------------------
run with harder e-value cuts
------------------------------
------------------------------
run with soft e-value cuts
------------------------------
------------------------------
Check output files
------------------------------
default                                [OK]
hard_e-val                             [OK]
soft_e-val                             [OK]
------------------------------
Check timing
------------------------------
default                                [16 %]
hard_e-val                             [-8 %]
soft_e-val                             [10 %]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST BRHCLUS, resume function
with option --single
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
resume                                 [OK, contents same but clids or seqs differ]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST BRHCLUS
with option --nostringent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
run default setup
------------------------------
------------------------------
run with harder e-value cuts
------------------------------
------------------------------
run with soft e-value cuts
------------------------------
------------------------------
Check output files
------------------------------
default                                [OK]
hard_e-val                             [OK]
soft_e-val                             [OK]
------------------------------
Check timing
------------------------------
default                                [18 %]
hard_e-val                             [10 %]
soft_e-val                             [2 %]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST BRHCLUS, resume function
with option --nostringent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
resume                                 [OK, contents same but clids or seqs differ]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST BRHCLUS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
run default setup
------------------------------
------------------------------
run with harder e-value cuts
------------------------------
------------------------------
run with soft e-value cuts
------------------------------
------------------------------
Check output files
------------------------------
default                                [OK]
hard_e-val                             [OK]
soft_e-val                             [OK]
------------------------------
Check timing
------------------------------
default                                [7 %]
hard_e-val                             [8 %]
soft_e-val                             [12 %]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST BRHCLUS, resume function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
resume                                 [OK, contents same but clids or seqs differ]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST BRHCLUS
with option --lowmem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
run default setup
------------------------------
------------------------------
run with harder e-value cuts
------------------------------
------------------------------
run with soft e-value cuts
------------------------------
------------------------------
Check output files
------------------------------
default                                [OK]
hard_e-val                             [OK]
soft_e-val                             [OK]
------------------------------
Check timing
------------------------------
default                                [6 %]
hard_e-val                             [8 %]
soft_e-val                             [7 %]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST BRHCLUS, resume function
with option --lowmem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
resume                                 [OK, contents same but clids or seqs differ]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST BRHCLUS
merge BRHs into an existing cluster configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mergebrh                               [OK]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST STATCLUS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
default                                [OK]
hard_e-val                             [OK]
soft_e-val                             [OK]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST CMPCLUS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exact_match                            [OK]
mis-match                              [OK]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST CMPCLUS
related groups
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
default                                [OK]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST MERGEINPAR
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clusters                               [OK]
unresolved                             [OK]


------------------------------------------
Warnings (4) were detected.
------------------------------------------

Most likely this is of not concern and the probable origin are messages like

  [OK, contents same but clids or seqs differ]

They may be caused by rounding errors on different architectures/versions of the software.