Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QT 4.8.5 compile issues using MinGW GCC 4.8.1

Tags:

mingw

qt4

So I'm trying to build my development environment in Qt, like I have done many, many times in the past. I am starting from a completely clean OS install and I have the latest MinGW and MSYS packages from the website. I obtained the Qt 4.8.5 sources via git, exporting the tag for v4.8.5. The entire Qt library is building fine, but when it goes to build the plugins, it fails on the nativewifi plugin with very low-level type errors.

(output of "mingw32-make sub-plugins"; the rest of the modules have already built successfully)

cd src\plugins\ && mingw32-make -f Makefile
mingw32-make[1]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins'
cd sqldrivers\ && mingw32-make -f Makefile 
mingw32-make[2]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers'
cd mysql\ && mingw32-make -f Makefile 
mingw32-make[3]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/mysql'
mingw32-make -f Makefile.Debug all
mingw32-make[4]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/mysql'
mingw32-make[4]: Nothing to be done for 'all'.
mingw32-make[4]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/mysql'
mingw32-make -f Makefile.Release all
mingw32-make[4]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/mysql'
mingw32-make[4]: Nothing to be done for 'all'.
mingw32-make[4]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/mysql'
mingw32-make[3]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/mysql'
cd sqlite\ && mingw32-make -f Makefile 
mingw32-make[3]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/sqlite'
mingw32-make -f Makefile.Debug all
mingw32-make[4]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/sqlite'
mingw32-make[4]: Nothing to be done for 'all'.
mingw32-make[4]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/sqlite'
mingw32-make -f Makefile.Release all
mingw32-make[4]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/sqlite'
mingw32-make[4]: Nothing to be done for 'all'.
mingw32-make[4]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/sqlite'
mingw32-make[3]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers/sqlite'
mingw32-make[2]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/sqldrivers'
cd script\ && mingw32-make -f Makefile 
mingw32-make[2]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/script'
mingw32-make[2]: Nothing to be done for 'first'.
mingw32-make[2]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/script'
cd bearer\ && mingw32-make -f Makefile 
mingw32-make[2]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/bearer'
cd generic\ && mingw32-make -f Makefile 
mingw32-make[3]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/bearer/generic'
mingw32-make -f Makefile.Debug all
mingw32-make[4]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/bearer/generic'
mingw32-make[4]: Nothing to be done for 'all'.
mingw32-make[4]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/bearer/generic'
mingw32-make -f Makefile.Release all
mingw32-make[4]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/bearer/generic'
mingw32-make[4]: Nothing to be done for 'all'.
mingw32-make[4]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/bearer/generic'
mingw32-make[3]: Leaving directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/bearer/generic'
cd nativewifi\ && mingw32-make -f Makefile 
mingw32-make[3]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/bearer/nativewifi'
mingw32-make -f Makefile.Debug all
mingw32-make[4]: Entering directory 'C:/Qt/Qt-4.8.5_mingw/src/plugins/bearer/nativewifi'
g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_DLL -DQT_PLUGIN -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtNetwork" -I"..\..\..\..\include" -I"..\..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\..\..\..\mkspecs\win32-g++-4.6" -o tmp\obj\debug_shared\main.o main.cpp
In file included from c:\mingw\include\objbase.h:95:0,
                 from c:\mingw\include\ole2.h:31,
                 from c:\mingw\include\windows.h:101,
                 from c:\mingw\include\rpc.h:27,
                 from c:\mingw\include\wtypes.h:29,
                 from platformdefs.h:45,
                 from main.cpp:43:
c:\mingw\include\objidl.h:69:2: error: 'LPOLESTR' does not name a type
  LPOLESTR pwcsName;
  ^
c:\mingw\include\objidl.h:113:9: error: 'OLECHAR' does not name a type
 typedef OLECHAR **SNB;
         ^
c:\mingw\include\objidl.h:259:2: error: 'OLECHAR' does not name a type
  OLECHAR rgString[1];
  ^
c:\mingw\include\objidl.h:302:2: error: 'CY' does not name a type
  CY *pElems;
  ^
c:\mingw\include\objidl.h:306:2: error: 'DATE' does not name a type
  DATE *pElems;
  ^
c:\mingw\include\objidl.h:310:2: error: 'BSTR' does not name a type
  BSTR  *pElems;
  ^
c:\mingw\include\objidl.h:314:2: error: 'BSTRBLOB' does not name a type
  BSTRBLOB *pElems;
  ^
c:\mingw\include\objidl.h:318:2: error: 'VARIANT_BOOL' does not name a type
  VARIANT_BOOL *pElems;
  ^
c:\mingw\include\objidl.h:322:2: error: 'SCODE' does not name a type
  SCODE *pElems;
  ^
c:\mingw\include\objidl.h:346:2: error: 'CLIPDATA' does not name a type
  CLIPDATA *pElems;
  ^
c:\mingw\include\objidl.h:358:2: error: 'VARTYPE' does not name a type
  VARTYPE vt;
  ^
... (much more output, but similar to the above errors)

Why does everything build correctly, and only when it tries to build nativewifi it doesn't know what a LPOLESTR is? Am I missing a dependency somewhere? Did I install MinGW incorrectly? Is there a problem with my Qt sources?

Thanks for the help!

like image 963
karagog Avatar asked Nov 05 '13 13:11

karagog


1 Answers

This is definitely a header problem from mingw. I have tested a quick and dirty solution to work around this problem: Go to folder ...\qt-everywhere-opensource-4.8.x\src\plugins\bearer\nativewifi and open the 2 following files: qnativewifiengine.cpp and main.cpp. Modify both files as follows BEFORE first include line: #include<windows.h> and save both files.

Then try compilation again and it should work. In my case it does work :) I believe that this is either a recursive include in headers because not every include in the mingw headers is "guarded" with include guard or it is a missing dependency to windows.h which might be wrong evaluated...

Example in main.cpp:

#include <windows.h>
#include "qnativewifiengine.h"
#include "platformdefs.h"

#include <QtCore/private/qsystemlibrary_p.h>

#include <QtNetwork/private/qbearerplugin_p.h>

To fix it NOT quick and dirty you have to fix mingw header wtypes.h http://sourceforge.net/p/mingw/bugs/2047 The issue can be fixed by including rpc.h and rpcndr.h before the include guard _WTYPES_H in wtypes.h A minimal example to trigger the error:

#include <wtypes.h>
int main()
{
}

After fixing wtypes.h the example above should be compile

like image 156
razor5k Avatar answered Sep 17 '22 01:09

razor5k