Files
wiki/vcpkg安装库错误及解决方法.md

53 lines
4.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### 控制台设置代理
set HTTP_PROXY=http://127.0.0.1:2801
set HTTPS_PROXY=http://127.0.0.1:2801
set OSGEARTH_HTTP_DEBUG=1
set OSG_CURL_PROXY="127.0.0.1"
set OSG_CURL_PROXYPORT=2801
### 遇到某些库编译错误时,在本地修改代码并使用修改后的代码编译
`正常使用vcpkg install xxxx安装库时出现编译错误通过编译日志可以定位到具体的编译错误但是默认情况下每次install时都会从压缩包中重新解压一份新的代码到本地临时目录因此无法对源代码进行修改并使用修复后的代码进行编译安装此时只需要在install时额外指定--editable选项即可使本次编译不生成临时源码目录在一个固定的源码目录中然后可手工编辑修改此目录中源代码然后再使用install此时仍需指定--editable选项安装这时就会使用修改后的代码进行编译了...`
通过prompt启动然后进入vcpkg目录
VCPKG install 库名 --editable可以在编译前修改库源码
* vcpkg ports内可以修改库的配置如工程目录windows SDK版本以及部分错
* 关于找不到Windows SDK库的错误修改https://github.com/microsoft/vcpkg/issues/8288
* 关于vc错误
https://github.com/conan-io/conan/issues/7806
1>节点 1 上的项目“C:\Users\gz\Desktop\vcpkg-2023.08.09\buildtrees\libpq\x64-windows-dbg\libpq.vcxproj”(默认目标)。
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Current.targets(14,11): error MSB4115: 函数“exists”只接受标量值但其参数“$(ForceImportBeforeCppTargets)”的计算结果为“C:/Users/gz/Desktop/vcpkg-2023.08.09/scripts/buildsystems/msbuild/vcpkg.targets;C:/Users/gz/Desktop/vcpkg-2023.08.09/buildtrees/libpq/x64-windows-dbg/vcpkg-libs.props”不是标量值。 [C:\Users\gz\Desktop\vcpkg-2023.08.09\buildtrees\libpq\x64-windows-dbg\libpq.vcxproj]
1>已完成生成项目“C:\Users\gz\Desktop\vcpkg-2023.08.09\buildtrees\libpq\x64-windows-dbg\libpq.vcxproj”(默认目标)的操作 - 失败。
==============================================================================
解决方案修改对应库ports目录内的msvc.cmake文件
/p:ForceImportBeforeCppTargets=\"${SCRIPTS}/buildsystems/msbuild/vcpkg.targets\" \
/p:ForceImportBeforeCppTargets=\"${build_path}/vcpkg-libs.props\" \
编译GDAL 出现 +[](){}; 加号不明确
C:\Users\gz\Desktop\vcpkg-2023.08.09\buildtrees\gdal\src\v3.7.1-30395dad39\ogr\ogrsf_frmts\openfilegdb\filegdbindex_write.cpp(1298): error C2593: “operator +”不明确
C:\Users\gz\Desktop\vcpkg-2023.08.09\buildtrees\gdal\src\v3.7.1-30395dad39\ogr\ogrsf_frmts\openfilegdb\filegdbindex_write.cpp(1298): note: 可能是“内置 C++ operator+(void (__cdecl *)(std::vector<GByte,std::allocator<_Ty>> &,const __int64 &,int))”
with
[
_Ty=GByte
]
C:\Users\gz\Desktop\vcpkg-2023.08.09\buildtrees\gdal\src\v3.7.1-30395dad39\ogr\ogrsf_frmts\openfilegdb\filegdbindex_write.cpp(1298): note: 或 “内置 C++ operator+(void (__vectorcall *)(std::vector<GByte,std::allocator<_Ty>> &,const __int64 &,int))”
with
[
_Ty=GByte
]
C:\Users\gz\Desktop\vcpkg-2023.08.09\buildtrees\gdal\src\v3.7.1-30395dad39\ogr\ogrsf_frmts\openfilegdb\filegdbindex_write.cpp(1298): note: 尝试匹配参数列表“(OpenFileGDB::FileGDBTable::CreateSpatialIndex::<lambda_0019e43095a67889bd1988df31ec838d>)”时
尝试去掉lambda前面的加号(该加号用于将lambda表达式转为传统函数指针兼容老代码
==============================================================================
//////////////////////////////////
**有时使用vcpkg安装指定库时由于网络抽风有时会出现无法成功下载某些源码包的情况此时可先使用vcpkg安装一次确认源码包的下载目录及保存的文件名此二者有时不一致然后使用以下方法下载压缩包重命名后放在vcpkg的download目录中即可**
* 关于库下载错误可以通过迅雷或其它工具下载然后添加到download目录注意从命令行确认保存的文件名
// windows 7 Python 3.8
所以如果用到库以来了Python3.8以上的版本是无法在windows7正常运行的解决办法是用3.8狸猫换太子无痛替换掉vcpkg自动下载的python