Windows下vcpkg安装libssh时pthreads:x86-windows构建失败求助
Windows下vcpkg安装libssh时pthreads:x86-windows构建失败问题
问题重现
按照libssh官方指南在Windows系统使用vcpkg安装libssh,执行vcpkg install libssh命令后,资源下载与CMake配置阶段正常,但构建pthreads:x86-windows时失败,返回BUILD_FAILED错误。
核心报错信息
error: building pthreads:x86-windows failed with: BUILD_FAILED error: Please ensure you're using the latest port files with `git pull` and `vcpkg update`. ...
详细错误日志(install-x86-windows-dbg-err.log)
Microsoft (R) 程序维护实用工具 版本 14.35.32216.1 ... NMAKE : 致命错误 U1077: “if not exist D:\Windows Apps\vcpkg\packages\pthreads_x86-windows\debug\bin mkdir D:\Windows Apps\vcpkg\packages\pthreads_x86-windows\debug\bin” : 返回代码“0x1” Stop.
构建日志片段(install-x86-windows-dbg-out.log)
Included: common.mk ... if not exist D:\Windows Apps\vcpkg\packages\pthreads_x86-windows\debug\bin mkdir D:\Windows Apps\vcpkg\packages\pthreads_x86-windows\debug\bin
问题原因
报错显示NMAKE执行目录创建命令失败,核心原因是路径包含空格(D:\Windows Apps)——Windows命令行中,未加引号的带空格路径会被拆分为多个参数,导致系统无法识别完整路径。
解决步骤
- 迁移vcpkg到无空格路径:将vcpkg整个目录从
D:\Windows Apps\vcpkg移动到如D:\vcpkg这类无空格、无特殊字符的路径下,重新打开命令行切换到新目录,执行vcpkg install libssh。 - 手动创建缺失目录(临时方案):直接手动创建报错中指定的路径
D:\Windows Apps\vcpkg\packages\pthreads_x86-windows\debug\bin,再重新执行安装命令,后续构建会跳过目录创建步骤。 - 更新vcpkg至最新版本:先执行
git pull更新vcpkg源码,再执行vcpkg update更新端口文件,排除版本老旧导致的路径处理bug。
内容的提问来源于stack exchange,提问作者Omer Dagry
相关产品推荐
相关产品推荐

