Skip to content

Build On Linux

artzers edited this page Jul 27, 2020 · 17 revisions

Build On Linux

The environment of the tutorial is Ubuntu, GCC 8.4. As Visual Studio can export the Qt project for Linux easily, we manage GTree codes in Visual Studio project (.sln) on Windows and Qt project (.pro) on Linux, rather than CMake.

Prerequisites

  • GCC 8.4 compiler.

  • Qt5 library and QtCreator. They can be downloaded on https://download.qt.io/archive/qt/ . QtCreator is the C++ IDE, which is the same as Visual Studio on Windows.

  • Third-party libraries. help

  • GPU driver. Please make sure that GPU driver software for the discrete graphics card is installed correctly on User's computer. Run the command "sudo glxinfo | grep OpenGL" to check whether the current GPU supports the OpenGL 4.

Compilation

  1. Extract GTree source archive and enter the project directory. Use QtCreator to open "GTree.pro" file. "GTree.pro" file is the project file the same as ".sln" file for visual studio. Open and edit the "GTree.pro" file.
  2. Set INCLUDE_PATH and LIBS to user own library path. Configure other project settings following QtCreator tutorial.
  3. Click "build" button.

snapshot

Make Executable Package

User can run GTree from QtCreator directly, but may fail to run GTree by open GTree in QtCreator Release directory. The dynamic library files (.so) are not put into the Debug/Release directory which contains GTree program. User can make a new directory and put GTree and the corresponding dynamic library files (.so) into the directory. Make a Linux script "run_local.sh" to add library search path and run GTree. As Conan provide static link library rather than dynamic library, some 3rd dymnamic library files are not in need. The corresponding dynamic library files required by the latest GTree are:

  1. All VTK dynamic library files and soft link files (.so.X). I.e. they are located under ~/Library/debug/vtk/lib/ .
  2. Library files and soft link files, including libQt5Core.so.X, libQt5Gui.so.X, Qt5Widgets.so.X, libQt5DBus.so.X, libQt5X11Extras.so.X, libQt5XcbQpa.so.X, libicudata.so.56, libicui18n.so.56, libicuuc.so.56. I.e. they are located under ~/Qt5.12.5/5.12.5/gcc_64/lib
  3. "platforms" and "xcbglintegrations" directory. Please copy the entire directory into the start-up directory rather than copy the library files. I.e. They are located under ~/Qt5.12.5/5.12.5/gcc_64/plugins

If there is still library file error, please go to the start-up directory and run command the "sudo ldd ./GTree" to acquire more information.

The content of "run_local.sh" is:

export LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH}
./GTree

FAQ

Q: libjpeg.so.8: cannot open shared object file: No such file or directory

A: Run "sudo yum -y install libjpeg libjpeg-devel". If the installed version is not 8, follow the subsequent steps: Download jpeg8.zip from http://www.ijg.org/files/. Extract and enter the source directory. Please read the "install.txt" file. If showing "bash: ./configure: /bin/sh^M: error", run "sed -i 's/\r$//' ./*".

./configure

make

make test

make install

Edit ./run_local.sh in GTree directory:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./:/usr/local/lib

export HDF5_DISABLE_VERSION_CHECK=1

./GTree

Q:Error while loading shared libraries: libnvidia-tls.so.XXX.XXX

A: If the GPU brand of the user's computer is NVidia, please reinstall NVidia GPU driver.