Setting up the POCO C++ Libraries


Operating Systems: Linux / Windows
Language: C++
Last Edit: 16.03.2017 - 15:43

Downloading the sources

Switch to the directory you want to download the POCO C++ source files to, e.g. /home/username/development. Then use the wget command to download the compressed sources. You can get the link address from After downloading extract the files using the tar command and switch to the created poco directory. On Windows you can just right click->save as and afterwards unzip the file to your development directory.

Compiling the libraries on Linux

Before actually compiling the sources you have to run the configuration script. After that start the compilation by using the make command. You can speed things up by letting make run parallel processes if you are at least on a Raspberry Pi 2. Go for a walk now or have a coffee because the compilation process will take some time to complete. (Way less when run in parallel mode though..) After it finished run make install to copy the libraries over to your system directories and finally call ldconfig so the system can dynamically link to your freshly installed libraries. Congratulations!

Putting it all together

Now here is a full step by step example of the whole process described above:

  cd /home/pi/dev/cpp
  tar xzvf ./poco-1.7.8-all.tar.gz
  cd poco-1.7.8-all
  make -j4
  sudo make install
  sudo ldconfig

Note that to successfully compile the Data/MySQL part of the library you need the mysql developer libraries installed on your system. It's quite a long time ago when I installed those but I think the package name was "libmysqlclient-dev". Just use apt-get to install it before compiling.

For the ODBC part you can either use iODBC or unixODBC. This information was taken directly from poco's readme file. I did not compile Data/ODBC myself yet so I did not test if either of those work or not. You can omit the compilation of those by calling the config script with the omit parameter e.g.

./configure --omit=Data/ODBC,Data/MySQL

Meanwhile on Windows..

While the process is rather straightforward on linux, there are a few things to keep an eye on when on a Windows machine.

There are different batch scripts shipping with the POCO sources which are intented to compile the libraries just like on linux. Each script is for a different version of the MS compiler, so choose the right one here.

That being said I stumbled upon some problems using these scripts so I had to revert to opening, reconfiguring and compiling some parts of the libraries manually in Visual Studio.

OpenSSL Dependency

OpenSSL and encryption in general are an essential part of todays software development where privacy is a key feature of many applications on the market. Linux systems come with OpenSSL preinstalled in most cases so we did not need to worry about it there. On Windows on the other hand we have to install it ourselves.
The easiest way to achieve this is by using a binary package containing the precompiled OpenSSL libraries as well as the needed include and lib files.

You can download a Windows installer from Shining Light Production's website with the latest version of OpenSSL.

With the current version of OpenSSL the names of the dll files have been changed on Windows. The files were formerly named ssleay32.dll and libeay32.dll.
Now they follow the linux naming scheme and are called libcrypto-1_1.dll and libssl-1_1.dll. The POCO project files (POCO_1.7.7) however still referenced the old names, which resulted in failed compilations of those components trying to link against the libraries.

Fixing the projects

Here is a list of steps you need to do with every project that failed to compile:

  Open it in Visual Studio (select appropriate file for your version)
  Change project properties of both shared and debug configurations
  Add additional include directories for e.g. OpenSSL or MySQL
  Add additional library directories for e.g. OpenSSL or MySQL
  Change library names for the OpenSSL libraries
  Build the debug_release configuration
  Build the shared_release configuration
  Et voilĂ !

Of course you have to download and install the MySQL developer libs on Windows just like on linux if you want to compile Data/MySQL. You can download them directly from the MySQL Developer Page. ODBC comes preinstalled on Windows so there is nothing more to be done here.

In an upcoming tutorial I will show you how to actually use the POCO C++ Libraries in your own projects!