Installing log4cxx on MSYS2/Mingw-w64
In my previous post, I gave the rather simple steps to install MSYS2/Mingw-w64. Now I will tell you how to install a custom library, specifically log4cxx.
Before starting, lets acknowledge that there are other libraries that might fit your logging needs. The installation steps will be similar, though here we specifically focus on log4cxx.
There are generic installation steps given at log4cxx website also, but they don’t work as of today (19-08-2017).
- Download and untar/unzip latest stable version of log4cxx in your home directory.
- Configure the build environment and satisfy all dependencies:
Shell12$ pacman -S mingw-w64-x86_64-expat mingw-w64-x86_64-apr mingw-w64-x86_64-apr-util$ ./configure --prefix=/mingw64/
- Now start the compilation:
Shell1$ make && make install
- If you are like me and have downloaded apache-log4cxx-0.10.0.tar.gz, your compilation will fail. Fear not, for it is a known issue with GCC and two patches from following bug reports fix it: LOGCXX-400 and LOGCXX-482. I have provided them here for your convenience.:
You can apply them using patch:Shell123$ pacman -S patch$ cat 170-gcc6-fix.patch | patch -p1$ cat domtestcase.cpp.patch | patch -p1
- Now continue with step 3.
That’s it. Enjoy 😉