Skip to content

Thirdparty Library

artzers edited this page Jul 27, 2020 · 49 revisions

Third-party Library

We have introduced the Conan package manager to acquire the third-party compilation library quickly. However, two large libraries, Qt 5 and VTK, are still not supported well. Thus these two libraries are installed using other ways. Note: As static libraries are acquired by Conan in default, the configuration of GTree project is changed from version 1.0.4

For Visual Studio 2017, most of Debug/Release prebuilt binary packages, including VTK, except Qt 5, can be downloaded from https://github.com/GTreeSoftware/GTree/releases/tag/1.0.4.1 . The archive file is only 70 MB.

For Ubuntu 16.04 or higher, GCC 8.4, most of Debug/Release prebuilt binary packages, including VTK, except Qt 5, can be downloaded from https://github.com/GTreeSoftware/GTree/releases/tag/1.0.4.2 . The archive file is about 195 MB.

User can also install Qt 5, build VTk, and use Conan to acquire third-party libraries themselves by following the instruction.

Windows

Qt 5 Installation

Qt 5 is the cross-platform GUI framework applied in GTree. Qt 5 is free and open-source for community users and the Qt community provides an official pre-built release for all platforms. So, We can download and install the Qt5 libraries freely. However, the compilation process of Qt 5 is too long and requires a high-performance computer.

  1. Install Visual Studio 2017 or higher.
  2. Go to http://download.qt.io/ and download Qt 5 installer, i.e. http://download.qt.io/official_releases/qt/5.12/5.12.5/qt-opensource-windows-x86-5.12.5.exe
  3. Run Qt 5 installer and install Qt 5.
  4. Tool menu -> Extensions and Updates, click the "Online" button and search qt. Download and install Qt Visual Studio Tools. Restart Visual Studio.
  5. Qt VS Tools menu->Qt Options, add the path of installed Qt. The target path is i.e. “D:\Qt\Qt5.12.5\5.12.5\msvc2017_64”.
  6. Open GTree.sln. The Qt 5 compiling environment is configured automatically.

If user downloads newer Qt, please note that VTk library files bind to the Qt link library files. _VTK _needs to be rebuilt if uses different versions of Qt.

VTK Installation

The configuration of VTK should be specified or VTK will be not compatible with Qt 5. The APIs of VTK are changed frequently, thus the version of VTK is specified as 8.2.0.

  1. Download VTK 8.2.0 source from https://www.vtk.org/files/release/8.2/VTK-8.2.0.tar.gz.
  2. Decompress the archive file to target directory, i.e. D:/VTK-source/VTK-8.2.0. Make a subdirectory D:/VTK-source/VTK-8.2.0/build/, D:/VTK-source/VTK-8.2.0/library/debug and D:/VTK-source/VTK-8.2.0/library/release.
  3. Download CMake from https://cmake.org/download/. Open the CMake.
  4. Set the source code directory and target directory in CMake.
  5. Click the configure button and choose the default compiler. Remember specifying the “optional platform for generator” as x64. Click OK and wait. Click the configure button.
  6. Set the CMake_Install_Prefix as D:/VTK-source/VTK-8.2.0/library/. Enable VTK_GROUP_QT. Ensure the VTK_RENDERING_BACKEND is Opengl2. Then click the configure button again.

cmake-vtk-win-config

  1. Set the Qt 5 Dir. I.e. D:\Qt\Qt5.12.5\5.12.5\msvc2017_64\lib\cmake\Qt5. Then click the configure button again. Wait.
  2. If there is no configuration error, click the Generate button. The VTK project is generated under D:/VTK-source/build/.
  3. Go to D:/VTK-source/VTK-8.2.0/build/ and open VTK.sln. Click Build menu->Batch build. Just tick ALL_BUILD Debug/x64 and build. Wait.
  4. If there are no errors, Click Build menu->Batch build. Just tick INSTALL Debug/x64 and build. Go to D:/VTK-source/library/ and move the generated directory into D:/VTK-source/VTK-8.2.0/library/debug.
  5. Click Build menu->Batch build. Just tick ALL_BUILD Release/x64 and build. Wait.
  6. If there is no errors, Click Build menu->Batch build. Just tick INSTALL Release/x64 and build. Go to D:/VTK-source/VTK-8.2.0/library/ and move the generated directory into D:/VTK-source/VTK-8.2.0/library/release.
  7. [Optional, if need debug project] Click Build menu->Batch build. Just tick ALL_BUILD Debug/x64 and build. Wait. If there is no errors, Click Build menu->Batch build. Just tick INSTALL Debug/x64 and build. Go to D:/VTK-source/VTK-8.2.0/library/ and move the generated directory into D:/VTK-source/VTK-8.2.0/library/debug.
  8. Users can move D:/VTK-source/VTK-8.2.0/library/ to any other directory for better management.

