cmake 错误提示:build.ninja:bad $-escape(文字$必须写成$$)

8tntrjer  于 2023-03-30  发布在  其他
关注(0)|答案(1)|浏览(1949)

编译SeqAn框架时出现以下错误:

1> [CMake] CMake Error:
1> [CMake]   Running
1> [CMake] 
1> [CMake]    'C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe' '-C' 'C:/Users/pc/source/repos/seqan/out/build/x64-Clang-Debug' '-t' 'recompact'
1> [CMake] 
1> [CMake]   failed with:
1> [CMake] 
1> [CMake]    ninja: error: build.ninja:152: bad $-escape (literal $ must be written as $$)
1> [CMake] 
1> [CMake]   
1> [CMake] 
1> [CMake] 
1> [CMake] 
1> [CMake] CMake Generate step failed.  Build files cannot be regenerated correctly.
1> 'C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\PROFESSIONAL\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\pc\Source\Repos\seqan\out\install\x64-Clang-Debug" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/LLVM/bin/clang-cl.exe"  -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\PROFESSIONAL\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\Users\pc\Source\Repos\seqan" 2>&1"' execution failed with error: ''C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\PROFESSIONAL\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\pc\Source\Repos\seqan\out\install\x64-Clang-Debug" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/LLVM/bin/clang-cl.exe"  -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\PROFESSIONAL\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\Users\pc\Source\Repos\seqan" 2>&1"' returned with exit code: 1'.

下面是我的***CMakeSettings_schema.json***文件:

{
  "configurations": [
    {
      "name": "x64-Clang-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "inheritEnvironments": [ "clang_cl_x64_x64" ],
      "variables": []
    }
  ]
}

以下是我的***build.ninja***文件第152行的内容:

COMMAND = cmd.exe /C "cd /D C:\Users\pc\source\repos\seqan\out\build\x64-Clang-Debug && C:\Users\pc\source\repos\seqan\out\build\x64-Clang-Debug\bin\$(ConfigurationName)\alf.exe --write-ctd C:/Users/pc/source/repos/seqan/out/build/x64-Clang-Debug/workflow_plugin_dir/descriptors/alf.ctd"

我能做些什么来解决这个问题?

z2acfund

z2acfund1#

您现在可能已经修复了这个问题,但是导致我的坏的$-escape错误的原因是PATH环境变量中指定的一个路径中有一个额外的$。

相关问题