Build OpenVDB C++ Library on CentOS 7

Posted: April 24, 2015 in Uncategorized

Build OpenVDB C++ Library on CentOS 7

openVDB_LOGO

Follow this script to build or install dependency for open VDB. most of them can be easy to get through YUM installer but some you required build from source codes.

#! /bin/bash

:’ this script will install dependency for Open VDB
and setup development environment

# Install Important dependency for build Open VDB

# Install Python development files
yum -y install python-devel

# install cmake to build and compile dependency
yum -y install cmake

#Boost 1.42.0 = 1.53.0
yum -y install boost boost-devel

#GCC 4.1 = 4.8.3
#gmake 3.81 = 3.82
yum -y install gcc

#TBB 3.0 = 4.15
yum -y install tbb tbb-devel

#libz 1.2.7
yum -y install zlib

#OpenEXR = 2.2.0
### OPTIONAL DEPENDENCY
# doxygen 1.8 = 1.8.5
yum -y install doxygen

# cppunit-devel 1.10 = 1.12
yum -y install cppunit-devel

# ghostscript 8.70 = 9.07
yum -y install ghostscript

# OTHERS PACKAGES
#NumPy 1.7
yum -y install numpy

# OpenGL 3.2 = 4.5.0
# OpenGL will automatically installed with Nvidia Drivers
# Install BLOSC 1.5.3
# download – c-blosc-1.5.3.tar.gz
cd /tmp
tar xvf c-blosc-1.5.3.tar.gz
cd c-blosc-1.5.3
cmake .
make
make install
# =========================================================
# Install AutoMake 1.15
# download –  automake-1.15.tar.xz
cd /tmp
tar xvf automake-1.15.tar.xz
cd automake-1.15
./configure
make
make install

# this error will come when you will compile log4cplus-1.2.0-rc3
:’
/hqvfx/development/openVDB/dependency/package/log4cplus-1.2.0-rc3/missing: line 81: aclocal-1.14: command not found
WARNING: ‘aclocal-1.14’ is missing on your system.
You should only need it if you modified ‘acinclude.m4’ or
‘configure.ac’ or m4 files included by ‘configure.ac’.
The ‘aclocal’ program is part of the GNU Automake package:
<http://www.gnu.org/software/automake&gt;
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf&gt;
<http://www.gnu.org/software/m4/&gt;
<http://www.perl.org/&gt;
make: *** [aclocal.m4] Error 127


# create a symbolic link to fix this error
ln -s /usr/local/bin/aclocal-1.15 /usr/local/bin/aclocal-1.14
ln -s /usr/local/bin/automake-1.15 /usr/local/bin/automake-1.14

# Install LOG4CPLUS
# download –  log4cplus-1.2.0-rc3.tar.xz
cd /tmp
tar xvf log4cplus-1.2.0-rc3.tar.xz
cd log4cplus-1.2.0-rc3
./configure
make
make install
# download – epydoc-3.0.1.zip
cd /tmp
unzip epydoc-3.0.1.zip
cd epydoc-3.0.1
python setup.py install
# Install GLFW

# first install X11 dependency for GLFW

yum -y install xorg-*
yum -y install mesa*
yum install glibc-static

# download –  glfw-3.1.1.zip
cd /tmp
unzip glfw-3.1.1.zip
cd glfw-3.1.1
cmake _GLFW_X11 .
make
make install
####################################################

Now we have to edit Makefile inside openvdb folder, all we need to do is specify the paths of dependency lib, include, headers files etc. for a quick reference i am posting my edited Makefile, checkout the bold letter lines.

# The directory into which to install libraries, executables and header files
DESTDIR := /hqvfx/development/openVDB/openvdb_build

# The parent directory of the boost/ header directory
BOOST_INCL_DIR := /usr/include/boost
# The directory containing libboost_iostreams, libboost_system, etc.
BOOST_LIB_DIR := /usr/lib64
BOOST_LIB := -lboost_iostreams -lboost_system
BOOST_THREAD_LIB := -lboost_thread

# The parent directory of the OpenEXR/ header directory
EXR_INCL_DIR := /hqvfx/development/openVDB/dependency/openexr/include
# The directory containing IlmImf
EXR_LIB_DIR := /hqvfx/development/openVDB/dependency/openexr/lib
EXR_LIB := -lIlmImf

# The parent directory of the OpenEXR/ header directory (which contains half.h)
ILMBASE_INCL_DIR := /hqvfx/development/openVDB/dependency/ilmbase-2.2.0/include
# The directory containing libIlmThread, libIlmThread, libHalf etc.
ILMBASE_LIB_DIR := /hqvfx/development/openVDB/dependency/ilmbase-2.2.0/lib
ILMBASE_LIB := -lIlmThread -lIex -lImath
HALF_LIB := -lHalf

# The parent directory of the tbb/ header directory
TBB_INCL_DIR := /usr/include/tbb
# The directory containing libtbb
TBB_LIB_DIR := /usr/lib64
TBB_LIB := -ltbb

