编译Milvus出现依赖冲突的现象

问题现象描述

编译报错,安装依赖时,依赖的版本有冲突。

1
2
3
ERROR: Conflict in opentelemetry-cpp/1.8.1.1@milvus/dev:
'opentelemetry-cpp/1.8.1.1@milvus/dev' requires 'thrift/0.17.0' while 'arrow/15.0.0' requires 'thrift/0.20.0'.
To fix this conflict you need to override the package 'thrift' in your root package.

关键过程、根本原因分析

两个组件依赖不同的thrift版本。可以强行指定一个都可以使用的版本。

结论、解决方案及效果

找到编译路径下的“~/milvus/internal/core/conanfile.py”文件,在继承ConanFile类中的函数configure中,添加冲突的依赖并强制覆盖:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from conans import ConanFile

class MilvusConan(ConanFile):
    def configure(self):
        if self.settings.arch not in ("x86_64", "x86"):
            del self.options["folly"].use_sse4_2
        if self.settings.os == "Macos":
            # By default abseil use static link but can not be compatible with macos X86
            self.options["abseil"].shared = True
            self.options["arrow"].with_jemalloc = False
        # 强制使用特定版本的 thrift
        self.requires("thrift/0.20.0", override=True)