0

I am trying to build qt6 on windows, however, it report error while cmake --build .:

cmd.exe /C "cd . && D:\un-setup\cmake\bin\cmake.exe -E vs_link_dll --intdir=qtbase\src\gui\CMakeFiles\Gui.dir --rc=C:\PROGRA~2\WINDOW~4\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WINDOW~4\10\bin\100220~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1430~1.307\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\Gui.rsp  /out:qtbase\bin\Qt6Guid.dll /implib:qtbase\lib\Qt6Guid.lib /pdb:qtbase\bin\Qt6Guid.pdb /dll /version:6.4 /machine:x64 /debug  -DYNAMICBASE -NXCOMPAT -LARGEADDRESSAWARE  && cd ."
MT: command "C:\PROGRA~2\WINDOW~4\10\bin\100220~1.0\x64\mt.exe /nologo /manifest qtbase\bin\Qt6Guid.dll.manifest /outputresource:qtbase\bin\Qt6Guid.dll;#2" failed (exit code 0x1f) with the following output:

mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file "qtbase\bin\Qt6Guid.dll". 

I searched that, the reason is target dll (Qt6Guid.dll) is locked by some other program, probably virus software (source: mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file ... Access is denied). So I have tried:

  • I disabled my only virsus software windows defender in my computer. It still report the same error.
  • Use processmonitor to monitor the whole build process, and I still failed to find the which one locks the dll file.

I still find that there is another resolution: in VS GUI, set embed manifest to no. However I am using cmake, then How can I pass the setting (no embed manifest) through configure? Currently my configure option is (in build dir under Qt6 source code)

../configure.bat -prefix d:\Qt6

If it's not possible to set the embed manifest setting to NO using CMake, how can I disable windows defender totally?

starball
  • 20,030
  • 7
  • 43
  • 238
wieniawski
  • 11
  • 2

1 Answers1

0

If you are indeed okay with the consequences of setting NO for the embed manifest setting to work around this issue, I'm pretty sure the say to do it with CMake is to just use the commandline linker flag: /MANIFEST:NO.

Based on the types of targets you want this to apply for, use one or multiple of the following: CMAKE_EXE_LINKER_FLAGS, CMAKE_SHARED_LINKER_FLAGS, or CMAKE_STATIC_LINKER_FLAGS.

Since the issue is tied to your specific machine, I'd set this as a cache variable via commandline using the -D flag in your configuration command instead of hardcoding it into your CMakeLists.txt file with target_link_options or add_link_options.

Obviously it would be better to find out what's causing the issue, but luckily for me, you didn't ask for that :) (and I don't think anyone can figure that out for you without access to your machine)

Related docs:

starball
  • 20,030
  • 7
  • 43
  • 238