• 针对conan install下载source失败问题解决


    ps:下面操作是Linux系统,针对win操作系统也适合

    问题现象

    在运行conan install时,本地没有对应的库的缓存,conan会自动从conan center下载,可能会出现以下情况,重试多次,仍然是报错。

    1. libssh2/1.11.0: Calling source() in /root/.conan2/p/libss767f7ba6d9ff3/s/src
    2. libssh2/1.11.0: ERROR: Error downloading file https://github.com/libssh2/libssh2/releases/download/libssh2-1.11.0/libssh2-1.11.0.tar.xz: 'HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /libssh2/libssh2/releases/download/libssh2-1.11.0/libssh2-1.11.0.tar.xz (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f2ed1abbe10>: Failed to establish a new connection: [Errno -2] Name or service not known',))'
    3. libssh2/1.11.0: Waiting 5 seconds to retry...
    4. libssh2/1.11.0: ERROR: Error downloading file https://github.com/libssh2/libssh2/releases/download/libssh2-1.11.0/libssh2-1.11.0.tar.xz: 'HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /libssh2/libssh2/releases/download/libssh2-1.11.0/libssh2-1.11.0.tar.xz (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f2ed0b61c18>: Failed to establish a new connection: [Errno -2] Name or service not known',))'
    5. libssh2/1.11.0: Waiting 5 seconds to retry...
    6. ERROR: libssh2/1.11.0: Error in source() method, line 94
    7. get(self, **self.conan_data["sources"][self.version], strip_root=True)
    8. ConanException: Error downloading file https://github.com/libssh2/libssh2/releases/download/libssh2-1.11.0/libssh2-1.11.0.tar.xz: 'HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /libssh2/libssh2/releases/download/libssh2-1.11.0/libssh2-1.11.0.tar.xz (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f2ed0b75208>: Failed to establish a new connection: [Errno -2] Name or service not known',))'

    手动下载解决

    1、将日志中的url复制到浏览器,https://github.com/libssh2/libssh2/releases/download/libssh2-1.11.0/libssh2-1.11.0.tar.xz,进行手动下载。(可以开代理,或者IDM多线程下载)

    2、修改conanfile.py

    aii@debian:~/.conan2/p/libss767f7ba6d9ff3/e$ vi conanfile.py

    1. def source(self):
    2. # 将下载解压操作注释了
    3. # get(self, **self.conan_data["sources"][self.version], strip_root=True)
    4. apply_conandata_patches(self)

    3、运行一下conan install操作,这时会有报错:CMake Error: The source directory "/home/aii/.conan2/p/b/libss572bb9f56ef42/b/src" does not appear to contain CMakeLists.txt.没有关系,目的是跳过状态。删除新生产的目录rm -rf /home/aii/.conan2/p/b/libss572bb9f56ef42

    4、将下载成功后,将libssh2-1.11.0.tar.xz文件解压到对应目录/root/.conan2/p/libss767f7ba6d9ff3/s/src,注意src下是libssh2-1.11.0目录下的文件

    5、再次运行conan install操作,就正常了,直接编译,安装对应的库

  • 相关阅读:
    Unity——利用Mesh绘制图形
    C++ day1
    【Java基础面试二】、为什么Java代码可以实现一次编写、到处运行?
    MySQL数据库管理基本操作
    如何在Docker中列出容器
    Pytorch+cpp_cuda extension 课程一
    【LeetCode】206. 反转链表
    [python3] 发送微信 同步手机端
    GPT实战系列-使用LangChain内部工具
    yolo各模块详解
  • 原文地址:https://blog.csdn.net/cyujust/article/details/136484628