Build Vaa3D on Linux - Vaa3D/Vaa3D_Wiki GitHub Wiki

Build From Source

PREREQUISITES: Qt and C++ compilier

You should have both Qt and C++ compiler ready on your system.

You can get Qt from

http://qt-project.org/downloads

Supported Qt versions

Note, some of the newer versions of Qt (e.g. Qt 4.8.7 +) might not be compatible with some of operating systems . To avoid these problems, you can download a relatively stable Qt version, e.g. 4.8.6, from the following link.

https://download.qt.io/archive/qt/
  1. Download the precompiled Qt 4.7.3 library from <a '>this link

2. Unpack it to /usr/local/Trolltech such that your qmake path is /usr/local/Trolltech/Qt-4.7.3/bin/qmake.

3. Permanently add your qmake path to the system path:
  • open the Terminal and go to your home directory
  • create (or edit) the .bash_profile file with a command line editor (e.g. nano)
      nano .bash_profile
  • add the line
      export PATH="/usr/local/Trolltech/Qt-4.7.3/bin:$PATH"
which declares the new location /usr/local/Trolltech/Qt-4.7.3/bin as well as the original path declared as $PATH.
  • save the file in nano by clicking control+o and confirming the name of the file is .bash_profile by hitting return. And the control+x to exit nano
  • relaunch the Terminal and check that your qmake works by typing
      qmake --version
which should produce
 QMake version 2.01a
Using Qt version 4.7.3 in /usr/local/Trolltech/Qt-4.7.3/lib

Note:

For those who have installed Qtlib using Qt Installer directly, and at the same time also have other Qt versions installed, the computer might be messed up in a way it might not be clear which Qt library would be linked during building. To resolve the issue, one can revise the corresponding building script located inside the v3d_external repository (see the download instructions in the next session): v3d_external/build.macx for Mac and v3d_external/build.linux for Linux, by adding the following statements at the beginning (let's use Qt 4.7.3 as an example)

QT4=<QT_4.7.3_PATH>
PATH=$QT4/bin:$PATH
QMAKESPEC=$QT4/mkspecs/<spec>

Here <QT_4.7.3_PATH> is the placeholder for the directory where Qt 4.7.3 is installed and <spec> is the placeholder for specification. For example, <spec> can be macx-g++ for Mac OS and linux-g++ for Linux, depending on what C++ complier you want to use.

Things to do for Ubuntu

To compile Vaa3D on Ubuntu 16+ (How to install ubutu16.04), your GCC should be downgraded to GCC4.8 to be compatible with the ITK packages used in Vaa3D.

$ sudo apt-get install gcc-4.8
$ sudo apt-get install g++-4.8
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8

To make sure opengl-dev is installed

$ sudo apt-get install mesa-common-dev
$ sudo apt-get install libglu1-mesa-dev

To successfully build terafly on Ubuntu16, you may also need to install the libhdf5-dev

sudo apt-get install libhdf5-dev

Things to do for Centos/Fedora

Note that for some Redhat based systems, such as CentOS (How to Install CentOS 7), the standard OpenGL and GLUT library files might be missing. Thus Vaa3D might have some trouble to be built. You may need to run the following commands (or sth similar) to first get these files (also note that you may need to do this even before Qt is built and installed, as on Linux the OpenGL support in Qt is dependent on the status of the operating system)

yum install freeglut
yum install mesa-libGL-devel mesa-libGLU-devel

On a fresh Linux (e.g. CentOS) system, you may not even have git, g++, Xext, etc. You can install them via the following commands:

sudo yum install git
sudo yum install gcc
sudo yum install gcc-c++
sudo yum install libXext-devel.x86_64
sudo yum install libXrender-devel.x86_64
sudo yum install libpng12-devel.x86_64

In case you don't know the exact names of the missing system library files, you can try to search using the following command (for the xext example) to figure out the exact name(s).

sudo yum search  xext
sudo yum whatprovides xext




Download Source Code and Build

You need to check out source code from github code repositories, one for main Vaa3D code and one for some released plugins. You can following the instructions for both Vaa3D program and its default plugins.

First, make sure you have GIT installed.

Vaa3D Source Download

** Please use "--recursive" to clone the terafly submodule.
git clone --recursive  https://github.com/Vaa3D/v3d_external.git  
git clone https://github.com/Vaa3D/vaa3d_tools.git

Setup Symbolic Directory links for Building Plugins

The vaa3d_tools contains the majority of the plugins. The plugin sources are separated from the trunk, so in order to build the plugins in vaa3d_tools into the main program using QMake (If you are using CMake, you don't need to set up the folder cross linkes, you could configure the install directories during CMake configuration time. However, many of the existing plugins can only be built with QMake right now.) The following folder setting needs to be done:


cd vaa3d_tools
ln -s ../v3d_external/v3d_main v3d_main
ln -s ../v3d_external/bin bin
cd ../v3d_external
ln -s ../vaa3d_tools/released_plugins released_plugins_more

Build Instructions


./build.linux -j4

The last few lines create symbolic links for necessary header files and output plugins.

You may replace the "-j4" using "-j8", "-j2", or "-j16", depending on how many CPU cores your have on your machine. Note that the "make" command on some systems (e.g. Ubuntu) may not recognize the "-j" parameter. In such as case, you can just run "build.linux" without that parameter.

Caveat:

After the building,you will see the vaa3d executable under "bin" folder.

But before you run "./bin/vaa3d" executable, please make sure you set the LD_LIBRARY_PATH: export LD_LIBRARY_PATH= <your/local/path/to/v3d_external>/v3d_main/common_lib/lib/

Otherwise you might see the following error:
1 v3d_external/bin/vaa3d: error while loading shared libraries: libtiff.so.5: cannot open shared object file: No such file or directory You can put this line to your .bashrc file to avoid typing when opening a new terminal.
2. error name:libGL.so or libGL.so.1
in/usr/lib64/folder,there are two links (libGL.so and libGL.so.1) which link to libGL.so.1.7.0.
Sometimes these links may break,so you need to delete these links and link to libGL.so.1.7.0 again.


sudo rm /usr/lib64/libGL.so /usr/lib64/libGL.so.1
sudo ln -s /usr/lib64/libGL.so.1.7.0 /usr/lib64/libGL.so
sudo ln -s /usr/lib64/libGL.so.1.7.0 /usr/lib64/libGL.so.1

⚠️ **GitHub.com Fallback** ⚠️