Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator CMake moc.exe fails to find DLL dependencies
Forum Updated to NodeBB v4.3 + New Features

QtCreator CMake moc.exe fails to find DLL dependencies

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
10 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rich v
    wrote on last edited by Rich v
    #1

    I'm getting kits set up in QtCreator after getting a new work PC. Unfortunately after creating one of my kits, the CMake configuration fails for a project that it should work for. It fails when it tries to test 'moc'.

    -- Configuring done
    CMake Error: AUTOMOC for target Calibration: Test run of "moc" executable "C:/Qt/5.6.3/qnx7_armv7/bin/moc.exe" failed.
    C:/Qt/5.6.3/qnx7_armv7/bin/moc.exe -h
    
    Exit code 0xc0000135
    
    CMake Generate step failed.  Build files cannot be regenerated correctly.
    CMake process exited with exit code 1.
    

    I still have my old machine and I can see that the environment path is different for the two kits (new machine vs old) but I don't understand why. What's more, only one kit that I've tried to create on the new machine has this problem. Another kit I've created runs moc.exe just fine. That kit has an entirely different system environment (e.g. Path). On the new machine when I run CMake on the project (within QtCreator), it can't find libgcc_s_dw2-1.dll or libstdc++-6.dll. I don't feel like the answer is to try to hunt down these dependent DLLs and add their paths manually to the kit's system environment, but what choice do I have? Why are the two kits I've created on the new machine so far apart in their system environment?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on last edited by mchinand
      #9

      @Rich-v said in QtCreator CMake moc.exe fails to find DLL dependencies:

      /mingw32/bin

      Can you specify this path as a Windows filesystem path and add it to your build environment PATH variable?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mchinand
        wrote on last edited by
        #2

        When transferring a project to a new computer, make sure your source directory does not include any generated files from a previous computer. In your case, make sure there isn't a CMakeLists.txt.user file in your source directory. That file should be added to your .gitignore file (or similar, depending on your version control), so it doesn't mistakenly get added to your version control.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rich v
          wrote on last edited by
          #3

          I was hopeful, but that doesn't seem to be the issue. I removed the CMakeLists.txt.usr file, wiped the build folder away and started fresh with the same result:

          CMake Error: AUTOMOC for target Calibration: Test run of "moc" executable "C:/Qt/5.6.3/qnx7_armv7/bin/moc.exe" failed.
          C:/Qt/5.6.3/qnx7_armv7/bin/moc.exe -h
          
          Exit code 0xc0000135
          

          Do you have any idea why two kits that I have would be different in this way: one can run 'moc.exe' just fine and the other fails to find dependent libraries when it runs 'moc.exe'?

          A 'good' kit in this case is one I have an older msvc2013 project. Here's the build environment PATH that QtCreator reports:

          C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\MSBuild\12.0\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64_x86;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools;C:\Program Files (x86)\Windows Kits\8.1\bin\x64;C:\Program Files (x86)\Windows Kits\8.1\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\;C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot\bin;C:\Perl64\bin;C:\Users\VonRi\AppData\Roaming\ActiveState\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Bitvise SSH Client;C:\Program Files\Graphviz\bin;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\VonRi\AppData\Local\Microsoft\WindowsApps;C:\Users\VonRi\.dotnet\tools
          

          The 'bad' kit in this case is a QNX kit. Here's the Path that kit seems to get by default:

          C:\Qt\5.6.3\qnx7_armv7\lib;C:/qnx700//host/win64/x86_64/usr/bin;C:/qnx700//jre/bin;C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot\bin;C:\Perl64\bin;C:\Users\VonRi\AppData\Roaming\ActiveState\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Bitvise SSH Client;C:\Program Files\Graphviz\bin;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\VonRi\AppData\Local\Microsoft\WindowsApps;C:\Users\VonRi\.dotnet\tools
          
          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rich v
            wrote on last edited by
            #4

            I should also mention that the version of Qt for this kit was built myself and perhaps that has something to do with it. If I open a cmd.exe window and run the 'moc' from that created folder: C:\Qt\5.6.3\qnx7_armv7\bin\moc.exe it fails to find the DLLs it needs. This is not the case for other Qt installs: e.g. C:\Qt\6.2.2\msvc2019_64\bin\moc.exe or C:\Qt\5.6.3\msvc2013\bin\moc.exe.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Rich v
              wrote on last edited by Rich v
              #5

              For that matter, the same problem applies when I try to run the rcc.exe, uic.exe, lupdate, lconvert, etc. Most executables located in c:\Qt\5.6.3\qnx7)armv7\bin do not properly execute when I try to run them from a cmd window.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mchinand
                wrote on last edited by
                #6

                @Rich-v said in QtCreator CMake moc.exe fails to find DLL dependencies:

                C:\Qt\5.6.3\qnx7_armv7\bin\moc.exe

                I'm not familiar with QNX, is this a cross-compile setup that runs on Windows but compiles for QNX?

                R 1 Reply Last reply
                0
                • M mchinand

                  @Rich-v said in QtCreator CMake moc.exe fails to find DLL dependencies:

                  C:\Qt\5.6.3\qnx7_armv7\bin\moc.exe

                  I'm not familiar with QNX, is this a cross-compile setup that runs on Windows but compiles for QNX?

                  R Offline
                  R Offline
                  Rich v
                  wrote on last edited by
                  #7

                  @mchinand That's correct, but the tools mentioned are still host (windows) tools.

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    Rich v
                    wrote on last edited by
                    #8

                    I got a clue when I finally tried to get a list of all DLL dependencies. In a mingw32 window I got this:

                    VonRi@PLYL97MP7G3-NR MINGW32 /c/Qt/5.6.3/qnx7_armv7/bin
                    $ ldd moc.exe
                            ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x77b90000)
                            KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x760c0000)
                            KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x75cd0000)
                            msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x76600000)
                            ole32.dll => /c/Windows/System32/ole32.dll (0x75ef0000)
                            ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x76ed0000)
                            RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x75fe0000)
                            libgcc_s_dw2-1.dll => /mingw32/bin/libgcc_s_dw2-1.dll (0x6ff30000)
                            combase.dll => /c/Windows/System32/combase.dll (0x75a40000)
                            GDI32.dll => /c/Windows/System32/GDI32.dll (0x77af0000)
                            win32u.dll => /c/Windows/System32/win32u.dll (0x760a0000)
                            gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x76aa0000)
                            libwinpthread-1.dll => /mingw32/bin/libwinpthread-1.dll (0x6ff10000)
                            msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x76910000)
                            USER32.dll => /c/Windows/System32/USER32.dll (0x76770000)
                            SHELL32.dll => /c/Windows/System32/SHELL32.dll (0x76ff0000)
                            libstdc++-6.dll => /mingw32/bin/libstdc++-6.dll (0x6f560000)
                    

                    The things it complains about at runtime are mingw32-supplied libraries which of course aren't easy for the system to find if you're not in a mingw32 window.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mchinand
                      wrote on last edited by mchinand
                      #9

                      @Rich-v said in QtCreator CMake moc.exe fails to find DLL dependencies:

                      /mingw32/bin

                      Can you specify this path as a Windows filesystem path and add it to your build environment PATH variable?

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        Rich v
                        wrote on last edited by
                        #10

                        Yes, that did the trick. I was just coming here to post that I did the same.

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved