I’ve been evaluating some new libraries lately and as usual, I decided to take some notes.
POCO seems to be a nice complete C++ library filled with things that other languages like Python and Java have. It’s very feature filled, but it’s unfortunately obvious that the development team doesn’t spend much time working or testing on Windows (and when they do, it’s with MSVC). There is a MinGW build, but as of POCO 1.4.5 it’s designed for Cygwin MinGW, which is a variation of MinGW that you invoke with “-mno-cygwin” to remove dependence on the Cygwin libraries. No good for a pure MinGW+MSys user like myself.
So, I had to make the following changes to build/config/MinGW:
- Removed both instances of -mno-cygwin (SYSFLAGS, SYSLIBS)
- Remove -I/usr/include from SYSFLAGS and -L/usr/lib from SYSLIBS
- Add -I/usr/local/ssl/include to SYSFLAGS and -L/usr/local/ssl/lib to SYSLIBS
#1 I’ve explained. MinGW+MSys does not support -mno-cygwin, and raises an error. Oops. 🙂
#2 is the search paths of the MSys libraries, not the MinGW ones. POCO relies on iconv, which is an internationalization library that is implemented slightly differently for MSys. We don’t want to use the MSys version. With that in mind, we probably need to install iconv for MinGW. From your MSys shell, do the following:
mingw-get install libiconv
After a brief download, you’ll now have the MinGW version of iconv.
#3 is where OpenSSL installs itself, unusually, inside its own directory tree. If you want to SSL support, you will need to download and install OpenSSL. Latest sources are here:
Then OpenSSL is a typical “./configure; make; make install” package. TIP: If you have a multi-core CPU, doing “make -j 2” builds using 2 cores, and “make -j 4” builds using 4 cores.
Great. We’re now done with the setup, so it’s time to invoke the configure script.
Now unfortunately, at least with POCO 1.4.5, the testsuite and samples are again not set up properly for MinGW+MSys, so they need to be disabled. So, your “./configure; make; make install” should look something like this:
./configure --no-tests --no-samples make -j 2 make install
The “-j 2” is optional, but most of us have multi-core CPU’s, so it should cut your build times in half.
And that’s it. POCO should now be installed in /usr/local/include/Poco. Go read the docs:
Link -lPocoFoundation -lPocoNet -lPocoUtil -lPocoXML as needed.
If you don’t already, be sure to use -I/usr/local/include on your compiles and -L/usr/local/lib on your linking, since MinGW does not add those paths by default (since MinGW is designed to be standalone).
The Apache Portable Runtime (APR) is another library I was looking in to. It’s C based, and used heavily in the Apache Web server. It consists of 3 packages: APR, APR-util, APR-iconv. For whatever reason I had no troubles building APR, but the other two. After a bit of digging, I seemed to come across some discussion that said fixes for MinGW were part of the upcoming 1.5 build (1.4 currently available).
I’m not quite interested in working with such a bleeding edge library though, so for the time being I’ve put APR aside.