Skip to content

Instantly share code, notes, and snippets.

@luca-penasa
Last active June 27, 2017 06:56
Show Gist options
  • Save luca-penasa/2de4bb6d6e55390670679c43be30cabd to your computer and use it in GitHub Desktop.
Save luca-penasa/2de4bb6d6e55390670679c43be30cabd to your computer and use it in GitHub Desktop.

Fist time compile CloudCompare on centos 7

first install development tools, you can do a group install

if you dont know which group to install have a look at the list of existing groups:

yum group list

we are interested in the dev tools:

sudo yum groupinstall "Development Tools"

this will install most of the tools you really need.

we now proceed to checkout the git repo for cloudcompare, but we need before to create a folder for the code etc

cd #this will bring you in your home
mkdir Code # I usually keep a folder in the home, with all my code!
cd Code



#now clone the repo from github
git clone https://github.com/CloudCompare/CloudCompare.git cloudcompare.git

#cc uses submodules, so we need to make sure we checked out also the submodules
cd cloudcompare.git

git submodule update --init --recursive

this last command will output something like:

[luca@localhost cloudcompare.git]$ git submodule update --init --recursive
Submodule 'plugins/qHoughNormals/normals_Hough' (https://github.com/cloudcompare/normals_Hough) registered for path 'plugins/qHoughNormals/normals_Hough'
Submodule 'plugins/qPoissonRecon/PoissonReconLib' (https://github.com/cloudcompare/PoissonRecon) registered for path 'plugins/qPoissonRecon/PoissonReconLib'
Cloning into 'plugins/qHoughNormals/normals_Hough'...
remote: Counting objects: 57, done.
remote: Total 57 (delta 0), reused 0 (delta 0), pack-reused 57
Unpacking objects: 100% (57/57), done.
Submodule path 'plugins/qHoughNormals/normals_Hough': checked out '61ba8056d72eedffadb838d9051cc8975ec7a825'
Cloning into 'plugins/qPoissonRecon/PoissonReconLib'...
remote: Counting objects: 430, done.
remote: Total 430 (delta 0), reused 0 (delta 0), pack-reused 430
Receiving objects: 100% (430/430), 440.75 KiB | 472.00 KiB/s, done.
Resolving deltas: 100% (267/267), done.
Submodule path 'plugins/qPoissonRecon/PoissonReconLib': checked out '7ad96383f639d7625a843c6e97b3ae5579507350'

you can see that CC uses some separated repos for some part of it, e.g. for plugins and third-party libraries. This basically means a separated repository on github for each of the previously listed lib/plugins.

now we create a directory inside "cloudcompare.git", named "build" or whatever name you want. It will contain all the files that will be autogenerated by cmake to setup and compile CC

mkdir build
cd build

before to compile we need to install cmake3, cause CC needs it here they say to add the epel rpository in thiw way:

## RHEL/CentOS 7 64-Bit ##
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
rpm -ivh epel-release-7-9.noarch.rpm

you could have used even:

sudo  yum --enablerepo=extras install epel-release

now we install cmake3:

sudo yum install cmake3 # now should work
sudo yum install cmake3-gui #also this if you want to work with the gui

now we try to compile and see what happens... :-)

cd 
cd Code/cloudcompare.git/build
ccmake3 ..

then press "c" for "configure"

you will see something like:

 CMake Warning at CMakeExternalLibs.cmake:15 (find_package):
   By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
   has asked CMake to find a package configuration file provided by
   "Qt5Widgets", but CMake did not find one.

   Could not find a package configuration file provided by "Qt5Widgets" with
   any of the following names:

     Qt5WidgetsConfig.cmake
     qt5widgets-config.cmake

   Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
   "Qt5Widgets_DIR" to a directory containing one of the above files.  If
   "Qt5Widgets" provides a separate development package or SDK, be sure it has

this means cmake cannot find qt5Widgets package... we need to find the RIGHT package providing qt5 stuff and install it.

on linux youn want to work with the package manager or google around... first just try with yum:

yum search qt5

#from the list qt5-qtbase should install what we need more or less...

sudo yum install qt5-qtbase

after installing we retry to configure and compile from within the build dir

ccmake .. then "c" key

now it complains againd about missing qt5-widgets... wrong package installed :-(

this happend because we installed only the "compiled part" of qt5 to compile code against qt5 we also need some auxiliary files as the headers etc we can install them by just:

yum install qt5-qtbase-devel

hwo do I know? googling around...

now it complaints about opengl extensions for qt5. search and install again the right package, google does not help but centos has a nice tool that tells you what package provide which file... we install the tool first (found this using google):

sudo yum install dnf

and then we ask him the right package:

dnf provides */Qt5OpenGLExtensions

the package is qt5-qtbase-static. thus:

sudo yum install qt5-qtbase-static

now again, from the build folder

ccmake ..

and then "c"

this should now work withouth complaining. :-D

now you need to configure some stuff: set CMAKE_BUILD_TYPE to Release CMAKE_INSTALL_PREFIX to where you want the binaries to be installed

by def is /usr/local but I suggest you to use a folder in your home like "apps" of "local"

a good idea is to put it to ~/.local!

thus set CMAKE_INSTALL_PREFIX to ~/.local

now you should be fine for a first run!

press "g" to generate the project

and now

make -j 2 

will compile CC using 2 processors .... wait ....

once finished, without errors we can now proceed to install CC into the system it will be installed under CMAKE_INSTALL_PREFIX I suggested you to use a folder under your home so you will not need any administrative privileges to write in that location

just type

make install

next part is needed only if you did not installed under .local !!

cmake will create the needed dir structure under /home/birko/apps or whatever folder you chosed

... go there and see what created ... basically some dirs:

bin  lib  share

in bin there are the bianries of CloudCompare in lib the dynamic libraire that CloudCompare need to run.

now we need to make the system know that these folders cotinas binaries and libraries. to do that we edit your ".bash_profile" file. you can find it in your home!

so

cd ~
gedit .bash_profile

it should open a text editor. within the file is

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

be basically add some paths here, edit the file so that it will looks like

# .bash_profile

# Get the aliases and functions	
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

PATH=$PATH:$HOME/apps/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/apps/lib
export PATH
export LD_LIBRARY_PATH

now we need the let know the current console we changed the bash_profile:

source ~/.bash_profile

start cloudcompare!

and now... you can type CloudCompare

and it should show up :-)

now you can try to enable more plugins in the cmake options, see if cmake complaints about missing libraries, install them using yum and recompile and reinstall cloudcompare

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment