How to build OGRE in Ubuntu

Ubuntu ships with a particular version of OGRE that can be installed easily. For example, on Ubuntu 16.04:

$ sudo apt install libogre-1.9-dev

However, if you need to use an older or newer version of OGRE then you might need to build it yourself. This is not so hard on Linux, as it is on Windows.

  • Install the essential packages needed for building OGRE:
$ sudo apt install build-essential automake libtool libfreetype6-dev libfreeimage-dev libzzip-dev libxrandr-dev libxaw7-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev libpoco-dev libtbb-dev doxygen libcppunit-dev
  • Download the OGRE version you want as a ZIP file from its Mercurial repository on Bitbucket here.

  • Unzip the file and build OGRE:

$ mkdir build
$ cd build
$ cmake ..
$ make
  • To install OGRE to /usr/local/lib/OGRE:
$ sudo make install

Tried with: OGRE 1.8 and Ubuntu 16.04

Dispatch plugin for Vim


Vim can be used to build your code by using the :make command. It runs the command appropriate for your compiler, parses the compile errors or warnings and provides them in the Quickfix window. The only problem with this is that the build process is synchronous: the build command takes over the terminal and until it is over you can neither view nor interact with Vim.

The Dispatch plugin by Tim Pope enables you to run the build command asynchronously. The plugin can be installed from source here. You have two choices: run the build command asynchronously in the foreground or in the background.

  • Run :Make to run the build asynchronously in the foreground. This is possible only if you are using a terminal multiplexer like Tmux. A split terminal opens up at the bottom and you can see the output of your build there. The focus remains in Vim and you can view and interact with the editor while the build carries on. If you are running Vim in a normal terminal, this command just runs the plain old :make synchronously.

  • Run :Make! to run the build asynchronously in the background. This can be run on Vim running in any setup. The build command runs in the background invisibly and you can view and interact with Vim while this is happening.

  • Run :Copen to view the build output either during the build or after it is complete in foreground or background.

I highly recommend this plugin for anyone who is already using :make since with no change you can now build asynchronously.

Tried with: Vim 7.4 and Ubuntu 14.04

How to build OGRE on Windows

OGRE is a bit difficult to compile on Windows because of the many libraries it depends on.

Build OGRE dependencies

  • Clone the OGRE Dependencies repository. This has the source code of all the OGRE dependent libraries.

  • Build it using CMake. Make sure you set CMAKE_INSTALL_PREFIX to a separate subdirectory since this path will be used while building OGRE.

  • If you get error on unistd.h, comment that line. I found it could build without using it.

Build OGRE

  • Download the source code of OGRE or clone from its repository.

  • Build it using CMake. Set the variable OGRE_DEPENDENCIES_DIR to the install path you set while building the dependencies. Set the CMAKE_INSTALL_PREFIX variable to the place where you want the OGRE libraries and executables need to be placed after build.


Pre-built libraries of OGRE for recent Visual Studio versions can be downloaded from here.


Tried with: OGRE 1.8.1, Visual Studio 2013 and Windows 7 x64

How to build OpenCV on Ubuntu

  • Download the OpenCV source code from its Github repository. I prefer to download the releases, which are more stable compared to the main branch.

  • Create a build directory:

$ mkdir build
$ cd build
  • Configure the features you want OpenCV to be compiled with. I prefer the CMake GUI for this:
$ cmake-gui ..
  • Click Configure. Go down the list and look for the items named BUILD_*, BUILD_opencv_* and WITH_*. Each of these is a feature that can be compiled into OpenCV. Choose what you would like and uncheck those not needed.

  • BUILD_* items: These are related to external libraries. If you enable one of them, during the build, the source code of that external library will be downloaded and built. You typically do not want to do this, since you can install the pre-built library directly by using apt-get. For example, instead of using BUILD_JPEG, you can just install the libjpeg-dev package from Ubuntu repositories.

  • BUILD_opencv_* items: These are the features of OpenCV. Choose which of these features you need for your work. These features might be interdependent and it is your responsibility to ensure that all the dependent features are also enabled. You can see if the dependencies for the feature you need were met in the output you get after pressing the Configure button.

  • WITH_* items: These are typically related to external libraries. This is different from BUILD_* items, since choosing this indicates that you want OpenCV to link with this external library. For example, choosing WITH_TBB links with the Intel TBB library and certain OpenCV features compute faster due to the added parallelism available from Intel TBB.

  • After you have chosen the features you need, click Configure again. Examine the output at the bottom and if you are satisfied, click Generate. This generates the Makefile.

  • Build OpenCV from the Makefile:

$ make

The build can take a long time, so you might want to run parallel builds:

$ make -j
  • If you find that a feature you want is not being built, then check the output that is at the bottom of the CMake GUI after you press Configure.

Ensure there is nothing displayed in red color. If there is, note down the header file or library that is required and install those packages. Also ensure that all the options you chose have been chosen for build. Some of the features are inter-dependent and may not be built if their dependencies are not chosen.

Another technique is to go to the subdirectory containing the feature and look at the CMakeLists.txt file there. Look for the text REQUIRED_DEPS that shows what other OpenCV features need to be present for this feature to be built. Ensure those features are also chosen.

  • To install OpenCV that you have built:
$ sudo make install

Tried with: OpenCV 2.4.9 and Ubuntu 14.04

Notification of Visual Studio Build with Growl


Compiling C++ projects in Visual Studio can take quite a while. A programmer might switch to a different application to do something else (say browse) while the code compiles. It would be nice if the programmer can get a visual notification of the success or failure of the build happening in the background once it is done.


Growl is a neat tool that can make this happen. Here is how to get notifications of your Visual Studio builds using Growl:

  1. Download and install Growl.
  2. Download and install the Visual Studio plugin for Growl.
  3. Open Visual Studio and choose Tools → Growl. (If you do not see a Growl item in the Tools menu, see the end of this post for a fix.)
  4. In the Growl dialog, enable Notifications and choose whether you want to be notified on Project or Solution builds.
  5. Run Growl and compile something in Visual Studio. You should see a notification on your display when the build succeeds or fails.

The kind of display used for the notification can be configured in Growl. Enjoy your build notifications! 🙂


I could not get the Visual Studio plugin working on my computer, i.e., there was no Growl menu item in Visual Studio. Though I chose to install for Everyone, I found that the Visual Studio plugin was installing to C:\Users\Superuser\AppData\Roaming\Microsoft\MSEnvShared\Addins\Growl Add-In, where Superuser is the login of an administrator. It is actually supposed to install to C:\Program Files (x86)\Growl Extras\Growl Add-In for Visual Studio\

A quick fix worked for me. I copied the Growl Add-in folder to C:\Users\Joe\AppData\Roaming\Microsoft\MSEnvShared\Addins\Growl Add-In, where Joe is my non-admin username. And when I opened Visual Studio as the user Joe, Growl worked! 🙂

Tried with: Growl 2.0.8 and Visual Studio 2008 and 2010