Notice: MediaWiki has been updated. Report any rough edges to marcan@marcan.st

Command
Language:Englishfrançaisitalianoportuguês do Brasil

Wget for Windows A command-line utility for retrieving files using HTTP, HTTPS, and FTP protocols. Curl curl is a command-line tool for downloading data using a variety of protocols. Easily installable on most operating systems. FlixGrab FlixGrab+ is a unique application for downloading entire NetFlix serials, TV shows, documentaries, movies. To build from the command line, start the Visual Studio 2015 (or 2017, 2019, etc.) Command Prompt and go (cd) to the directory where you have extracted the POCO C Libraries sources. Then, simply start the buildwin.cmd script and pass as argument the version of Visual Studio (140, 150, 160). You can customize what is being built by buildwin.

  • 2Linux
    • 2.1Ubuntu/Debian
      • 2.1.3libtisch PPA
    • 2.5Manual Build on Linux
  • 3OS X
    • 3.3Homebrew
  • 4Windows
    • 4.1Manual build from source

Please read this before you start

This page documents how to get started using OpenKinect. The libraries are very much in flux and this won't be the final process. This also means these instructions might be out of date with the latest commits. You may also want to take a look at the following for more information:

  • the github project top README (don't forget other readme files in the project tree for specific components)
  • the Wrappers section
  • the OpenKinect mailing list
  • the FAQ

Support

For support requests in the OpenKinect irc channel or in the mailing list, please specify the platform you are using, the version of the software you are trying to build or install, and information about the context etc. as explained here.

The adapter

The Kinect needs its own power source which is independent from the USB connection to work on a computer. The latest Xbox360 can power the Kinect directly but the older Xbox requires an adapter for that purpose. Therefore, the Kinect which is bundled with the Xbox360 doesn't include an adapter whereas the Kinect which is sold separately does. The adapter is sold here. This adapter is required to use the Kinect hardware on your computer with libfreenect.

Fakenect

It is also possible to use the Fakenect utility which is a libfreenect simulator/mock interface to run the Kinect demos without having a Kinect.

Thank you!

Linux

Ubuntu/Debian

Official packages

Starting from Ubuntu 11.10 (Oneiric) and Debian 7 (Wheezy), Ubuntu and Debian provide official packages of libfreenect. You can install them easily in a console:

In Ubuntu 12.04 the gspca kernel driver prevent libfreenect from claiming the Kinect device in user-mode.Either remove and blacklist the module

or install a recent versions of libfreenect that can automatically detach the kernel driver by adding Florian Echtler libtisch PPA (see below) with updated libfreenect packages for Ubuntu 12.04.

The freenect device is accessible to any user belonging to the group 'plugdev'. By default, a desktop user belongs to the plugdev group but if you need to add them to the group:

then log out and log in again

NeuroDebian repository

If you want a recent version of libfreenect no matter which version of Debian or Ubuntu you use, backports of the latest release of libfreenect for all supported version of Debian and Ubuntu (namely Ubuntu Lucid(10.04), Maverick (10.10), Natty (11.04), Oneiric (11.10) and Debian Squeeze and Wheezy at the time of writing) are available on NeuroDebian repository (http://neuro.debian.net). The packages available there are created by the maintainers of the official Debian package and follows the standards of Debian/Ubuntu.

To enable the NeuroDebian repository:

Installing libfreenect is the same as before:

Make sure your user belongs to the plugdev group (The default for a desktop user) to access the device without the root privileges. If it is not the case, add them by:

and log out and log in again

libtisch PPA

An Ubuntu launchpad ppa for Lucid(10.04), Maverick (10.10), Natty (11.04), Oneiric (11.10) and Pangolin (12.04) is available at:

to use it, open a console and execute:

After that, you can use:

This will install libfreenect, the development headers, and the demo applications.

After that, you need to add yourself to the 'video' groupand log back in. The package already includes the necessary rulesfor the udev daemon so that accessing the device will be possiblefor users in the group video.

be sure to log out and back in. You don't need to reboot,just plug in the kinect device right now (if it was already connected,unplug and plug back in).


To start the demo applications use:

Problems with accessing device

In case of problems, run

which should list 3 devices

If they are not present, run

and reconnect Kinekt and `Kinect Camera` should be listed

You find all demo applications starting with the freenect- prefix.

Ubuntu Manual Install

Quick copy-paste instructions to get up-and-running instantly:

Note: If you getting an error saying apt-get cannot find libglut3, you might be on a newer version of Ubuntu that has freeglut3-* instead of libglut3-*, so your initial apt-get install would look like:

To use Kinect as a non-root user do the following:

Also make a file with rules for the Linux device manager:

Copy and paste:

Be sure to log out and back in.

If you can't access or still need root privileges to use your device: in some cases there might be conflicts between permissions of two drivers installed (libfreenect and primesense). If this is your case, try reinstalling primesense's sensor driver and keep only primesense's rules file /etc/udev/rules.d/55-primesense-usb.rules, removing the /etc/udev/rules.d/51-kinect.rules file if you created it.

Fedora

Install libfreenect:

Restart system and run:

Gentoo

Use layman to install tatsh-overlay and emerge dev-libs/libfreenect.

Get layman:

Install the overlay, unmask, and install (replace ~amd64 with ~x86 if on x86):

Add yourself to the video group

By default, only the C synchronous library and C++ library is installed.

USE flags:

  • audio - Enable audio support
  • cpp - Install the C++ header
  • c - Install the C synchronous library
  • examples - Install the examples
  • fakenect - Install the fakenect example
  • opencv - Install the OpenCV example
  • python - Install the Python library

Manual Build on Linux

these instruction need more work, mostly taken from README.asciidoc
Works on CentOS 5.6 x86_64

Install dependencies

For compiling, you need to have the following libs/programs installed. Note these package names seem to be geared toward Ubuntu/Debian.

APT users: (Works on Ubuntu 10.10)

For Ubuntu 13.04, use this instead (replaced libglut3 with freeglut3):


For a non-developer install of RedHat/Fedora/CentOS using yum/rpms, the following command should install most of the packages needed to retrieve, compile, & run the glview demo:

For Fedora 19 you can install the following packages to avoid manually installing libusb:

If you want to enable python in the config, you need to install in Fedora 19:

If you don't see these packages, you will need to add RPMforge as a repository

RPMforge
RPMforge for CentOS

Clone libusb-1.0 Repo and Configure Makefile

If you can not find a pre-built distribution of libusb-1.0, you will need to build it yourself.

If you get the error:

Then you need to create the m4 directory and rerun ./autogen.sh

Build libusb-1.0

Clone libfreenect Repo

If you get the error:

Your SSL Certificate Authority (CA) root certificates are out of date. The following will install the latest version of Mozilla's CA certificate bundle. More info at:
http://curl.haxx.se/docs/caextract.html
http://curl.haxx.se/docs/sslcerts.html

Build libfreenect

Inside the ccmake editor, press c to configure
Using the arrow keys, move to line with LIBUSB_1_INCLUDE_DIR
Press enter to edit the line, then change it to /usr/local/include/libusb-1.0
Press enter when finished editing
Press c to continue configuring
If everything is correct, you will now get an option to press g to generate and exit
Now continue building:

If you get the error:

Then copy libfreenect.pc file into src directory and reinstall:

Errors

If you run into into the following cmake error:

Then you need to install libxi-dev and libxmu-dev/libxmu-headersIf you are using Ubuntu 10.04 or 11.04, type the command: sudo apt-get install libusb-1.0-0-dev libxmu-dev libxi-dev

If you are using Ubuntu 11.04, GLUT_Xi_LIBRARY might still not be found, although it's installed. A workaround for this is to create a symlink:

If glview gives a shared library error:

You need to refresh your ldconfig cache. The easiest way to do this is to create a file usr-local-libs.conf (or whatever name you wish) with the following lines:

Switch to root account and move it to /etc/ld.so.conf.d/usr-local-libs.conf. Then update the ldconfig cache:

Python

To compile the Python wrappers you'll need the package 'python-dev' and cython. The cython package included in Ubuntu 10.10 seems to be broken (see this), get it here or try

For more information about the Python wrappers see this page.

Use as normal user

To be able to access the Kinect you need to add yourself to the video group and change the permission on the created device.

create a file: /etc/udev/rules.d/66-kinect.rules

and add yourself to the video group:

Testing the Kinect

You need to do this as root (or use sudo) if you did not follow the 'Use as normal user' steps.

or

OS X

It is best to install (at least the prerequisites) via a package manager. If you're not already using macports or fink, try Homebrew as we actually have a full package created for this.

MacPorts

Current versions of MacPorts need to support several different versions of libusb. Originally this required a special libusb-devel port that builds the patched libusb library required by the Kinect, but these patches have since been integrated upstream, so the regular libusb port works now.

After installing MacPorts, issue the commands:

Then change to a working directory, and you're ready to:

and continue as per the Manual Build under OSX section. The libusb found by cmake will be correct and already-patched, greatly simplifying the build process!

Fink

You can install libfreenect itself and everything it needs using Fink alone. After installing Fink, issue the following command:

You can try beta releases of libfreenect from the Fink unstable branch:

Or if you want to use the libfreenect code directly from the source, you can skip installing 'libfreenect' if you want to build from source:

and continue as per the Manual Build under OSX section.

Homebrew

If you dont have Homebrew already, it is quite simple to install.

Note: Even if you already have homebrew, make sure to update your formulas (run `brew update`), before trying to install libfreenect as there has been a lot of bugfixing to cmake lately.

Install

And thats it, you are done! A copy of glview demo should now be in your PATH so you can simply run:

to confirm everything worked out ok.

Manual Build under OSX

Prerequisites:

  • git
  • cmake (Can be obtained via MacPorts or from http://www.cmake.org/cmake/resources/software.html)

Next create fetch the OpenKinect repository and libusb:

You don't need to fetch and patch libusb if you already installed libusb-devel via MacPorts (see above)!If you cloned libusb via github you will need to patch it for OpenKinect like so:

and configure OpenKinect:

Don't worry if it shows you an 'Empty Cache' at startup. Now press 'c' in ccmake to configure it.If you already installed libusb via MacPorts or Homebrew, it will work fine. Otherwise it will likely fail, because it cannot find libusb. Press 'e' to exit help and manually edit the path to libusb in the following screen to point to /usr/local/include/libusb-1.0/ and continue.

When you're done, build OpenKinect:

If you want to build OpenKinect as an Xcode project, instead do:

And you're done! There now should be a program called 'glview' in libfreenect/build/bin. Connect your Kinect and start it! If you run into 'ld: warning: in /usr/local/lib/libusb-1.0.dylib, missing required architecture x86_64' when using make, you have to correct the paths with cmake: They have to point to /opt ... when libusb was installed via MacPorts.

To have the files globally available on your Mac and to use them with your own projects, you may install them:

If you have problems with linking:

you have to change the rpath of each libfreenect lib:

Parallel usage with pyusb

If you also want to use pyusb to play with the Kinect, you will need libusb-1.0.8 (it seems). Install it via homebrew and then define the _lib variable before finding the usb device:

Windows

If you are looking for a showcase of the project's features before compiling, you could take a look at this precompiled demo (source is available as well) which uses libfreenect and opencv.

Manual build from source

Introduction

Building from source shouldn't require any specific expertise but may yet be challenging for some. This introduction will serve to give those who need it a bit of background as to what we're trying to do here. To summarize, you will be downloading the latest libfreenect source and separate dependencies. The dependencies will be used twofold. First, you will copy .dll files to your system where they can be accessed. Secondly, you will link .lib and header files to the source code using the cmake-gui program in order to configure the project and generate the makefiles required for compiling. Finally, you will bring the configured project to your integrated development environment (ex. Visual Studio 2010) for compiling proper or to start your own development. So you should understand from this that your system needs some libraries to run the project demos just like any other piece of software usually does (and .dll files are used for this) and that before this can happen the project itself needs links to libraries and headers to build properly. Note that the resulting compiled libfreenect is itself a dll library which your computer will need to access in order to run the glview.exe demo for example. All of this should become quite clear as you go through the steps.

Getting the source files

There are 2 ways to get the latest source:

  1. Go to the OpenKinect project github, select the branch you want (master or unstable for instance - see below) and click the 'Download' button (then extract the files to a convenient location) or
  2. Use Git to create and keep an up to date project folder and access any branch locally:

Using Git

  • Download and install Git with these settings:
    • Accept the license etc.
    • Choose the level of shell integration you want
    • Choose 'Run git from the Windows Command prompt'
    • Choose 'Check out WIndows style, commit Unix-style line endings'
  • Open a Command Prompt, cd to the directory where you want the source folder (/libfreenect) created and type:
  • The contents of the libfreenect folder will interactively change as you checkout a specific branch (magic!) so you don't need to search for a specific 'branch' folder inside the libfreenect directory. Just checkout the branch you want to configure and proceed using the libfreenect folder as source in cmake. This setup allows you to easily switch between the master and unstable branch, update the source files and then configure the branch you want to build.
  • The 'git branch' command will show you the different branches (here master and unstable) and which one is currently selected. You can also view the development logs for the branch you're checking out with the 'git log' command (use shift-Q to exit the log).

Master vs. unstable branch

If you plan on changing libfreenect, writing wrappers, or trying the latest developments you might want to check out the unstable branch. Unstable has the latest commits that have not been fully tested yet. Otherwise just try the 'master' branch.

  • Take note that the master and unstable branches were synced on Jan. 6, 2011; see this update for more information.
  • On February the 15th, support for multiple resolutions was added to the unstable branch and the 1280x1024 RGB and IR mode was enabled as explained here.

After you have the source files, you should download the dependencies required to configure and build the library and then install the hardware driver...

Dependencies

For each required dependency, first download and install the libraries (.dll) on your system and then identify the paths to the libraries (.lib or .a) and header (.h) files which you will need later on to configure the source project using cmake:

Dependency Install Library/includes to be used with cmake (see this printscreen)
libusb-win32 - download and extract the latest libusb-win32-bin-x.x.x.x.zip NOTE: libusb-win32 1.2.5.0 changed the name of the include file. Please use libusb-win32 version 1.2.5.0 or higher. This will be taken care of when we install the driver in the next section The /lib and /include folders contain the libraries and header files required to configure the project; depending on the compiler you choose, you may have to specify a different library file:
  • For instance, to configure for MS Visual Studio 2010, use /lib/msvc/libusb.lib or if you plan to use mingw, use /lib/gcc/libusb.a as the libusb library path in cmake (LIBUSB_1_LIBRARY)
  • Select the path to the libusb header folder /include as libusb include path in cmake (LIBUSB_1_INCLUDE_DIR)

For more info see the libusb-win32 readme and their wiki

pthreads-win32 - download and extract the latest pthreads-w32-x-x-x-release.exe Find the /lib folder and copy the appropriate .dll library to /windows or /windows/system32 (see Library/includes to the right to figure out which one to use) The /lib and /include contain the libraries and header files required to configure the project; depending on the compiler you choose, you may have to specify a different library file:
  • For instance, to configure for MS Visual Studio 2010, use /lib/pthreadVC2.lib or if you plan to use mingw, use /lib/pthreadGC2.a as the pthread library path in cmake (THREADS_PTHREADS_WIN32_LIBRARY)
  • In both cases you will need to install the corresponding library .dll file to /windows/system32 i.e. phtreadVC2.dll or pthreadGC2.dll
  • Select the path to the pthread header folder /include as pthread include path in cmake (THREADS_PTHREADS_INCLUDE_DIR)

For more info see the pthreads-win32 readme and their FAQ

Glut - download and extract the latest glut-x.x.x-bin.zip Find the glut32.dll file and copy it to /windows/system or any directory included in your PATH system variable (see this explanation)
  • With MSVC, you should copy the glut.h header file to the /include/GL folder and the glut32.lib library to the /lib folder of your VC tree(for instance /Program Files/Microsoft Visual Studio 10.0/VC/) - if the GL folder is not there, create it and put the glut.h file there. If you built glut from source, the files should already be there.
  • In cmake-gui, supply the path to the header up to the /include folder (NOT ../include/GL) and the path to the library itself (../lib/glut32.lib) in cmake (GLUT_INCLUDE_DIR and GLUT_LIBRARY respectively)

For more info see the glut readme

Driver installation

There are two parts to libfreenect -- the low-level libusb-based device driver and libfreenect itself, the library that talks to the driver. You only need to install the driver once.

Windows 7: step-by-step walkthrough (should also work with Windows XP!)

  • Plug in your Kinect. Windows will warn that no device driver was found for the plugged device (the LED of Kinect will not turn on). If Windows presents a dialog asking to search for drivers, simply cancel it.
  • Open the Device Manager: Start >> Control Panel >> System and Security >> System >> Device Manager
  • A device called 'Xbox NUI Motor' should be somewhere there (most probably be under 'Other devices') with a small yellow warning symbol '!' on top of its icon. Right click on it, and select 'Update Driver Software...', then click on 'Browse my computer for driver software'.
  • 'Browse' and select the folder where the 'XBox_NUI_Motor.inf' is located (/platform/windows/inf inside your libfreenect source folder). Click 'Next' and if warned by Windows that a non-certified driver is about to be installed, just order it to install it anyway.
  • After that, the Kinect LED should start blinking green. Now there will be two additional devices in the Device Manager list: 'Xbox NUI Camera' and 'Xbox NUI Audio'. Repeat the above instructions for them as well.

You are now ready to configure libfreenect before building...

Configuring with cmake-gui

Follow these steps to configure libfreenect for compiling:

  1. Download Cmake (Cross-Platform Make) and make sure you have a working C compiler (Visual Studio 2010 or MinGW)
  2. Launch Cmake-GUI and select your /libfreenect folder as source, select an output folder, check the 'advanced' and 'grouped' checkboxes to display more variables and categorize them and then click on the 'Configure' button
  3. Select the C compiler you want to use
  4. Select the BUILD options you want, taking into consideration the following:
    1. For now only select the EXAMPLES and C_SYNC options in BUILD. The other build options such as FAKENECT have not been updated for Visual Studio yet
    2. But take a look at the following notes if you're interested in compiling the PYTHON wrapper
  5. Unresolved dependencies will show up as red in the CMake GUI. Supply the missing paths to the dependencies by following these guidelines, and click the 'Configure' button again:
    1. The *_LIBRARY variables need to point to actual .lib files not a folder
    2. INCLUDE variables need to point to the appropriate include directories
  6. When all errors have been resolved, click on the 'Generate' button to create the makefiles for your compiler.

Compiling

Now that the project is configured, open libfreenect.sln from your output folder and build it with Visual Studio. Then look for your compiled files in /bin and /lib

  • The freenect libraries in /lib are compiled but not installed at this point. To use them you should:
    • Add the path to the /lib folder to your system PATH environment variable or
    • Copy the libraries to a folder already in the system PATH like /windows/system32 or
    • Copy libraries to the folder of the program you want to run
  • If some items fail to compile the first time, simply right-click on the solution again and select 'Build' or 'Rebuild' to see if the missing items compile
  • If you're having issues compiling check out the readme in the /libfreenect/platform/windows folder for more information.

Testing

To do a quick test run /bin/glview.exe

  • It's also a good idea to check the wrappers section and the mailing list for more ideas and solutions...

User contributions

Retrieved from 'https://openkinect.org/w/index.php?title=Getting_Started&oldid=1909'
  • Contents
    • Setting Up The POCO C++ Libraries
      • External Dependencies
    • Some other Hints:

Welcome

Thank you for downloading the POCO C++ Libraries and welcome to the growing community of POCO C++ Libraries users. This document will help you in getting a smooth ride while installing and setting up the POCO C++ Libraries and going the first steps with the software.

Setting Up The POCO C++ Libraries

The POCO C++ Libraries are delivered in full source code only. Due to the large number of possible build configurations, no binary releases are provided from the project maintainers. This means that you have to build the libraries and tools before you can use them the first time.

Note: There are binary releases available as installation packages for various operating systems (e.g., Debian Linux, Ubuntu Linux, OpenBSD, OpenWRT, etc.). However, these packages are not maintained by the core team and may not always be up to date.

Up-to-date Conan packages are available via Bintray.

Source Code Distribution Format

The source code for the POCO C++ Libraries is delivered in a ZIP file for Windows users and/or in a compressed TAR file (.tar.gz or .tar.bz2) for Unix/Linux users. Both archives contain the same files, the only difference is that all text files in the ZIP files have line endings suitable for Windows (CR-LF), while the text files in the TAR file have line endings suitable for Unix/Linux (LF only). All libraries and tools follow a common convention for the directory layout. This directory layout is shown below.

Depending on what package you have downloaded (Basic or Complete Edition), there may be other libraries as well (such as Data, Crypto, NetSSL_OpenSSL and Zip).

External Dependencies

The following libraries require third-party software (header files and libraries) being installed to build properly:

  • NetSSL_OpenSSL and Crypt require OpenSSL.
  • Data/ODBC requires ODBC (Microsoft ODBC on Windows, unixODBC or iODBC on Unix/Linux)
  • Data/MySQL requires the MySQL client.

OpenSSL

Unix/Linux

Most Unix/Linux systems already have OpenSSL preinstalled, or OpenSSL can be easily installed using the system’s package management facility. For example, on Ubuntu (or other Debian-based Linux distributions) you can type

to install the necessary packages. If your system does not have OpenSSL, please get it from http://www.openssl.org/ or another source. You do not have to build OpenSSL yourself — a binary distribution is fine.

On macOS, it's recommended to install OpenSSL via Homebrew.

Windows

On Windows, there are three options:

  • Use POCO pre-built OpenSSL binaries (simplest and recommended)
  • Build OpenSSL using scripts from POCO distribution package
  • Use a third-party pre-built OpenSSL

POCO pre-built OpenSSL binaries

OpenSSL binaries (version 1.1.0) built with Visual Studio 2013 are available for download.

In case you are using pre-built binaries, please make sure to copy the entire directory to C:%POCO_BASE%openssl.

Or, %POCO_BASE%openssl directory can be deleted (if existing) and POCO openssl github repository cloned into it:

All libraries are located in their proper folders (eg. win64/bin/debug/), and all are named accordingly (libcrypto[mt[d]] and libssl[mt[d]]).

Build OpenSSL using scripts from POCO distribution package

Alternatively, if you choose to build your own OpenSSL, POCO C++ Libraries distribution package comes with scripts to build OpenSSL on Windows operating system. This requires Windows PowerShell.

Usage:

Example: Building OpenSSL 1.1.0, DLL release build for x64 with Visual Studio 2015:

The above command will download all the necessary packages (perl, nasm, etc) and build OpenSSL in C:%POCO_BASE%opensslbuild directory; the built OpenSSL binaries can be linked from EXEs and DLLs built with Visual Studio 2015 to 2019.

Pre-generated POCO Visual Studio projects are configured to use headers and libraries from C:%POCO_BASE%opensslbuild directory.

Use a third-party pre-built OpenSSL

Yet another way to install OpenSSL on Windows is to use a binary (prebuild) release, for example the one from Shining Light Productions that comes with a Windows installer (http://www.slproweb.com/products/Win32OpenSSL.html). Depending on where you have installed the OpenSSL libraries, you might have to edit the build script (buildwin.cmd), or add the necessary paths to the INCLUDE and LIB environment variables. You might also have to edit the project settings if the names of the OpenSSL libraries from your build differ from the names used in the project files.

ODBC

The Data library requires ODBC support on your system if you want to build the ODBC connector (which is the default). On Windows platforms, ODBC should be readily available if you have the Windows SDK installed. On Unix/Linux platforms, you can use iODBC or unixODBC. On Linux, use your distribution's package management system to install the necessary libraries and header files. For example, on Ubuntu, type

to install the iODBC library and header files.

The Data/ODBC and Data/MySQL Makefiles will search for the ODBC and MySQL headers and libraries in various places. Nevertheless, the Makefiles may not be able to find the headers and libraries. In this case, please edit the Makefile in Data/ODBC and/or Data/MySQL accordingly.

MySQL Client

The Data library requires the MySQL client libraries and header files if you want to build the MySQL connector (which is the default). On Windows platforms, use the MySQL client installer to install the necessary files. On Unix/Linux platforms, use the package management system of your choice to install the necessary files. Alternatively, you can of course build MySQL yourself from source.

Building using CMake

Downloading

As an alternative to the platform specific Makefiles and Solutions, CMake can be used to do build POCO C++ Libraries on any platform with any compiler. CMake is a meta build system and it generate native makefiles and workspaces that can be used in the compiler environment of your choice. For a quick overview see http://cgold.readthedocs.io/en/latest/overview/cmake-can.html

POCO C++ Libraries requires CMake 3.2 or higher. Static binaries for many platforms can be downloaded from http://www.cmake.org/

CMake supports out of source builds and this is the recommended way to build POCO C++ Libraries using CMake.

Assuming the POCO C++ Libraries source is located in /path/to/poco directory and you like to build POCO C++ Libraries just type the following commands (Command parameters are all the same on any platform).

This will build POCO C++ Libraries in a subdirectory poco-build. All files produced during build are located in this directory.

Some cmake basic parameters:

For Makefile (default on Unix systems) and Ninja based build system (and all other single-configuration generators), there exists following build types: * Debug * Release * RelWithDebInfo (Release build with Debug infos) * MinSizeRel (Release build with size optimisation)

As default, POCO is build RelWithDebInfo. See cmake output like:

You can change this with following parameter: CMAKE_BUILD_TYPE=....

For example to build with debug symbols:

For more infos see https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type

For multi-configuration generators, (like Visual Studio and Xcode), CMAKE_BUILD_TYPE is ignored!

For these you should set build type at build time:

For example to build with debug symbols:

Installation path of Poco is as defaults to /usr/local on UNIX and c:/Program Files/Poco on Windows.

You can change the path with following parameter: CMAKE_INSTALL_PREFIX=....

For example to install in /usr:

This will install the poco libs in /usr/lib and the binaries in /usr/bin etc.

See also cmake output like:

For more infos see https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html?highlight=cmake_install_prefix

To set libraries type, you can use following parameter: BUILD_SHARED_LIBS=[ON/OFF]

As default, Poco build dynamic libraries, see cmake output like:

To set some additional compiler flags, you can use following parameters:

Downloading Command Line Tools For Xcode Homebrew

* CMAKE_C_FLAGS For C compiler * CMAKE_CXX_FLAGS For C++ compiler

For example:

For default compile flags, see cmake output like:

Downloading Command Line Tools For Xcode Homebrew Tutorial

For more infos see https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html#variable:CMAKE_%3CLANG%3E_FLAGS

To use the compiler of your choice, you can use following paramters:

  • CMAKE_C_COMPILER C compiler
  • CMAKE_CXX_COMPILER C++ compiler

For example to use the clang compiler, execute following cmake command:

To cross compile POCO C++ Libraries for another architecture/device you should have a cmake toolchain file and execute following command:

See https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html for more information.

Poco special build parameters:

POCO C++ Libraries allows you to set some build time options. As an example: to disable the SevenZip support type the following command:

Here an overview of POCO build options:

  • ENABLE_XML Set to OFF|ON (default is ON) to build XML support library
  • ENABLE_JSON Set to OFF|ON (default is ON) to build JSON support library
  • ENABLE_NET Set to OFF|ON (default is ON) to build Net support library
  • ENABLE_NETSSL Set to OFF|ON (default is ON) to build NetSSL support library (Need installed openssl libraries)
  • ENABLE_CRYPTO Set to OFF|ON (default is ON) to build Crypto support library (Need installed openssl libraries)
  • ENABLE_DATA Set to OFF|ON (default is ON) to build Data support library
  • ENABLE_DATA_SQLITE Set to OFF|ON (default is ON) to build Data SQlite support library
  • ENABLE_DATA_MYSQL Set to OFF|ON (default is ON) to build Data MySQL or MariaDB support library (Need installed MySQL or MariaDB client libraries)
  • ENABLE_DATA_POSTGRESQL Set to OFF|ON (default is ON) to build SQL PosgreSQL support library (Need installed PostgreSQL client libraries)
  • ENABLE_DATA_ODBC Set to OFF|ON (default is ON) to build Data ODBC support library (Need installed ODBC libraries)
  • ENABLE_MONGODB Set to OFF|ON (default is ON) to build MongoDB support library
  • ENABLE_REDIS Set to OFF|ON (default is ON) to build Redis support library
  • ENABLE_PDF Set to OFF|ON (default is OFF) to build PDF support library
  • ENABLE_UTIL Set to OFF|ON (default is ON) to build Util support library
  • ENABLE_ZIP Set to OFF|ON (default is ON) to build Zip support library
  • ENABLE_SEVENZIP Set to OFF|ON (default is OFF) to build SevenZip support library
  • ENABLE_APACHECONNECTOR Set to OFF|ON (default is ON) to build ApacheConnector support library (Need installed apache and apr libraries)
  • ENABLE_CPPPARSER Set to OFF|ON (default is OFF) to build C++ parser
  • ENABLE_ENCODINGS Set to OFF|ON (default is ON) to build with Encodings
  • ENABLE_ENCODINGS_COMPILER Set to OFF|ON (default is OFF) to build Encodings Compiler
  • ENABLE_PAGECOMPILER Set to OFF|ON (default is ON) to build PageCompiler
  • ENABLE_PAGECOMPILER_FILE2PAGE Set to OFF|ON (default is ON) to build File2Page
  • ENABLE_POCODOC Set to OFF|ON (default is OFF) to build Poco Documentation Generator
  • ENABLE_TESTS Set to OFF|ON (default is OFF) to build Unit tests
  • ENABLE_LONG_RUNNING_TESTS Set to OFF|ON (default is ON) to use long running test
  • POCO_UNBUNDLED Set to OFF|ON (default is OFF) to control linking dependencies as external

Windows only parameter:

  • POCO_MT Set to OFF|ON (default is OFF) to control build of POCO as /MT instead of /MD
  • ENABLE_MSVC_MP Set to OFF|ON (default is OFF) to control parallel build of POCO with MSVC
  • ENABLE_NETSSL_WIN Set to OFF|ON (default is OFF) to build NetSSL support library(Need installed openssl libraries For Windows only)

You can also see and enable or disable available options execute following command:

or for console only:

POCO C++ Libraries options are prefixed with ENABLE_. (This will be changed in POCO 2.x.x to POCO_)

Third-party library location

If a third-party library is not installed in a default location, cmake will fail to run. There exists following parameters to set additional search paths for cmake to find third-party libraries:

Downloading Command Line Tools For Xcode Homebrew Installer

To find PostgreSQL:

  • PostgreSQL_ROOT_DIR - Set root installation path where to find include path and libraries of PostgreSQL or
  • PostgreSQL_ROOT_INCLUDE_DIRS - Set include paths where to find PostgreSQL headers
  • PostgreSQL_ROOT_LIBRARY_DIRS - Set library paths where to find PostgreSQL libraries

To find ODBC:

  • ODBC_ROOT_DIR - Set root installation path where to find include path and libraries of ODBC or
  • ODBC_ROOT_INCLUDE_DIRS - Set include paths where to find ODBC headers
  • ODBC_ROOT_LIBRARY_DIRS - Set library paths where to find ODBC libraries

To find MySQL or MariaDB:

  • MYSQL_ROOT_DIR - Set root installation path where to find include path and libraries of MySQL or MariaDB or
  • MYSQL_ROOT_INCLUDE_DIRS - Set include paths where to find MySQL or MariaDB headers
  • MYSQL_ROOT_LIBRARY_DIRS - Set library paths where to find MySQL or MariaDB libraries
  • APRUTIL_ROOT_DIR - Set root installation path where to find include path and libraries of apr util or
  • APRUTIL_ROOT_INCLUDE_DIRS - Set include paths where to find apr util headers
  • APRUTIL_ROOT_LIBRARY_DIRS - Set library paths where to find apr util libraries
  • APR_ROOT_DIR - Set root installation path where to find include path and libraries of apr or
  • APR_ROOT_INCLUDE_DIRS - Set include paths where to find apr headers
  • APR_ROOT_LIBRARY_DIRS - Set library paths where to find apr libraries
  • APACHE2_ROOT_DIR - Set root installation path where to find include path and libraries of apache2 or
  • APACHE2_ROOT_INCLUDE_DIRS - Set include paths where to find apache2 headers

For example set installation path of MySQL:

or

How to use POCO in your cmake project:

To use POCO C++ Libraries in your cmake project, add following line in your project for example to use crypto:

If you get an error like 'By not providing 'FindPoco.cmake', then you should set CMAKE_PREFIX_PATH to the installation directory of your POCO C++ Libraries. For example:

Some other Hints:

For a faster build, use ninja as build system. See https://ninja-build.org/ For example on Ubuntu execute following commands:

This install ninja command. To use ninja-build execute following cmake commands:

See https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html for other generators.

To enable verbose output from Makefile builds, execute following cmake commands:

Some more infos about cmake see:

$ cmake —help-full https://cmake.org/cmake/help/latest/ http://cgold.readthedocs.io/en/latest/index.html

Building On Windows

Microsoft Visual Studio 2015 or newer is required to build the POCO C++ Libraries on Windows platforms. Solution and project files for all versions are included. 64-bit (x64) builds are supported as well. You can either build from within Visual Studio (Build->Batch Build->Select All;Rebuild) or from the command line. To build from the command line, start the Visual Studio 2015 (or 2017, 2019, etc.) Command Prompt and go (cd) to the directory where you have extracted the POCO C++ Libraries sources. Then, simply start the buildwin.cmd script and pass as argument the version of Visual Studio (140, 150, 160). You can customize what is being built by buildwin.cmd by passing appropriate command line arguments to it. Call buildwin.cmd without arguments to see what is available. Build environment is set up by the buildwin.cmd; to avoid build problems, it is recommended to start the build in a clean command prompt console, i.e. not in the one provided by Visual Studio for 32/64-bit builds (although those will work fine if used appropriately for the right 32/64-bit build type).

To disable certain components (e.g., NetSSL_OpenSSL or Data/MySQL) from the build, edit the text file named components in the distribution root directory and remove or comment the respective lines.

Certain libraries, like NetSSL_OpenSSL, Crypto or Data/MySQL have dependencies to other libraries. Since the build script does not know where to find the necessary header files and import libraries, you have to either add the header file paths to the INCLUDE environment variable and the library path to the LIB environment variable, or you'll have to edit the buildwin.cmd script, where these environment variables can be set as well.

In order to run the test suite and the samples, the top-most bin directory containing the resulting shared libraries must be in the PATH environment variable.

Building On Unix/Linux/macOS

For building on Unix platforms, the POCO C++ Libraries come with their own build system. The build system is based on GNU Make 3.80 (or newer), with the help from a few shell scripts. If you do not have GNU Make 3.80 (or newer) installed on your machine, you will need to download it from http://directory.fsf.org/devel/build/make.html and build and install it prior to building the POCO C++ Libraries.

You can check the version of GNU Make installed on your system with

or

Once you have GNU Make up and running, the rest is quite simple. To extract the sources and build all libraries, testsuites and samples, simply

For help, either invoke

Alternatively, you can read the configure script source for a list of possible options. For starters, we recommend <[--no-tests and <[--no-samples, to reduce build times. On a multicore or multiprocessor machine, use parallel makes to speed up the build (make -j4).

Once you have successfully built POCO, you can install it to <*/usr/local (or another directory specified as parameter to configure <[--prefix=<path>):

You can omit certain components from the build. For example, you might want to omit Data/ODBC or Data/MySQL if you do not have the corresponding third-party libraries (iodbc or unixodbc, mysqlclient) installed on your system. To do this, use the <[--omit argument to configure:

IMPORTANT: Make sure that the path to the build directory does not contain symbolic links. Furthermore, on macOS (or other systems with case insensitive filesystems), make sure that the characters in the path have the correct case. Otherwise you'll get an error saying 'Current working directory not under $PROJECT_BASE.'.

Building On QNX Neutrino

For QNX Neutrino, the Unix build system (see the instructions above) is used. You can use the build system to cross-compile for a target platform on a Solaris or Linux host. Unfortunately, the Cygwin-based Windows host environment has some major quirks that prevent the build system from working there. You can also use the build system on a self-hosted QNX system. The default build configuration for QNX (found in build/config/QNX) is for a self-hosted x86 platform. To specify another target, edit the CCVER setting in the build configuration file. For example, to compile for a PowerPC target, specify CCVER=3.3.1,gcc_ntoppcbe.

Service Pack 1 for QNX Neutrino 6.3 must be installed, otherwise compiling the Foundation library will fail due to a problem with the <*<list> header in the default (Dinkumware) C++ standard library.

When building on QNX, you might want to disable NetSSL_OpenSSL, Crypto and some Data connectors, unless you have the necessary third party components available:

Tutorials And Sample Code

Introductory documentation consisting of various documents and tutorials in the form of slide decks can be found at the POCO C++ Libraries Documentation page.

Sample applications demonstrating the various features of the POCO C++ Libraries are delivered with the source code. Every library's source code directory has a samples directory containing various sample applications.

When building the sample applications on platforms using the gmake-based build system, please make sure that the environment variable POCO_BASE contains the path to the POCO C++ Libraries source tree root directory.

Downloading Command Line Tools For Xcode Homebrew Command

Creating Your Own POCO-based Applications

The best way to create your first POCO-based application is by copying one of the sample projects and making the desired changes. Examine the project files and Makefiles to see what compiler options must be set for your specific platform.

Applied Informatics C++ Libraries and Tools 1.10.1-all
Copyright © 2021, Applied Informatics Software Engineering GmbH and Contributors