# The parent directory of the blosc.h header
# (leave blank if Blosc is unavailable)
BLOSC_INCL_DIR := /usr/local/include
# The directory containing libblosc
BLOSC_LIB_DIR := /usr/local/lib
BLOSC_LIB := -lblosc

# A scalable, concurrent malloc replacement library
# such as jemalloc (included in the Houdini HDK) or TBB malloc
# (leave blank if unavailable)
CONCURRENT_MALLOC_LIB := -ltbbmalloc_proxy -ltbbmalloc
# The directory containing the malloc replacement library
CONCURRENT_MALLOC_LIB_DIR := /usr/lib64

# The parent directory of the cppunit/ header directory
# (leave blank if CppUnit is unavailable)
CPPUNIT_INCL_DIR := /usr/include/cppunit
# The directory containing libcppunit
CPPUNIT_LIB_DIR := /usr/lib64
CPPUNIT_LIB := -lcppunit

# The parent directory of the log4cplus/ header directory
# (leave blank if log4cplus is unavailable)
LOG4CPLUS_INCL_DIR := /usr/local/include/log4cplus
# The directory containing liblog4cplus
LOG4CPLUS_LIB_DIR := /usr/local/lib
LOG4CPLUS_LIB := -llog4cplus

# The directory containing glfw.h
# (leave blank if GLFW is unavailable)
GLFW_INCL_DIR := /usr/local/include
# The directory containing libglfw
GLFW_LIB_DIR := /usr/local/lib
GLFW_LIB := -lglfw3 -lGLU -lGL -lX11 -lXxf86vm -lXrandr -lpthread -lXi -lXcursor -lXinerama
# The major version number of the GLFW library
# (header filenames changed between GLFW 2 and 3, so this must be specified explicitly)
GLFW_MAJOR_VERSION := 3

# The version of Python for which to build the OpenVDB module
# (leave blank if Python is unavailable)
PYTHON_VERSION := 2.7
# The directory containing Python.h
PYTHON_INCL_DIR := /usr/include/python2.7
# The directory containing pyconfig.h
PYCONFIG_INCL_DIR := $(PYTHON_INCL_DIR)
# The directory containing libpython
PYTHON_LIB_DIR := /usr/lib64
PYTHON_LIB := -lpython$(PYTHON_VERSION)
# The directory containing libboost_python
BOOST_PYTHON_LIB_DIR := /hqvfx/development/openVDB/dependency/BOOST_PYTHON_LIB_DIR
BOOST_PYTHON_LIB := -lboost_python
# The directory containing arrayobject.h
# (leave blank if NumPy is unavailable)
NUMPY_INCL_DIR := /usr/lib64/python2.7/site-packages/numpy/core/include/numpy
# The Epydoc executable
# (leave blank if Epydoc is unavailable)
EPYDOC := epydoc
# Set PYTHON_WRAP_ALL_GRID_TYPES to “yes” to specify that the Python module
# should expose (almost) all of the grid types defined in openvdb.h
# Otherwise, only FloatGrid, BoolGrid and Vec3SGrid will be exposed
# (see, e.g., exportIntGrid() in python/pyIntGrid.cc).
# Compiling the Python module with PYTHON_WRAP_ALL_GRID_TYPES set to “yes”
# can be very memory-intensive.
PYTHON_WRAP_ALL_GRID_TYPES := no

# The Doxygen executable
# (leave blank if Doxygen is unavailable)
DOXYGEN := doxygen

# Once All dependency installed sucessfully
# than Now we start building OpenVDB
# download – openvdb_3_0_0_library.zip
cd /tmp
unzip openvdb_3_0_0_library.zip
cd openvdb

# COPY EDITED “Makefile” and overide existing

make -j4
make install

once everything is done successful you can see these three file in you build >> bin folder

openvdb_build_folder

openvdv_viwer_02openvdv_viwer_01

Done.

Cheers !

Rajiv Sharma

Advertisements
Comments
  1. veera says:

    hi sir,
    Your posts are awesome. If you don’t mind how to install NIS SERVER AND CLIENT on centos7?

  2. Hi Rajiv,

    I’m getting stuck in the glfw build because it can’t find the RandR library and headers (line 259 of CMakeLists.txt). As far as I can tell they seem to be installed at /usr/lib64/libxcb-randr.so and /usr/include/xcb/randr.h but Cmake’s Find_X11 module is reporting them as missing. I don’t know how Find_X11 determines the presence of randr, if I did I might be able to add some soft links to help it find these files.

    I’m on a fresh Centos 7 install, running in VMware with the tools installed. I realise that VMWare tools may affect RandR but all we need are the library and header, and they both still seem to be in sensible places. Let me know if you can think of anything to try to work around the problem.

    Thanks,
    Robin

  3. Hi Rajiv,

    Continuing from my previous post I looked at the source of CMake’s Find_X11 module to get some clues about what it was looking for for Xrandr:

    https://github.com/vrsys/guacamole/blob/master/cmake/modules/find_x11.cmake

    After that I saw the pattern – here are the additional glfw dependencies I needed to yum install to get glfw to build successfully:

    libXrandr-devel
    libXinerama-devel
    libXcursor-devel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s