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

Qt6: Build error with Visual Studio 2019 and QtQuick3D



  • Hi, I'm trying to build Qt 6 from the github dev branch using Visual Studio 2019 version 16.9 Preview 3 (which comes with cmake 3.19).

    My install steps:

    git clone git://code.qt.io/qt/qt5.git
    cd qt5
    perl init-repository
    

    I create a qt6vars.cmd file in the qt5 folder with the following content:

    REM Set up Microsoft Visual Studio 2019, where <arch> is amd64, x86, etc.
    CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Auxiliary\Build\vcvarsall.bat" amd64
    SET _ROOT=E:\qt5
    SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
    REM Uncomment the below line when using a git checkout of the source repository
    REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
    SET _ROOT=
    

    I run the above qt6vars.cmd file via a shortcut and then execute the following:

    configure -prefix "E:\qt5\_build" -debug-and-release -static -static-runtime
    cmake --build . --parallel
    

    Everything went OK with the "configure" command. This is the error I get when i run "cmake --build . --parallel"

    [9239/10337] Linking CXX executable qtbase\bin\qsb.exe
       Creating library qtshadertools\tools\qsb\Release\qsb.lib and object qtshadertools\tools\qsb\Release\qsb.exp
    [9289/10337] Building CXX object qtquick3d\src\plugins\assetimporters\a...3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp.obj
    FAILED: qtquick3d/src/plugins/assetimporters/assimp/CMakeFiles/AssimpImporterPlugin.dir/Release/__/__/__/3rdparty/assimp/src/code/PostProcessing/ComputeUVMappingProcess.cpp.obj
    C:\PROGRA~2\MICROS~1\2019\Preview\VC\Tools\MSVC\1428~1.298\bin\Hostx64\x64\cl.exe  /nologo /TP -DASSIMP_BUILD_BOOST_WORKAROUND -DASSIMP_BUILD_NO_3DS_IMPORTER -DASSIMP_BUILD_NO_3D_IMPORTER -DASSIMP_BUILD_NO_3MF_IMPORTER -DASSIMP_BUILD_NO_AC_IMPORTER -DASSIMP_BUILD_NO_AMF_IMPORTER -DASSIMP_BUILD_NO_ASE_IMPORTER -DASSIMP_BUILD_NO_ASSBIN_IMPORTER -DASSIMP_BUILD_NO_B3D_IMPORTER -DASSIMP_BUILD_NO_BLEND_IMPORTER -DASSIMP_BUILD_NO_BVH_IMPORTER -DASSIMP_BUILD_NO_C4D_IMPORTER -DASSIMP_BUILD_NO_COB_IMPORTER -DASSIMP_BUILD_NO_COMPRESSED_IFC -DASSIMP_BUILD_NO_CSM_IMPORTER -DASSIMP_BUILD_NO_DXF_IMPORTER -DASSIMP_BUILD_NO_EXPORT -DASSIMP_BUILD_NO_HMP_IMPORTER -DASSIMP_BUILD_NO_IFC_IMPORTER -DASSIMP_BUILD_NO_IRRMESH_IMPORTER -DASSIMP_BUILD_NO_IRR_IMPORTER -DASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS -DASSIMP_BUILD_NO_LWO_IMPORTER -DASSIMP_BUILD_NO_LWS_IMPORTER -DASSIMP_BUILD_NO_M3D_IMPORTER -DASSIMP_BUILD_NO_MD2_IMPORTER -DASSIMP_BUILD_NO_MD3_IMPORTER -DASSIMP_BUILD_NO_MD5_IMPORTER -DASSIMP_BUILD_NO_MDC_IMPORTER -DASSIMP_BUILD_NO_MDL_IMPORTER -DASSIMP_BUILD_NO_MMD_IMPORTER -DASSIMP_BUILD_NO_MS3D_IMPORTER -DASSIMP_BUILD_NO_NDO_IMPORTER -DASSIMP_BUILD_NO_NFF_IMPORTER -DASSIMP_BUILD_NO_OFF_IMPORTER -DASSIMP_BUILD_NO_OGRE_IMPORTER -DASSIMP_BUILD_NO_OPENGEX_IMPORTER -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_BUILD_NO_PLY_IMPORTER -DASSIMP_BUILD_NO_Q3BSP_IMPORTER -DASSIMP_BUILD_NO_Q3D_IMPORTER -DASSIMP_BUILD_NO_RAW_IMPORTER -DASSIMP_BUILD_NO_SIB_IMPORTER -DASSIMP_BUILD_NO_SMD_IMPORTER -DASSIMP_BUILD_NO_STEP_IMPORTER -DASSIMP_BUILD_NO_TERRAGEN_IMPORTER -DASSIMP_BUILD_NO_X3D_IMPORTER -DASSIMP_BUILD_NO_XGL_IMPORTER -DASSIMP_BUILD_NO_X_IMPORTER -DNOUNCRYPT -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_PLUGIN -DQT_QML_LIB -DQT_QUICK3DASSETIMPORT_LIB -DQT_QUICK3DUTILS_LIB -DQT_STATICPLUGIN -DQT_ZLIB_LIB -DRAPIDJSON_HAS_STDSTRING=1 -DRAPIDJSON_NOMEMBERITERATORCLASS -DUNICODE -DWIN32 -DWIN64 -DWindowsStore -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D_USE_MATH_DEFINES -D_WIN64 -DCMAKE_INTDIR=\"Release\" -Iqtquick3d\src\plugins\assetimporters\assimp\AssimpImporterPlugin_autogen\include_Release -Iqtquick3d\src\plugins\assetimporters\assimp -Iqtbase\include -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\.. -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\contrib\unzip -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code\CApi -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code\AssetLib\Collada -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code\Common -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code\AssetLib\FBX -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code\Material -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code\AssetLib\Obj -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code\PostProcessing -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code\AssetLib\STL -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code\AssetLib\glTF -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\code\AssetLib\glTF2 -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\contrib\poly2tri -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\contrib\pugixml\src -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\contrib\pugixml\contrib -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\contrib\rapidjson\include -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\contrib\utf8cpp\source -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\include -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\src\include\assimp\Compiler -Iqtquick3d\src\plugins\assetimporters\assimp\..\..\..\3rdparty\assimp\unzip -Iqtbase\include\QtCore -Iqtbase\mkspecs\win32-msvc -Iqtbase\include\QtGui -Iqtquick3d\src\assetimport -Iqtbase\include\QtQuick3DAssetImport\6.1.0 -Iqtbase\include\QtQuick3DAssetImport\6.1.0\QtQuick3DAssetImport -Iqtbase\src\corelib -Iqtbase\include\QtCore\6.1.0 -Iqtbase\include\QtCore\6.1.0\QtCore -Iqtquick3d\src\utils -Iqtbase\include\QtQuick3DUtils\6.1.0 -Iqtbase\include\QtQuick3DUtils\6.1.0\QtQuick3DUtils -Iqtbase\src\gui -Iqtbase\include\QtGui\6.1.0 -Iqtbase\include\QtGui\6.1.0\QtGui -Iqtbase\include\QtQuick3DUtils -Iqtbase\include\QtQuick3DAssetImport -Iqtbase\include\QtQml -Iqtbase\include\QtNetwork -Iqtbase\include\QtZlib /DWIN32 /D_WINDOWS /GR /EHsc /DNDEBUG -O2 -MT /W3 -wd4100 -wd4189 -wd4267 -wd4996 -wd4828 /bigobj -Zc:__cplusplus -permissive- -utf-8 -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:externConstexpr -Zc:wchar_t -guard:cf -std:c++17 /YuE:/qt5/qtquick3d/src/plugins/assetimporters/assimp/CMakeFiles/AssimpImporterPlugin.dir/Release/cmake_pch.hxx /FpE:/qt5/qtquick3d/src/plugins/assetimporters/assimp/CMakeFiles/AssimpImporterPlugin.dir/Release/cmake_pch.cxx.pch /FIE:/qt5/qtquick3d/src/plugins/assetimporters/assimp/CMakeFiles/AssimpImporterPlugin.dir/Release/cmake_pch.hxx /showIncludes /Foqtquick3d\src\plugins\assetimporters\assimp\CMakeFiles\AssimpImporterPlugin.dir\Release\__\__\__\3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp.obj /Fdqtbase\plugins\assetimporters\Qt6AssimpImporterPlugin.pdb /FS -c qtquick3d\src\3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp
    qtquick3d\src\3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp(125): error C2632: 'int' followed by 'char' is illegal
    qtquick3d\src\3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp(125): error C2513: 'unsigned int': no variable declared before '='
    qtquick3d\src\3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp(125): error C2143: syntax error: missing ';' before ','
    qtquick3d\src\3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp(125): error C2059: syntax error: ','
    qtquick3d\src\3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp(136): error C2513: 'char': no variable declared before '='
    qtquick3d\src\3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp(146): error C2065: 'large': undeclared identifier
    qtquick3d\src\3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp(154): error C2059: syntax error: '!='
    qtquick3d\src\3rdparty\assimp\src\code\PostProcessing\ComputeUVMappingProcess.cpp(155): error C2143: syntax error: missing ';' before '{'
    [9294/10337] Building CXX object qtquick3d\src\plugins\assetimporters\a...\3rdparty\assimp\src\code\PostProcessing\FindInvalidDataProcess.cpp.obj
    ninja: build stopped: subcommand failed.
    

    I might try and recompile with "-skip qtquick3d" in configure and see how that goes, as that's where the issue seems to be.

    Any help on this would be great. Thanks.



  • I have the exact same error. Also occurs with Qt 6.0.1. I'm using the regular (non-preview) branch of VS2019.

    My configure.bat command:

    ..\qt6\configure.bat -nomake examples -nomake tests -opensource -confirm-license -static -static-runtime -openssl-linked -prefix C:\Qt\6.0.1\msvc2019_64_static
    




  • Hello!
    I have the same issue when compiling Qt 6.0.1 statically.



  • I have fixed this issue by changing small to little variable name in every occurrence in the method below.

    Code - ComputeUVMappingProcess.cpp:

    // Try to remove UV seams
    void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
    {
        // TODO: just a very rough algorithm. I think it could be done
        // much easier, but I don't know how and am currently too tired to
        // to think about a better solution.
    
        const static ai_real LOWER_LIMIT = ai_real( 0.1 );
        const static ai_real UPPER_LIMIT = ai_real( 0.9 );
    
        const static ai_real LOWER_EPSILON = ai_real( 10e-3 );
        const static ai_real UPPER_EPSILON = ai_real( 1.0-10e-3 );
    
        for (unsigned int fidx = 0; fidx < mesh->mNumFaces;++fidx)
        {
            const aiFace& face = mesh->mFaces[fidx];
            if (face.mNumIndices < 3) continue; // triangles and polygons only, please
    
            unsigned int little = face.mNumIndices, large = little;
            bool zero = false, one = false, round_to_zero = false;
    
            // Check whether this face lies on a UV seam. We can just guess,
            // but the assumption that a face with at least one very little
            // on the one side and one very large U coord on the other side
            // lies on a UV seam should work for most cases.
            for (unsigned int n = 0; n < face.mNumIndices;++n)
            {
                if (out[face.mIndices[n]].x < LOWER_LIMIT)
                {
                    little = n;
    
                    // If we have a U value very close to 0 we can't
                    // round the others to 0, too.
                    if (out[face.mIndices[n]].x <= LOWER_EPSILON)
                        zero = true;
                    else round_to_zero = true;
                }
                if (out[face.mIndices[n]].x > UPPER_LIMIT)
                {
                    large = n;
    
                    // If we have a U value very close to 1 we can't
                    // round the others to 1, too.
                    if (out[face.mIndices[n]].x >= UPPER_EPSILON)
                        one = true;
                }
            }
            if (little != face.mNumIndices && large != face.mNumIndices)
            {
                for (unsigned int n = 0; n < face.mNumIndices;++n)
                {
                    // If the u value is over the upper limit and no other u
                    // value of that face is 0, round it to 0
                    if (out[face.mIndices[n]].x > UPPER_LIMIT && !zero)
                        out[face.mIndices[n]].x = 0.0;
    
                    // If the u value is below the lower limit and no other u
                    // value of that face is 1, round it to 1
                    else if (out[face.mIndices[n]].x < LOWER_LIMIT && !one)
                        out[face.mIndices[n]].x = 1.0;
    
                    // The face contains both 0 and 1 as UV coords. This can occur
                    // for faces which have an edge that lies directly on the seam.
                    // Due to numerical inaccuracies one U coord becomes 0, the
                    // other 1. But we do still have a third UV coord to determine
                    // to which side we must round to.
                    else if (one && zero)
                    {
                        if (round_to_zero && out[face.mIndices[n]].x >=  UPPER_EPSILON)
                            out[face.mIndices[n]].x = 0.0;
                        else if (!round_to_zero && out[face.mIndices[n]].x <= LOWER_EPSILON)
                            out[face.mIndices[n]].x = 1.0;
                    }
                }
            }
        }
    }
    

    Now, it successfully compiles Qt 6.0.1 statically.


Log in to reply