使用VCPKG安装Cairo库时遭遇libiconv兼容性错误
解决vcpkg安装libiconv时的Windows版本兼容问题
我是编程新手,按照Io2D库的构建说明安装时,每次尝试通过vcpkg安装依赖的Cairo库,都会触发libiconv的构建失败,错误提示程序版本与当前Windows系统不兼容,需确认适配的x86(32位)或x64(64位)版本。完整错误日志如下:
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:96 (message): Command failed: "C:/Program Files/src/vcpkg/downloads/tools/msys2/7e05e7aa09f1709f/usr/bin/bash.exe" --noprofile --norc --debug -c "V=1 CPP='compile cl.exe -E' CC='compile cl.exe' CC_FOR_BUILD='compile cl.exe' CXX='compile cl.exe' RC='windres-rc rc.exe' WINDRES='windres-rc rc.exe' AR='ar-lib lib.exe' LD='link.exe -verbose' RANLIB=':' STRIP=':' NM='dumpbin.exe -symbols -headers' DLLTOOL='link.exe -verbose -dll' CCAS=':' AS=':' ./../src/1.17-e2a53830aa.clean/configure --build=i686-pc-mingw32 \"--enable-extra-encodings\" \"--without-libiconv-prefix\" \"--without-libintl-prefix\" \"--enable-relocatable\" \"ac_cv_prog_ac_ct_STRIP=:\" \"gl_cv_double_slash_root=yes\" \"ac_cv_func_memmove=yes\" \"--disable-silent-rules\" \"--verbose\" \"--enable-shared\" \"--disable-static\" \"--prefix=/C/Program Files/src/vcpkg/installed/x86-windows/debug\" \"--bindir=\\${prefix}/../tools/libiconv/debug/bin\" \"--sbindir=\\${prefix}/../tools/libiconv/debug/sbin\" \"--libdir=\\${prefix}/lib\" \"--includedir=\\${prefix}/../include\" \"--datarootdir=\\${prefix}/share/libiconv\"" Working Directory: C:/Program Files/src/vcpkg/buildtrees/libiconv/x86-windows-dbg Error code: This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher See logs for more information: Call Stack (most recent call first): scripts/cmake/vcpkg_configure_make.cmake:707 (vcpkg_execute_required_process) ports/libiconv/portfile.cmake:29 (vcpkg_configure_make) scripts/ports.cmake:146 (include) error: building libiconv:x86-windows failed with: BUILD_FAILED Please ensure you're using the latest port files with `git pull` and `vcpkg update`. Then check for known issues at: https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+libiconv You can submit a new issue at: https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[libiconv]+Build+error Include '[libiconv] Build error' in your bug report title, the following version information in your bug description, and attach any relevant failure logs from above. vcpkg-tool version: 2022-06-17-9268e366206712e38102b28dbd1617697a99ff2e vcpkg-scripts version: 98f8d00e8 2022-07-08 (3 days ago) You can also use the prefilled template from C:\Program Files\src\vcpkg\installed\vcpkg\issue_body.md.
解决步骤
- 确认Windows系统位数:右键「此电脑」→「属性」,查看系统类型是32位还是64位操作系统。
- 匹配vcpkg目标架构:
- 如果系统是64位,将安装命令改为针对x64架构,比如执行
vcpkg install cairo:x64-windows(对应Io2D依赖的架构需保持一致) - 如果系统是32位,确保使用的vcpkg工具包是32位版本,替换当前vcpkg目录后重新尝试安装
- 如果系统是64位,将安装命令改为针对x64架构,比如执行
- 清理失败缓存:执行
vcpkg remove libiconv:x86-windows --purge清除之前的错误构建文件,再重新运行安装命令
内容的提问来源于stack exchange,提问作者Mohammed Sharif Moawad
相关产品推荐
相关产品推荐

