You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MSVC环境下CMake安装LMMS时无法获取ASan动态库报错求助

在MSVC环境下启用Sanitizers构建LMMS(未合并PR版本)安装阶段依赖解析失败

问题描述

  • 环境:MSVC环境,启用Sanitizers构建未合并PR版本的LMMS
  • 现象:构建过程正常,但执行安装命令 cmake --install . --prefix=(folder) --config=Debug 时,出现无法解析依赖 clang_rt.asan_dynamic-x86_64.dll 的错误
  • 已尝试:咨询该PR作者及LMMS团队,未找到解决办法

错误详情

-- Finding prerequisites of lmms.exe

--
warning: cannot resolve item 'clang_rt.asan_dynamic-x86_64.dll'
  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?
-- warning: gp_resolved_file_type non-absolute file 'clang_rt.asan_dynamic-x86_64.dll' returning type 'other' -- possibly incorrect
--
warning: cannot resolve item 'clang_rt.asan_dynamic-x86_64.dll'
  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?
--
warning: cannot resolve item 'clang_rt.asan_dynamic-x86_64.dll'
  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?
CMake Error at D:/BuildAndGit/lmms/cmake/modules/InstallDependencies.cmake:179 (message):
  Can't resolve dependency clang_rt.asan_dynamic-x86_64.dll.
Call Stack (most recent call first):
  D:/BuildAndGit/lmms/cmake/modules/InstallDependencies.cmake:126 (find_prerequisites)
  cmake/install/cmake_install.cmake:63 (INSTALL_DEPENDENCIES)
  cmake_install.cmake:112 (include)

可能的解决思路

  • 指定ASAN库路径给CMake:找到LLVM/Clang安装目录下的bin文件夹(例如C:\Program Files\LLVM\bin),执行安装命令时追加参数:

    cmake --install . --prefix=(folder) --config=Debug --cmake-args "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_DIR=C:/Program Files/LLVM/bin"
    

    也可以在初始配置CMake时,通过 -DCMAKE_PREFIX_PATH="C:/Program Files/LLVM" 让CMake识别到LLVM的库路径。

  • 手动复制依赖库:直接找到clang_rt.asan_dynamic-x86_64.dll(通常位于LLVM安装目录的bin或lib/clang/<你的clang版本>/lib/windows文件夹),将其复制到LMMS安装目录的bin文件夹中,再重新执行安装命令。

  • 修改依赖搜索路径:编辑LMMS源码中的cmake/modules/InstallDependencies.cmake文件,在调用find_prerequisites之前,添加LLVM的bin目录到搜索路径:

    set(GP_SEARCH_DIRS "${GP_SEARCH_DIRS};C:/Program Files/LLVM/bin")
    

    注意替换为你的LLVM实际安装路径。

  • 检查Sanitizers配置:确认CMake中ASAN采用动态链接模式,确保配置了:

    CMAKE_CXX_FLAGS_DEBUG "/fsanitize=address /MDd"
    

    避免使用静态链接选项导致依赖路径识别错误。

内容的提问来源于stack exchange,提问作者Ross Maxx

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 12:17:28