鲲鹏社区首页
中文
注册
开发者
我要评分
获取效率
正确性
完整性
易理解
在线提单
论坛求助

下载Eigen库失败导致编译ONNX Runtime中断的解决办法

问题现象描述

执行编译ONNX Runtime命令过程中下载Eigen库失败导致编译ONNX Runtime中断,报错信息如下所示:

-- Hash mismatch, removing... 
 -- Using src='https://gitlab.com/libeigen/eigen/-/archive/e7248b26a1ed53fa030c5c459f7ea095dfd276ac/eigen-e7248b26a1ed53fa030c5c459f7ea095dfd276ac.zip' 
 -- verifying file... 
        file='/home/rrx/testKonnx/onnxruntime/onnxruntime-1.19.2/build/RelWithDebInfo/_deps/eigen-subbuild/eigen-populate-prefix/src/eigen-e7248b26a1ed53fa030c5c459f7ea095dfd276ac.zip' 
 -- SHA1 hash of 
     /home/rrx/testKonnx/onnxruntime/onnxruntime-1.19.2/build/RelWithDebInfo/_deps/eigen-subbuild/eigen-populate-prefix/src/eigen-e7248b26a1ed53fa030c5c459f7ea095dfd276ac.zip 
   does not match expected value 
     expected: 'be8be39fdbc6e60e94fa7870b280707069b5b81a' 
       actual: '32b145f525a8308d7ab1c09388b2e288312d8eba' 
 -- Hash mismatch, removing... 
 CMake Error at eigen-subbuild/eigen-populate-prefix/src/eigen-populate-stamp/download-eigen-populate.cmake:163 (message): 
   Each download failed! 
  
      
      
  
  
 gmake[2]: *** [CMakeFiles/eigen-populate.dir/build.make:100: eigen-populate-prefix/src/eigen-populate-stamp/eigen-populate-download] Error 1 
 gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/eigen-populate.dir/all] Error 2 
 gmake: *** [Makefile:91: all] Error 2 
 CMake Error at /home/rrx/usr/cmake-3.30.0/Modules/FetchContent.cmake:1918 (message): 
   Build step for eigen failed: 2 
 Call Stack (most recent call first): 
   /home/rrx/usr/cmake-3.30.0/Modules/FetchContent.cmake:1609 (__FetchContent_populateSubbuild) 
   /home/rrx/usr/cmake-3.30.0/Modules/FetchContent.cmake:2145:EVAL:2 (__FetchContent_doPopulation) 
   /home/rrx/usr/cmake-3.30.0/Modules/FetchContent.cmake:2145 (cmake_language) 
   /home/rrx/usr/cmake-3.30.0/Modules/FetchContent.cmake:1978:EVAL:1 (__FetchContent_Populate) 
   /home/rrx/usr/cmake-3.30.0/Modules/FetchContent.cmake:1978 (cmake_language) 
   external/eigen.cmake:12 (FetchContent_Populate) 
   external/onnxruntime_external_deps.cmake:500 (include) 
   CMakeLists.txt:598 (include) 
  
  
 -- Configuring incomplete, errors occurred! 
 Traceback (most recent call last): 
   File "/home/rrx/testKonnx/onnxruntime/onnxruntime-1.19.2/tools/ci_build/build.py", line 2971, in <module> 
     sys.exit(main()) 
   File "/home/rrx/testKonnx/onnxruntime/onnxruntime-1.19.2/tools/ci_build/build.py", line 2826, in main 
     generate_build_tree( 
   File "/home/rrx/testKonnx/onnxruntime/onnxruntime-1.19.2/tools/ci_build/build.py", line 1664, in generate_build_tree 
     run_subprocess( 
   File "/home/rrx/testKonnx/onnxruntime/onnxruntime-1.19.2/tools/ci_build/build.py", line 860, in run_subprocess 
     return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env) 
   File "/home/rrx/testKonnx/onnxruntime/onnxruntime-1.19.2/tools/python/util/run.py", line 49, in run 
     completed_process = subprocess.run( 
   File "/usr/lib64/python3.9/subprocess.py", line 528, in run 
     raise CalledProcessError(retcode, process.args, 
 subprocess.CalledProcessError: Command '['/home/rrx/usr/cmake-3.30.0/bin/cmake', '/home/rrx/testKonnx/onnxruntime/onnxruntime-1.19.2/cmake', '--compile-no-warning-as-error', '-Donnxruntime_RUN_ONNX_TESTS=OFF', '-Donnxruntime_GENERATE_TEST_REPORTS=ON', '-DPython_EXECUTABLE=/bin/python3', '-DPYTHON_EXECUTABLE=/bin/python3', '-Donnxruntime_USE_MIMALLOC=OFF', '-Donnxruntime_ENABLE_PYTHON=OFF', '-Donnxruntime_BUILD_CSHARP=OFF', '-Donnxruntime_BUILD_JAVA=OFF', '-Donnxruntime_BUILD_NODEJS=OFF', '-Donnxruntime_BUILD_OBJC=OFF', '-Donnxruntime_BUILD_SHARED_LIB=ON', '-Donnxruntime_BUILD_APPLE_FRAMEWORK=OFF', '-Donnxruntime_USE_DNNL=OFF', '-Donnxruntime_USE_NNAPI_BUILTIN=OFF', '-Donnxruntime_USE_VSINPU=OFF', '-Donnxruntime_USE_RKNPU=OFF', '-Donnxruntime_USE_LLVM=OFF', '-Donnxruntime_ENABLE_MICROSOFT_INTERNAL=OFF', '-Donnxruntime_USE_VITISAI=OFF', '-Donnxruntime_USE_TENSORRT=OFF', '-Donnxruntime_USE_TENSORRT_BUILTIN_PARSER=ON', '-Donnxruntime_USE_TVM=OFF', '-Donnxruntime_TVM_CUDA_RUNTIME=OFF', '-Donnxruntime_TVM_USE_HASH=OFF', '-Donnxruntime_USE_MIGRAPHX=OFF', '-Donnxruntime_DISABLE_CONTRIB_OPS=OFF', '-Donnxruntime_DISABLE_ML_OPS=OFF', '-Donnxruntime_DISABLE_RTTI=OFF', '-Donnxruntime_DISABLE_EXCEPTIONS=OFF', '-Donnxruntime_MINIMAL_BUILD=OFF', '-Donnxruntime_EXTENDED_MINIMAL_BUILD=OFF', '-Donnxruntime_MINIMAL_BUILD_CUSTOM_OPS=OFF', '-Donnxruntime_REDUCED_OPS_BUILD=OFF', '-Donnxruntime_USE_DML=OFF', '-Donnxruntime_USE_WINML=OFF', '-Donnxruntime_BUILD_MS_EXPERIMENTAL_OPS=OFF', '-Donnxruntime_USE_TELEMETRY=OFF', '-Donnxruntime_ENABLE_LTO=OFF', '-Donnxruntime_USE_ACL=OFF', '-Donnxruntime_USE_ACL_1902=OFF', '-Donnxruntime_USE_ACL_1905=OFF', '-Donnxruntime_USE_ACL_1908=OFF', '-Donnxruntime_USE_ACL_2002=OFF', '-Donnxruntime_USE_ACL_2308=OFF', '-Donnxruntime_USE_ARMNN=OFF', '-Donnxruntime_ARMNN_RELU_USE_CPU=ON', '-Donnxruntime_ARMNN_BN_USE_CPU=ON', '-Donnxruntime_USE_JSEP=OFF', '-Donnxruntime_ENABLE_NVTX_PROFILE=OFF', '-Donnxruntime_ENABLE_TRAINING=OFF', '-Donnxruntime_ENABLE_TRAINING_OPS=OFF', '-Donnxruntime_ENABLE_TRAINING_APIS=OFF', '-Donnxruntime_ENABLE_CPU_FP16_OPS=OFF', '-Donnxruntime_USE_NCCL=OFF', '-Donnxruntime_BUILD_BENCHMARKS=OFF', '-Donnxruntime_USE_ROCM=OFF', '-Donnxruntime_GCOV_COVERAGE=OFF', '-Donnxruntime_USE_MPI=OFF', '-Donnxruntime_ENABLE_MEMORY_PROFILE=OFF', '-Donnxruntime_ENABLE_CUDA_LINE_NUMBER_INFO=OFF', '-Donnxruntime_USE_CUDA_NHWC_OPS=OFF', '-Donnxruntime_BUILD_WEBASSEMBLY_STATIC_LIB=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING=ON', '-Donnxruntime_ENABLE_WEBASSEMBLY_API_EXCEPTION_CATCHING=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_THROWING=ON', '-Donnxruntime_WEBASSEMBLY_RUN_TESTS_IN_BROWSER=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_THREADS=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO=OFF', '-Donnxruntime_ENABLE_WEBASSEMBLY_PROFILING=OFF', '-Donnxruntime_ENABLE_LAZY_TENSOR=OFF', '-Donnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS=OFF', '-Donnxruntime_ENABLE_CUDA_PROFILING=OFF', '-Donnxruntime_ENABLE_ROCM_PROFILING=OFF', '-Donnxruntime_USE_XNNPACK=OFF', '-Donnxruntime_USE_WEBNN=OFF', '-Donnxruntime_USE_CANN=OFF', '-Donnxruntime_USE_TRITON_KERNEL=OFF', '-Donnxruntime_DISABLE_FLOAT8_TYPES=OFF', '-Donnxruntime_DISABLE_SPARSE_TENSORS=OFF', '-Donnxruntime_DISABLE_OPTIONAL_TYPE=OFF', '-DCMAKE_OSX_ARCHITECTURES=arm64', '-DCMAKE_TLS_VERIFY=ON', '-DFETCHCONTENT_QUIET=OFF', '-DCMAKE_BUILD_TYPE=RelWithDebInfo', '-DCMAKE_PREFIX_PATH=build/RelWithDebInfo/installed']' returned non-zero exit status 1.

关键过程、根本原因分析

在下载Eigen库时出现了哈希值不匹配的问题,导致下载失败。CMake期望的SHA1哈希值是“be8be39fdbc6e60e94fa7870b280707069b5b81a”,但实际下载的文件哈希值是 “32b145f525a8308d7ab1c09388b2e288312d8eba”

结论、解决方案及效果

在ONNX Runtime源代码中查找预期哈希值,并将其替换为实际下载值。

  1. 打开“/path/to/ONNX_Runtime/onnxruntime-1.19.2”文件。
    cd /path/to/ONNX_Runtime/onnxruntime-1.19.2
  2. 搜索包含该哈希值的文件。
    grep -r "be8be39fdbc6e60e94fa7870b280707069b5b81a" .

    回显如下所示:

  3. 替换预期哈希值。
    grep -r "be8be39fdbc6e60e94fa7870b280707069b5b81a" . | cut -d: -f1 | sort -u | xargs sed -i.bak 's/be8be39fdbc6e60e94fa7870b280707069b5b81a/32b145f525a8308d7ab1c09388b2e288312d8eba/g'
  4. 重新编译ONNX Runtime即可。