POCO is a lightweight, multiplatform open-source set of libraries and C ++ classes that facilitate the writing of multiplatform software.
Available under the Boost Software License.
More information about POCO:
pocoproject.org/features.html
ru.wikipedia.org/wiki/POCO
Well-organized class structure documentation is available in html online, html offline.
Documentation on basic features with examples of use - in pdf:
pocoproject.org/documentation/index.html
POCO has the richest functionality - a lot - everything that is needed for a happy life of a C ++ programmer! The toolkit works perfectly, it has a well thought-out API.
POCO is collected for a large number of OS, incl. Desktop Windows, Windows CE, Linux.
')
From my own experience, I note that POCO for these OS is going without problems.
I will try to you, dear C ++ developers, in my three articles "Cross-compile POCO from Windows."
The article “Cross-compile POCO from Windows for WinCE”
habrahabr.ru/post/223157
Cross-compile POCO from Windows for Linux
The method was developed:
- for cross-platform toochain terminal Spire (ARM9)
- Windows 7 host machine 64
- POCO Basic Edition 1.4.6p4
Collect POCO for dynamic connection (result is
*.so
files) or for static connection (result is
*.a
files)
POCO preparation
Prepare a directory with POCO:
- download at
pocoproject.org/download/index.html the POCO archive of the latest stable version of the Basic Edition. By the button "Sources for Linux, OS X, etc.". At the time of this writing, the archive is poco-1.4.6p4.tar.gz
- unzip to a separate directory. For example, using WinRAR and in the directory C: /poco/poco-1.4.6p4.
Prepare a build description file for Unix platforms.
This file will be used by the configure command to define the environment (the name of the toolchain utilities and other parameters for building makefiles)
- find the file "ARM-Linux" in C: /poco/poco-1.4.6p4/build/config/ and copy it with a different name, for example with the name of your platform. I assigned the name ARM-Linux-Spire.
Attention! This name will be used in the “Build POCO” step.
Information on the assembly description file and the build system:
http://pocoproject.org/docs/99150-GMakeBuildNotes.html
Edit our ARM-Linux - *** file in a text editor (I used Notepad ++):
1) Find and comment out the lines
STLPORT_INCLUDE= , STLPORT_LIB= , OPENSSL_INCLUDE= , CFLAGS=
. It should turn out like this:
#STLPORT_INCLUDE = /usr/local/include/stlport
#STLPORT_LIB = /usr/local/lib
#OPENSSL_INCLUDE = /usr/local/arm/2.95.3/include
#OPENSSL_LIB = /usr/local/arm/2.95.3/lib
#CFLAGS = -Isrc
2) From
SYSFLAGS =
remove
-I$(STLPORT_INCLUDE) -I$(OPENSSL_INCLUDE)
It should turn out like this:
#SYSFLAGS = -I$(STLPORT_INCLUDE) -I$(OPENSSL_INCLUDE) -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_REENTRANT -D_THREAD_SAFE -DPOCO_NO_FPENVIRONMENT
SYSFLAGS = -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_REENTRANT -D_THREAD_SAFE -DPOCO_NO_FPENVIRONMENT
3) From
SYSLIBS =
remove
-L$(STLPORT_LIB) -L$(OPENSSL_LIB) -lstlport_arm-linux-gcc
It should turn out like this:
#SYSLIBS = -L$(STLPORT_LIB) -L$(OPENSSL_LIB) -lstlport_arm-linux-gcc -lpthread -ldl -lrt
SYSLIBS = -lpthread -ldl -lrt
4) Find the line
TOOL = arm-linux
and change
arm-linux
to the prefix of the toolchain utilities from your hardware.
I changed it like this:
TOOL = arm-unknown-linux-gnu
Typically, a cross-platform development toolchain for a Linux device comes with the hardware.
This is a simple archive with utilities from the GCC suite (
ru.wikipedia.org/wiki/GNU_Compiler_Collection ).
To find out the name of the prefix, go to the toolchain directory / bin, and pay attention to the file
*-gcc.exe
or
*-g++.exe
For example, my toolchain contains files:
arm-unknown-linux-gnu-gcc.exe
arm-unknown-linux-gnu-g++.exe
so for my toolchain the prefix is
arm-unknown-linux-gnu
.
5) Find the string
POCO_TARGET_OSARCH = ARM
and assign an arbitrary name, which during the build will be used to create directories with the results of the build. I assigned the name
POCO_TARGET_OSARCH = ARM_Spire
to reflect the meaningful name of the platform. Therefore, my POCO libraries after assembly will be located in
C:\poco\poco-1.4.6p4\lib\Linux\ARM_Spire
.
6) Let's pay attention to setting the result of the assembly:
If you compile POCO for dynamic connection:
LINKMODE
must stand in
SHARED
, and for static connection:
LINKMODE
must be in
STATIC
Preparation of tools
Install tools:
- MinGW msys. We will use msys shell. My MinGW was bundled with sdk for the device, and you can get from the official site
www.mingw.org
- any console for Windows with copy-paste support. The author used ConEmu x64
www.conemu.ru
Open the console with copy-paste support, all further steps will be from this console.
Check the availability of the toochain / bin directory, enter the name of the gcc utility from your toochain. I have so:
arm-unknown-linux-gnu-gcc -v
- if this utility is not found, then set the path to it. My path is:
set PATH=C:\Spire\SDT\TOOLCHAIN\20140226\bin;%PATH%
- again check availability toochain
Check the availability of the make utility:
make -v
- if this utility is not found, then set the path to it. My path is:
set PATH=C:\Spire\SDT\MinGW\bin;%PATH%
- check availability again
Log in to the msys shell, run:
sh
- if this utility is not found, then set the path to it. My path is:
set PATH=C:\Spire\SDT\MinGW\msys\1.0\bin;%PATH%
All further steps will be performed from the console with support for copy-paste + msys command shell.
Set the directory with the current POCO:
cd C:/poco/poco-1.4.6p4
POCO build
Before assembling (for order), you can check the availability of the configurator
./configure --help
POCO configuration:
./configure --config=ARM-Linux-Spire
or, for assembling a POCO without tests and examples:
./configure --config=ARM-Linux-Spire --no-tests --no-samples
if the configuration is successful, you will see something like this:
Configured for ARM-Linux-Spire
- to build POCO:
make
POCO build time with tests and examples on my PC (Intel i5 3.300Gz 8Gb) took 12 minutes.
The compiled POCO libraries will be located in
\lib\Linux
in the directory that we defined in the
POCO_TARGET_OSARCH
variable in the configuration settings file.
My path to the compiled POCO libraries was this:
C:\poco\poco-1.4.6p4\lib\Linux\ARM_Spire
Possible problems
I had problems not directly related to POCO:
-The project with static POCO was not allowed dependencies in the
AtomicCounter
class from
__sync_add_and_fetch, __sync_fetch_and_add, __sync_sub_and_fetch, __sync_fetch_and_sub
Solution: add to
SYSFLAGS = ... -DPOCO_NO_GCC_ATOMICS
to use another implementation of
AtomicCounter
.
-The project with static POCO is successfully assembled, but when the executable program is launched on the device, the console issues:
/lib/libgcc_s.so.1: version 'GCC_4.3.0' not found (required by )
This is due to the different versions of
libgcc
on the device and the toolchain on the host machine. Solution: link to the executable program library
libgcc
.
The cardinal way to find the causes of problems associated with the assembly of POCO: connect the source code to the executable POCO file and try to build in the file.
Information sources
GNU Make Build System POCO C ++ Libraries
pocoproject.org/docs/99150-GMakeBuildNotes.html
***
Ready-made tools with ++ make our work more enjoyable and more fruitful. Successes, dear colleagues!
Vladislav Khokhryakov.