The build fails for me under Windows 10 using MinGW32 4.9.2 32bit (from Qt 5.5.1) on an Intel CPU.
The build fails in socket-win32.cxx Line 92, because InterlockedAdd is not defined.
I can see that it is defined in winnt.h but only for AMD64.
See also here:
http://stackoverflow.com/questions/14603407/why-interlockedadd-is-not-available-in-vs2010
Here is the compiler output:
g++ -c -pipe -fno-keep-inline-dllexport -g -O0 -fprofile-arcs -ftest-coverage -Wno-deprecated -Wno-unused-variable -g -std=c++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DDEBUGVERSION -DUNICODE -D_UNICODE -DUMBCS -DU_MBCS -DLOG4CPLUS_BUILD_DLL -DINSIDE_LOG4CPLUS -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -Iinclude -IC:\Qt\Qt5.5.1\5.5\mingw492_32\include -IC:\Qt\Qt5.5.1\5.5\mingw492_32\include\QtGui -IC:\Qt\Qt5.5.1\5.5\mingw492_32\include\QtANGLE -IC:\Qt\Qt5.5.1\5.5\mingw492_32\include\QtCore -Idebug -IC:\Qt\Qt5.5.1\5.5\mingw492_32\mkspecs\win32-g++ -o debug\socket-win32.o src\socket-win32.cxx
src\socket-win32.cxx: In function 'void {anonymous}::init_winsock_worker()':
src\socket-win32.cxx:92:59: error: 'InterlockedAdd' was not declared in this scope
LONG state = InterlockedAdd (&winsock_state, 0);
This has already been reported to me from somebody else. Please try to replace the function with
InterlockedExchangeAddand report back if it works. From my searches it seems it might be available even on older MinGW.Diff:
It works when i replace
InterlockedAddwithInterlockedExchangeAdd.InterlockedExchangeAdddoes return the initial value of the first paramter, instead of the result of the addition, but in this case it should be ok?Yes, it should be OK. The point of that statement is to load the value and avoid warnings from Visual Studio analyzer. Another alternative would be something like
InterlockedAnd(&x, 0xFFFFFFFF), howeverInterlockedAndseems to be also one of the functions added later to MinGW.Fixed by https://github.com/wilx/log4cplus/commit/3636758821e8c3c393644e5c25bd057e392b5445.