Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Sql drivers in shadow build on reference machine mingw i386 fatal error: main.moc: No such file or directory



  • Dear folks,

    I am trying to build binaries for Qt including SQL drivers for deployment, using mingw 8.1.0 and Qt 5.12.
    For that, I am running the following commands:

    set PATH=C:\Program Files (x86)\mingw_w64_posix_sjlj\bin;%PATH%
    
    SET PATH="C:\Python34_x86";%PATH%
    SET PATH="C:\Perl\bin";%PATH%
    mingw32-make.exe distclean
    CALL "../src32/configure.bat" -debug-and-release -platform win32-g++ -opensource -confirm-license -opengl desktop -skip qtwebengine -sql-mysql -sql-psql -sql-odbc -sql-oci MYSQL_INCDIR="D:\Dependencies\mysql-x86\include" MYSQL_LIBDIR="D:\Dependencies\mysql-x86\lib" OCI_INCDIR="D:\Dependencies\oci-x86\instantclient_18_5\sdk\include" OCI_LIBDIR="D:\Dependencies\oci-x86\instantclient_18_5\sdk\lib\msvc" OCI_PREFIX="D:\Dependencies\oci-x86\instantclient_18_5\sdk" PSQL_INCDIR="D:\Dependencies\psql-x86\pgsql\include" PSQL_LIBDIR="D:\Dependencies\psql-x86\pgsql\lib"
    mingw32-make.exe
    

    The make eventually throws up with the following error:

    64-mingw32" -I"C:/Program Files (x86)/mingw_w64_posix_sjlj/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/backward" -I"C:/Program Files (x86)/mingw_w64_posix_sjlj/lib/gcc/i686-w64-mingw32/8.1.0/include" -I"C:/Program Files (x86)/mingw_w64_posix_sjlj/lib/gcc/i686-w64-mingw32/8.1.0/include-fixed" -I"C:/Program Files (x86)/mingw_w64_posix_sjlj/i686-w64-mingw32/include" D:\Libs\qt\5.12\src32\qtbase\src\plugins\imageformats\ico\main.h -o .moc\debug\moc_main.cpp
    D:\Libs\qt\5.12\src32\qtbase\src\plugins\sqldrivers\odbc\main.cpp:73:10: fatal error: main.moc: No such file or directory
     #include "main.moc"
              ^~~~~~~~~~
    compilation terminatedg++ -c -fno-keep-inline-dllexport -g -Og -std=c++1z -fno-exceptions -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -ID:\Libs\qt\5.12\src32\qtbase\src\plugins\imageformats\ico -I. -ID:\Libs\qt\5.12\src32\qtbase\include -ID:\Libs\qt\5.12\src32\qtbase.\include\QtGui -I..\..\..\..\include -I..\..\..\..\include\QtGui -ID:\Libs\qt\5.12\src32\qtbase\include\QtCore\5.12.2 -ID:\Libs\qt\5.12\
    

    The config log says the following

    looking for library odbc
    Trying source 0 (type inline) of library odbc ...
    + cd /d D:\Libs\qt\5.12\x86\config.tests\odbc && D:\Libs\qt\5.12\x86\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_USE += odbc" "QMAKE_LIBS_ODBC = \"C:/Program Files ^(x86^)/mingw_w64_posix_sjlj/i686-w64-mingw32/lib/libodbc32.a\"" D:/Libs/qt/5.12/x86/config.tests/odbc
    + cd /d D:\Libs\qt\5.12\x86\config.tests\odbc && set MAKEFLAGS=& mingw32-make
    > g++ -c -fno-keep-inline-dllexport -g -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -ID:\Libs\qt\5.12\src32\qtbase\mkspecs\win32-g++  -o main.o main.cpp
    > g++ -Wl,-subsystem,console -mthreads -o odbc.exe main.o  "C:\Program Files (x86)\mingw_w64_posix_sjlj\i686-w64-mingw32\lib\libodbc32.a"   
     => source accepted.
    test config.qtbase_sqldrivers.libraries.odbc succeeded
    looking for library psql
    Trying source 0 (type pkgConfig) of library psql ...
    pkg-config use disabled globally.
      => source produced no result.
    Trying source 1 (type psqlConfig) of library psql ...
    pg_config not found.
      => source produced no result.
    Trying source 2 (type psqlEnv) of library psql ...[0_1555495231038_config.log](Uploading 100%) 
    
    The x64 build of the same works perfectly.
    Any ideas?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should rather use the MinGW versions provided with the Qt installer. With these you are sure that Qt can be built.

    Out of curiosity, why not just build the SQL backends you are interested in rather than rebuild the whole of Qt ?



  • @SGaist said in Sql drivers in shadow build on reference machine mingw i386 fatal error: main.moc: No such file or directory:

    MinGW versions provided with the Qt installer.

    Thanks. That version is too old for everything else though.
    Somehow re-extracting the sources fixed the issue. Not sure how they got touched; just by the configure script.


  • Lifetime Qt Champion

    @namezero111111 said in Sql drivers in shadow build on reference machine mingw i386 fatal error: main.moc: No such file or directory:

    Thanks. That version is too old for everything else though.

    If I remember correctly it is GCC 7.3, not that old.


Log in to reply