Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-68742

WIN64: 'cast between incompatible function types ... [-Werror=cast-function-type]' errors for builds using mingw-w64 8.1.0

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.12
    • Core: Other
    • None

    Description

      Hello, everyone,

      For builds using mingw-w64 got error:

      g++ -c -fno-keep-inline-dllexport -O2 -std=c++1y -ffunction-sections -fdata-sections -fno-exceptions -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -Werror -Wno-error=cpp -Wno-error=deprecated-declarations -Wno-error=strict-overflow -Wno-error=implicit-fallthrough -DUNICODE -D_UNICODE -DWIN32 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_VERSION_STR="\"5.12.0\"" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=12 -DQT_VERSION_PATCH=0 -DQT_BOOTSTRAPPED -DQT_NO_CAST_TO_ASCII -DQT_NO_FOREACH -DQT_NO_CAST_FROM_ASCII -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_BOOTSTRAP_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_FORCE_ASSERTS -I. -I..\..\..\include -I..\..\..\include\QtCore -I..\..\..\include\QtCore\5.12.0 -I..\..\..\include\QtCore\5.12.0\QtCore -I..\..\..\include\QtXml -I..\..\..\include\QtXml\5.12.0 -I..\..\..\include\QtXml\5.12.0\QtXml -Itmp -I..\..\..\mkspecs\win32-g++  -o .obj\release\qoperatingsystemversion_win.o ..\..\corelib\global\qoperatingsystemversion_win.cpp
      ..\..\corelib\global\qoperatingsystemversion_win.cpp: In function 'OSVERSIONINFOEX determineWinOsVersion()':
      ..\..\corelib\global\qoperatingsystemversion_win.cpp:100:48: error: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'RtlGetVersionFunction' {aka 'long int (*)(_OSVERSIONINFOW*)'} [-Werror=cast-function-type]
               GetProcAddressA(ntdll, "RtlGetVersion"));
                                                      ^
      cc1plus.exe: all warnings being treated as errors
      mingw32-make[1]: Leaving directory 'c:/libQT-5.12-dev/build/qtbase'
      mingw32-make: *** [Makefile:81: module-qtbase-make_first] Error 2

      which is a known issue for builds using GCC 8.x (see --QTBUG-68330--).

      If '-Wno-error=cast-function-type' flag added to mingw-w64 mkspecs to bypass this issue, next blocker appear:

      mingw32-make[3]: Entering directory 'c:/libQT-5.12-dev/build/qtbase/src/network'
      mingw32-make -f Makefile.Release
      mingw32-make[4]: Entering directory 'c:/libQT-5.12-dev/build/qtbase/src/network'
      g++ -c -fno-keep-inline-dllexport -Wno-error=cast-function-type -DOPENSSL_API_COMPAT=0x10100000L -O2 -std=c++1y -fno-exceptions -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -Werror -Wno-error=cpp -Wno-error=deprecated-declarations -Wno-error=strict-overflow -Wno-error=implicit-fallthrough -DUNICODE -D_UNICODE -DWIN32 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_USE_SYSTEM_PROXIES -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_NETWORK_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_FORCE_ASSERTS -DQT_CORE_LIB -I. -Ikernel -I..\..\include -I..\..\include\QtNetwork -I..\..\include\QtNetwork\5.12.0 -I..\..\include\QtNetwork\5.12.0\QtNetwork -Itmp -I..\..\include\QtCore\5.12.0 -I..\..\include\QtCore\5.12.0\QtCore -I..\..\include\QtCore -I.moc\release -Ic:\libOPENSSL-1.1.1-dev\GCC64RH\include -I..\..\mkspecs\win32-g++  -o .obj\release\qnetworkaccessdebugpipebackend.o access\qnetworkaccessdebugpipebackend.cpp
      In file included from ..\..\include/QtCore/qdatastream.h:1,
                       from access\qnetworkaccessdebugpipebackend.cpp:41:
      ..\..\include/QtCore/../../src/corelib/serialization/qdatastream.h:349:21: error: 'QDataStream& QDataStream::operator>>(quint32&)' redeclared without dllimport attribute after being referenced with dll linkage [-Werror]
       inline QDataStream &QDataStream::operator>>(quint32 &i)
                           ^~~~~~~~~~~
      ..\..\include/QtCore/../../src/corelib/serialization/qdatastream.h:361:21: error: 'QDataStream& QDataStream::operator<<(quint32)' redeclared without dllimport attribute after being referenced with dll linkage [-Werror]
       inline QDataStream &QDataStream::operator<<(quint32 i)
                           ^~~~~~~~~~~
      cc1plus.exe: all warnings being treated as errors
      mingw32-make: *** [Makefile:81: module-qtbase-make_first] Error 2
      

       

      UPDATE: A none developer builds also proved to be broken:

      mingw32-make[4]: Entering directory 'c:/libQT-5.12-dev/build/qtbase/src/gui'
      g++ -c -fno-keep-inline-dllexport -O3 -std=c++1y -fno-exceptions -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -DUNICODE -D_UNICODE -DWIN32 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_GUI_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_FORCE_ASSERTS -DQT_CORE_LIB -I. -I..\..\include -I..\..\include\QtGui -I..\..\include\QtANGLE -I..\..\include\QtGui\5.12.0 -I..\..\include\QtGui\5.12.0\QtGui -Itmp -I.tracegen\release -I..\..\include\QtCore\5.12.0 -I..\..\include\QtCore\5.12.0\QtCore -I..\..\include\QtCore -I.moc\release -I"C:\Program Files (x86)\VulkanSDK\include" -I..\3rdparty\libpng -I..\3rdparty\harfbuzz-ng\include -I..\..\mkspecs\win32-g++  -o .obj\release\qpnghandler.o image\qpnghandler.cpp
      In file included from ..\..\include/QtCore/qdatastream.h:1,
                       from ..\..\include/QtGui/../../src/gui/painting/qregion.h:49,
                       from ..\..\include/QtGui/qregion.h:1,
                       from ..\..\include/QtGui/../../src/gui/painting/qmatrix.h:45,
                       from ..\..\include/QtGui/qmatrix.h:1,
                       from ..\..\include/QtGui/../../src/gui/painting/qtransform.h:43,
                       from ..\..\include/QtGui/qtransform.h:1,
                       from ..\..\include\QtGui/../../src/gui/image/qimage.h:48,
                       from ..\..\include\QtGui/qimage.h:1,
                       from image\qpnghandler.cpp:46:
      ..\..\include/QtCore/../../src/corelib/serialization/qdatastream.h:349:21: warning: 'QDataStream& QDataStream::operator>>(quint32&)' redeclared without dllimport attribute after being referenced with dll linkage
       inline QDataStream &QDataStream::operator>>(quint32 &i)
                           ^~~~~~~~~~~
      ..\..\include/QtCore/../../src/corelib/serialization/qdatastream.h:361:21: warning: 'QDataStream& QDataStream::operator<<(quint32)' redeclared without dllimport attribute after being referenced with dll linkage
       inline QDataStream &QDataStream::operator<<(quint32 i)
                           ^~~~~~~~~~~
      mingw32-make: *** [Makefile:81: module-qtbase-make_first] Error 2
      

      Reproduced for:

      • builds using mingw-w64 8.1.0,

      not reproduced for:

      • builds using mingw-w64 7.3.0,
      • builds using MSVC.

       

      CC: villevoutilainen_qt.

       

      Best,

      Alexander

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              sav sav
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews