Menu

#324 MinGW32 build broken for 1.2.0-RC6

v1.2.0
closed
5
2016-01-08
2016-01-08
Tim D'Avis
No

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);

Discussion

  • Václav Haisman

    Václav Haisman - 2016-01-08

    This has already been reported to me from somebody else. Please try to replace the function with InterlockedExchangeAdd and report back if it works. From my searches it seems it might be available even on older MinGW.

     
  • Václav Haisman

    Václav Haisman - 2016-01-08
    • labels: --> mingw, build
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,13 +1,17 @@
     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.
    +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);
    +~~~
    +
    
     
  • Tim D'Avis

    Tim D'Avis - 2016-01-08

    It works when i replace InterlockedAdd with InterlockedExchangeAdd. InterlockedExchangeAdd does return the initial value of the first paramter, instead of the result of the addition, but in this case it should be ok?

     
    • Václav Haisman

      Václav Haisman - 2016-01-08

      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), however InterlockedAnd seems to be also one of the functions added later to MinGW.

       
    • Václav Haisman

      Václav Haisman - 2016-01-08
       
  • Václav Haisman

    Václav Haisman - 2016-01-08
    • labels: mingw, build --> mingw, build, fixed
    • status: open --> closed
     

Log in to post a comment.