离线编译 tikv 失败

上不了外网,就想办法用 cargo vendor 下了一份vendor。期间解决了 crossbeam 和encoding_rs的版本冲突问题。
现在用Dockerfile 编译,报错。
对Dockerfie的修改:
https://github.com/tikv/tikv/blob/v5.4.0/Dockerfile
在79行增加了
ADD vendor vendor
然后把 cargo vendor 生成的依赖放到了 etc/cargo.config.dist里面了

开始编译:
docker build .
报错:

    For compatibility with older versions of CMake, try_compile is not honoring
    caller config-specific compiler flags (e.g.  CMAKE_C_FLAGS_DEBUG) in the
    test project.
  Call Stack (most recent call first):
    /usr/share/cmake3/Modules/CMakeTestCXXCompiler.cmake:67 (CMAKE_DETERMINE_COMPILER_ABI)
    CMakeLists.txt:2 (project)
  This warning is for project developers.  Use -Wno-dev to suppress it.

     Called from: [3]   /usr/share/cmake3/Modules/CMakeDetermineCompilerABI.cmake
                  [2]   /usr/share/cmake3/Modules/CMakeTestCXXCompiler.cmake
                  [1]   /tikv/vendor/libtitan_sys/titan/CMakeLists.txt
  CMake Warning (dev) at /usr/share/cmake3/Modules/CMakeDetermineCompilerABI.cmake:48 (try_compile):
    Policy CMP0056 is not set: Honor link flags in try_compile() source-file
    signature.  Run "cmake --help-policy CMP0056" for policy details.  Use the
    cmake_policy command to set the policy and suppress this warning.

    For compatibility with older versions of CMake, try_compile is not honoring
    caller link flags (e.g.  CMAKE_EXE_LINKER_FLAGS) in the test project.
  Call Stack (most recent call first):
    /usr/share/cmake3/Modules/CMakeTestCXXCompiler.cmake:67 (CMAKE_DETERMINE_COMPILER_ABI)
    CMakeLists.txt:2 (project)
  This warning is for project developers.  Use -Wno-dev to suppress it.

     Called from: [3]   /usr/share/cmake3/Modules/CMakeDetermineCompilerABI.cmake
                  [2]   /usr/share/cmake3/Modules/CMakeTestCXXCompiler.cmake
                  [1]   /tikv/vendor/libtitan_sys/titan/CMakeLists.txt
  CMake Error at cmake/rocksdb_flags.cmake:14 (find_package):
    By not providing "Findsnappy.cmake" in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by "snappy", but
    CMake did not find one.

    Could not find a package configuration file provided by "snappy" with any
    of the following names:

      snappyConfig.cmake
      snappy-config.cmake

    Add the installation prefix of "snappy" to CMAKE_PREFIX_PATH or set
    "snappy_DIR" to a directory containing one of the above files.  If "snappy"
    provides a separate development package or SDK, be sure it has been
    installed.
  Call Stack (most recent call first):
    CMakeLists.txt:31 (include)


     Called from: [2]   /tikv/vendor/libtitan_sys/titan/cmake/rocksdb_flags.cmake
                  [1]   /tikv/vendor/libtitan_sys/titan/CMakeLists.txt
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 1

  build script failed, must exit now', /tikv/vendor/cmake/src/lib.rs:894:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

然后尝试在79行增加
yum install -y snappy snappy-devel
再次编译,依然报上面的错。

请大神帮忙看看!谢谢

这么感觉像是cmake的版本问题呢,为啥要自己编译镜像呢,何苦呢, :rofl:

用的是仓库里的dockerfile编译的,如果说这个dockerfile编译不成功,那仓库里的dockerfile得改下。
自己编译才可以调试啊,才能更好的学习啊 :stuck_out_tongue:

我看到这个文章说是缺路径,配置一下试试
(1条消息) By not providing “Findcatkin.cmake“ in CMAKE_MODULE_PATH this project has asked CMake to find a pa_anson0537的博客-CSDN博客

最终离线编译成功。
期间遇到几次问题:

  1. cargo vendor 下载下来的代码,放在了tikv的vendor目录,但是tikv下面有个.gitignore,会忽略掉core的文件,导致vendor里面core的内容无法推送到git上,然后另一边下载的时候就下载失败了。
  2. 用Cargo vendor 把依赖全下载下来,但是有2个仓库版本冲突:
    原因是 creates-io 里面托管了一个官方版本,但是tikv自己做了一些bug修改,没有修改版本号。
    解决办法:把tikv的修改clone到私有仓库,然后修改版本号为creates-io里不存在的版本。
  3. rust_rocksdb 的子仓库中的titan总是编译失败,报snappy找不到,但是不用vendor的时候就可以编译,最终选择了从etc/cargo.config.dist中注释掉rust_rocksdb的vendor,编译时直接从仓库下载代码。

3 是一个折衷方案,相当于还是得在线下代码,只不过只需要下载1个代码仓库,相对好处理些。最终怎么解决没有继续找办法。

1 个赞

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。