背景
c++跨平台项目使用conan进行三方库依赖管理是比较通用的方案,更换开发环境后突然发现conan无法安装三方库了,报错如下:
zlib/1.2.12: Not found in local cache, looking in remotes...
zlib/1.2.12: Trying with 'conan-center'...
ERROR: Failed requirement 'zlib/1.2.12' from 'conanfile.py (QtConanExample/None)'
ERROR: HTTPSConnectionPool(host='center.conan.io', port=443): Max retries exceeded with url: /v1/ping (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))
Unable to connect to conan-center=https://center.conan.io
1. Make sure the remote is reachable or,
2. Disable it by using conan remote disable,
Then try again.
CMake Error at build/conan.cmake:651 (message):
Conan install failed='1'
Call Stack (most recent call first):
CMakeLists.txt:199 (conan_cmake_install)
-- Configuring incomplete, errors occurred!
字面意思就是SSL证书验证失败了。
解决办法
删除~/.conan/cacert.pem
, 然后重试即可。