CMake encountered an error during the configuration process due to a duplicate custom target definition.

41 views
Skip to first unread message

kkXK XXX

unread,
Jun 16, 2025, 11:40:37 AM6/16/25
to Dr. Memory Users
  • It tried to create a custom target named generate_asm_utils_x86.asm in the file:

    cpp2asm_support.cmake:439
  • However, a target with the same name already exists, previously defined in:
  • drmemory/dynamorio/ext/drsyscall
  • CMake does not allow two targets with the same name, even across different directories.

  • This is related to CMake policy CMP0002, which states that all target names must be globally unique.

  • 微信截图_20250616150248.png

Derek Bruening

unread,
Jun 16, 2025, 11:49:49 AM6/16/25
to drmemor...@googlegroups.com
This is due to drsyscall having been moved to dynamorio but not yet removed from drmemory: https://github.com/DynamoRIO/dynamorio/issues/7303

--

---
You received this message because you are subscribed to the Google Groups "Dr. Memory Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drmemory-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/drmemory-users/074edd8a-b72a-4376-90f5-d0972f122a26n%40googlegroups.com.

Derek Bruening

unread,
Jun 16, 2025, 3:46:05 PM6/16/25
to drmemor...@googlegroups.com
However, https://github.com/DynamoRIO/drmemory/pull/2554 renamed the drsyscall inside drmemory to drmf_drsyscall, so there should be no configuration issue. Are you using the latest source version?

Grzegorz Niemirowski

unread,
Sep 4, 2026, 5:21:05 PMSep 4
to Dr. Memory Users
Hi
I'm having this problem with current master. I think it's because generate_asm_utils_x86.asm target is generated in two places:
main CMakeLists.txt, line 1049
CMakeLists.txt in dynamorio\ext\drsyscall, line 44

PR2554 references different targets, not asm related.

Regards,
Grzegorz Niemirowski

Grzegorz Niemirowski

unread,
Sep 8, 2026, 8:35:43 AMSep 8
to Dr. Memory Users
So it seems the problem occurs only when using Visual Studio as a generator. When using Ninja, the error goes away.
But it's not the end of problems. For some reason cmake uses cl.exe as an assembler:
-- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe
I can force ml64.exe manually by passing -DCMAKE_ASM_COMPILER="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/ml64.exe"
but later there is compilation error, because cl.exe is given a gcc flag:
cl : Command line error D8021 : invalid numeric argument '/Wno-all'
I don't know how to fix it. The problem is with tests/CMakeFiles/allowlist_lib.dir/allowlist_lib.cpp.obj so the workaround can be to disable tests:
-DBUILD_TOOL_TESTS=False
Then the project builds successfully. I'm wondering how it works on github because I don't see CMAKE_ASM_COMPILER nor BUILD_TOOL_TESTS passed to cmake in github actions log:
Configure with command: "C:/Program Files/CMake/bin/cmake.exe" "-GNinja" "-SD:/a/drmemory/drmemory" "-BD:/a/drmemory/drmemory/build_drmemory-dbg-64"
Reply all
Reply to author
Forward
0 new messages