0

I have a C++ CMake MinGW_64 msys2 project for setting up a camera with lumisuite and QT6 for a gui, which resulted in the following error

[cmake] CMake Error: AUTOMOC for target mainwindow: Test run of "moc" executable "C:/msys/mingw64/share/qt6/bin/moc.exe" failed.
[cmake] C:/msys/mingw64/share/qt6/bin/moc.exe -h
[cmake] 
[cmake] Exit code 0xc0000139
[cmake] 
[cmake] CMake Generate step failed.  Build files cannot be regenerated correctly.

i could track down the problem by commenting out codeblocks to:

file(COPY "C:/Program Files/Instrument Systems/LumiSuite SDK/bin/" DESTINATION "C:/GIT_REPOS/LumiCamApp/build")

if i comment out this line, then moc.exe works fine. I guess this is a timeout-thing of AUTOMOC, as copying the lumisuite binaries takes too long or something.

The file(COPY [...]) comes from the lumisuite examples.

Just wanted to share my problems with AUTOMOC and QT as i were searching for the root of this bug for 3 days now, maybe someone using QT and another external library (in my case lumisuite) runs into this, too. :) As the cmake error did not give any hints on why moc failed, this took me a long time to figure out that it has nothing to do with qt but with copying the external library instead.

I guess i have to somehow figure out a way to either tell moc to wait longer (until copying is finished) (note here: it takes some time until moc failes and cmake prints the error message, so i guess it is copying?) or i need to copy later. i don't know. i'm quite a newbie with cmakelists scripts, this is the first time for me setting up a whole real-world-problem c++ project from scratch

  • `0xc0000139` is `STATUS_ENTRYPOINT_NOT_FOUND`, which means a function is missing in one of the DLLs moc.exe is depending on. Does this `COPY` include DLLs? – ssbssa Mar 15 '23 at 11:26
  • Yes it does. I got it to copy them by using `add_custom_target(lumisuitedlls)`, `add_custom_command`, and àdd_dependencies(LumiCamApp lumisuitdlls)` (see my answer) now it fails at build time because of some resource rcc problem where it says ninja: build stopped: subcommand failed – apfreelance Mar 16 '23 at 10:15

1 Answers1

0
add_custom_target(lumisuitdlls)

add_custom_command(
        TARGET lumisuitdlls PRE_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy_directory ${dll_directory} ${destination})

add_dependencies(LumiCamApp lumisuitdlls)

solved it for me. It now copies the dll's to build folder pre_build and does not fail to configure anymore due to AUTOMOC.