How to compile OpenViBE on a new Linux distro

OpenViBE is a portable software, meaning that it addresses several platforms and can be easily adapted to new platforms when needed. At the time of writing this post, OpenViBE is officially supported on two Operating Systems : Windows and Linux. It has been reported to work on Apple’ OSX as well but has not been fully tested on this platform. When it comes to Linux, every geek around know that there are 100s of distributions. Each distribution has its pros and cons. For instance some are really up to date but more subject to bugs. Some are really stable but with older software. Some are devoted to very old computers. The differences not only are on the purpose of the distribution ; they can be on the tools that come along too. For instance, even if all the distros come with a package manager (dpkg and apt for Debian and Ubuntu, rpm and yum for Fedora, …), each of these package manager have different syntax & behaviour. So for that reason, compiling a Linux software on a new distribution may need some tweaking. This is what this post is all about, compiling OpenViBE on a new Linux distro. And the main issue is probably to have the dependencies installed.

OpenViBE has many dependencies. In order to handle them correctly, I created a linux-install_dependencies script that takes care of all the work for you. Some of the dependencies are installed from the native packages of the distribution (this usually requires root access), others are compiled from sources in a local folder. Depending on your distribution, you will have to adapt them separately.

1. Installing appropriate native dependencies

One of the best pros with Linux as regarding to Windows is it’s packaging management. Thousands of software are installable and just one click away from usable. Using such package manager, it becomes easy to check what dependency can be installed and to actually install them.

1.a) Checking what distribution is hosting OpenViBE.

There are different ways of knowing what distribution is running. For instance, on Ubuntu, I checked the /etc/lsb-release file that contains valuable information like distribution name, distribution version, architecture etc. So if Ubuntu is present in this file, it may be an Ubuntu or Ubuntu derivative distribution :

352: if [[ “`grep Ubuntu /etc/lsb-release 2> /dev/null`” != “” ]]; then

For Debian distribution, similar information can be found in the /etc/issue file :

513: if [[ “`grep Debian /etc/issue 2> /dev/null`” != “” ]]; then

Finally for Fedora distribution, /etc/fedora-release should exist :

677: if [[ -e /etc/fedora-release ]]; then

As you can see, each Linux distribution has its own way to go. If you want to compile OpenViBE on a new distribution, you have to find this distro marker.

1.b) Checking what native package is already installed

At this point, we know what distribution is hosting OpenViBE. That is we know what package manager the distribution is using, for instance apt-get or yum. Again, each tool has its own way of checking what is installed or not. On Ubuntu and Debian, dpkg -l tells us the status of each package and gives a ii starting line for installed packages :

357: ov_dpkg_output=`dpkg -l $package 2>&1 | grep “^ii”`

On Fedora, did not find (but did not search for long) a way of checking if a package is installed or not. If you find one, it should be interesting to put it in the dependencies install script to save some time.

1.c) Installing the native packages

Now is time to actually install the necessary packages. This is usually quite easy to do if you have root access. But gaining root access is again different on each distro. There are mainly two ways of doing it, either use sudo or su. The former allows a user to run one command with root privilege. The latter allows a user to have an interactive root shell. So on Ubuntu, we use the following command :

389: sudo apt-get –assume-yes install $ov_ubuntu_packages

Note that we revoke root access before and after this command using sudo -k. This is for security purpose, we don’t want to harm the system while we had root access and did not need them.

On Debian, su is used :

353: su -c “apt-get –assume-yes install $ov_ubuntu_packages

On Fedora, the command is quite similar :

714: su -c “yum -y install $ov_fedora_packages

Again, find the correct way for your distribution to do this.

1.d) Finishing the native package installation

To terminate the native package installation, it is necessary to tell the installation script that those dependencies should not be installed from sources. This can be done thanks to the ov_hit_package commands (line 430 to 492 for Ubuntu, 593 to 655 for Debian and 754 to 816 for Fedora). Any package that is not hit at this point will be installed from sources later.

2. Building remaining dependencies from sources

Sometimes, not all the necessary dependencies can be installed from native package, for instance because they are not included with the distribution (VRPN does not have native packages) or because the version that comes with the distribution is not the version you need for OpenViBE (for instance Ogre has some API breakages from version to version that make it almost impossible to use as a native package). So for that purpose, the ov_install_package can be used to build from sources any dependency that has not previously been hit by the ov_hit_package command (line 1515 to 1601). Each of these dependency will be built and installed in a local software sub folder. The url of the source archives for each dependency are listed from line 1000 to 1083. Sometimes, these archives location change so the installation script breaks. If it turns out that the location is changed, just manually find the new url and update the script.

3. Building OpenViBE

Once all the dependencies are installed, OpenViBE should build with no harm. OpenViBE does not assume anything about the distribution nor use any distribution specific feature. So once all the dependencies are installed, well, just use linux-build as you normally do.

4. Submitting a patch for your preferred distro

Because you don’t want to patch OpenViBE for each new version, you are warmly invited to submit a patch for the linux-install_dependencies script. This will most likely be integrated in the official release of OpenViBE so that users of the same distribution as you will have OpenViBE ready to build. Of course, the mainstream team will probably not provide official support for this as they can not handle all the 100s of distributions around. But still, this will make the efforts very low for people not wanting to go ahead with

Comments are closed.