Conan for other third-party libraries

Except for Qt 5 and VTK, GTree requires eigen3, libtiff, libsvm, hdf5 and zlib. These libraries can be acquired by Conan, a C++ package manager.

  1. Install Anaconda/Miniconda python3 from https://docs.conda.io/en/latest/miniconda.html.
  2. Open anaconda powershell prompt and run the command “pip install conan”.
  3. Go to C:\Users\[username]\.conan directory and open conan.conf. Go to section [storage] and set the “path=./data” to any other directory for better management, i.e. D:/conan/.
  4. Download the conanfile.txt from https://github.com/GTreeSoftware/GTree/tree/master/conan/windows or save the following text as conanfile.txt:
[requires] 
hdf5/1.12.0 
libtiff/4.1.0 
eigen/3.3.7@conan/stable
libsvm/324 
zlib/1.2.11@conan/stable
  1. Open anaconda powershell prompt and go to the directory which contains conanfile.txt. Run the command "conan install ." Please note there is a dot after "install" in the command. The corresponding release libraries will be acquired under the specified directory, i.e. D:/conan/. Go to D:/conan/ and copy the “include” and “lib” directory of corresponding library (I.e. D:\conan\hdf5\1.12.0__\package\abcd6e0d515a4c4276ad2833f4c668012847788f) to other directory for better Release package management, like the following figure.

WinLibrary

  1. [Optional, if need debug project] Open anaconda powershell prompt and go to the directory which contains conanfile.txt. Run the command “conan install . –s build_type=Debug”. The corresponding debug libraries will be acquired under the specified directory, i.e. D:/conan/. Go to D:/conan/ and copy the “include” and “lib” directory of the corresponding debug library to other directory for better Debug package management. Please note that debug and release packages should be saved in different directories.

Other

  1. Conan downloads static library default. In older versions of GTree project, the hdf5 library is built as the shared library. “H5_BUILT_AS_DYNAMIC_LIB” is added in Project->Properties->C/C++->Preprocessor->Preprocessor Definitions. In the latest version of GTree project, “H5_BUILT_AS_DYNAMIC_LIB” should be removed.
  2. Boost, PCL, GLOG libraries are removed from 1.0.4 version.
  3. Tree.hh can be downloaded from http://tree.phi-sci.com/.
  4. Inifile is a light-weight opensource library for reading and writing .ini files. Download site. The license allows users to put source code directly into the project. In default, inifile source codes have been put in GTree project.

Linux

Install OpenGL Dependency on Linux

OpenGL development dependencies are needed to install for compiling VTK on Linux. On CentOS, Run

yum install -y mesa*

yum install -y freeglut*

yum install -y *GLEW*

We have introduced the Conan package manager to acquire the third-party compilation library quickly. However, two large libraries, Qt 5 and _ VTK_, are still not supported well. Thus these two libraries are installed using other ways.

GCC

Our environment is Ubuntu, GCC 8.4. Indeed GCC above 5.4 version is also OK.

Qt5 Installation

_Qt _community provides official pre-built releases for all platforms. We just need to download and install the Qt 5 libraries. The compilation process of Qt 5 is too long and requires high-performance computers.

  1. Go to http://download.qt.io/ and download Qt 5 installer, i.e. http://download.qt.io/official_releases/qt/5.12/5.12.5/qt-opensource-windows-x86-5.12.5.run
  2. Open a terminal and go to the directory contains Qt 5 installer. Run the command “chmod 777 qt-opensource-windows-x86-5.12.5.run” and “./ qt-opensource-windows-x86-5.12.5.run” to install Qt5. Qt5 is installed under user home directory, i.e. /home/super/Qt5.12.5/. The Qt Creator is also installed along with Qt 5 library.
  3. Run QtCreator. Open project file named GTree.pro. Use the default configuration to re-configure the GTree project.
  4. Edit GTree.pro and set the current header/library files directories.

VTK Installation

The configuration of VTK should be specified or VTK will be not compatible with Qt5. The APIs of VTK are changed frequently, thus the version of VTK is specified as 8.2.0. Please note that there are many differences between the building process of Windows and Linux.

  1. Download VTK 8.2.0 source from https://www.vtk.org/files/release/8.2/VTK-8.2.0.tar.gz.
  2. Decompress the archive file to the target directory, i.e. ~/VTK-source/VTK-8.2.0/. Make a subdirectory ~/VTK-source/VTK-8.2.0/build/, ~/VTK-source/VTK-8.2.0/library/debug and ~/VTK-source/VTK-8.2.0/library/release.
  3. Install CMake by running command “sudo apt install cmake”. User can also download and install CMake from https://cmake.org/download/.
  4. Open a terminal and go to "~/VTK-source/VTK-8.2.0/build/ ". Run the command “ccmake ..”. Note the command is ccmake rather than cmake.
  5. Set the CMAKE_BUILD_TYPE as Release. [Recommend] Set the CMAKE_INSTALL_PREFIX as ~/VTK-source/VTK-8.2.0/library/. Enable VTK_GROUP_QT. Ensure the VTK_RENDERING_BACKEND is Opengl2. Press the "c" button to configure.
  6. Set the Qt _5__Dir. I.e. ~\Qt5.12.5\5.12.5\gcc_64\lib\cmake\Qt5. Please donot refer to the Qt 5 library of Anaconda/Miniconda. Then Press "c" button to configure again. Wait.
  7. If there is no configuration error, Press the "g" button to generate the VTK project. The VTK project is generated under ~/VTK-source/VTK-8.2.0/build/.
  8. Go to ~/VTK-source/VTK-8.2.0/build/ and run the command “make”. If there is no error, run the command “make install”.
  9. Go to ~/VTK-source/VTK-8.2.0/library/ and move the generated directory into ~/VTK-source/VTK-8.2.0/library/release/.
  10. [optional, if need Debug] Open a terminal and go to "~/VTK-source/VTK-8.2.0/build/". Run the command “ccmake ..”. Note the command is ccmake rather than cmake. Set the CMAKE_BUILD_TYPE as Debug. The following steps are the same as steps 5-9. Go to ~/VTK-source/VTK-8.2.0/library/ and move the generated directory into ~/VTK-source/VTK-8.2.0/library/debug/.
  11. Users can move ~/VTK-source/VTK-8.2.0/library/ to any other directory for better management.

Note: If showing "CMake Error, X11_Xt_LIB could not be found. Required for VTK", run command "sudo apt-get install libxt-dev"

Conan for other third-party libraries

Except for Qt 5 and VTK, GTree requires eigen3, libtiff, libsvm, hdf5, tree.hh and zlib. These libraries can be acquired by Conan, a C++ package manager. The libtiff and hdf5 are acquired by Conan on Linux and rely on other dependencies: xz_utils, libwebp, libjpeg, jbig. These libraries will be downloaded by Conan automatically.

  1. Install Miniconda python3 from https://docs.conda.io/en/latest/miniconda.html.
  2. Open a terminal and run the command “pip install conan”.
  3. Go to ~/.conan directory and edit conan.conf. Go to section [storage] and set the “path=./data” to any other directory for better management, i.e. ~/conan/.
  4. Download the conanfile.txt from https://github.com/GTreeSoftware/GTree/tree/master/conan/linux or save the following text as conanfile.txt. Note: The version of libtiff is 4.0.9 instead of 4.1.0. There are several bugs in libtiff 4.1.0 Linux version.
[requires]
hdf5/1.12.0
libtiff/4.0.9@bincrafters/stable
eigen/3.3.7@conan/stable
libsvm/324
zlib/1.2.11@conan/stable
  1. Open a terminal and go to the directory which contains conanfile.txt. Run the command "conan install ." Please note there is a dot after "install" in the command. The corresponding release libraries will be acquired under the specified directory, i.e. ~/conan/. Go to ~/conan/ and copy the “include” and “lib” directory of corresponding library (I.e. ~/conan/hdf5/1.12.0///package/abcd6e0d515a4c4276ad2833f4c668012847788f/) to other directory for better management, like the following figure. Note that Qt 5 is installed in its specific directory before and no need to change its path.

library1

Library2

  1. [Optional, if need Debug] Open a terminal and go to the directory which contains conanfile.txt. Run the command “conan install . –s build_type=Debug”. The corresponding debug libraries will be acquired under the specified directory, i.e. ~/conan/. Go to ~/conan/ and copy the “include” and “lib” directory of the corresponding library to other directory for better Debug management.

Other

  1. Boost, PCL, GLOG libraries are removed.
  2. Tree.hh can be downloaded from http://tree.phi-sci.com/.
  3. Inifile is a light-weight opensource library for reading and writing .ini files. Download site. The license allows users to put source code directly into the project. In default, inifile source codes have been put in GTree project.