启智平台安装protobuf不上
收藏回复举报
启智平台安装protobuf不上
t('forum.solved') 已解决
新人帖
发表于2024-09-14 11:13:16
0 查看

使用记录

为了让onnx将pytorch的pt权重文件转换为ckpt文件,所以我使用了MindConverter。根据文章要求,需要安装onnx的三个依赖包:

pip install onnx~=1.8.0
pip install onnxoptimizer~=0.1.2
pip install onnxruntime~=1.5.2

其中,onnxoptimizer配不成功,应该是我的arm架构造成的。然后根据文档提示,去配置protobuf,执行到下面指令时报错。

cmake ../cmake -Dprotobuf_BUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/protobuf -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release

一开始的错误是bash找不到cmake,我使用的启智平台自带的MindSpore虚拟环境,在/usr/的路径下我能看见cmake!于是使用apt-get,这个平台也识别不了这个指令,sudo命令更用不了。
后面看见issue中提到使用 conda install cmake 可行,这样安装后,cmake可以使用,但是执行上面的命令仍报错:

(MindSpore) [ma-user build_source]$cmake ../cmake -Dprotobuf_BUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/protobuf -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /home/ma-user/anaconda3/envs/MindSpore/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/home/ma-user/work/protobuf/build_source/CMakeFiles/CMakeScratch/TryCompile-DJ5duj'
    
    Run Build Command(s): /home/ma-user/anaconda3/envs/MindSpore/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_31521/fast
    /usr/bin/gmake  -f CMakeFiles/cmTC_31521.dir/build.make CMakeFiles/cmTC_31521.dir/build
    gmake[1]: Entering directory '/home/ma-user/work/protobuf/build_source/CMakeFiles/CMakeScratch/TryCompile-DJ5duj'
    Building C object CMakeFiles/cmTC_31521.dir/testCCompiler.c.o
    /usr/bin/cc   -fPIE -o CMakeFiles/cmTC_31521.dir/testCCompiler.c.o -c /home/ma-user/work/protobuf/build_source/CMakeFiles/CMakeScratch/TryCompile-DJ5duj/testCCompiler.c
    Linking C executable cmTC_31521
    /home/ma-user/anaconda3/envs/MindSpore/bin/cmake -E cmake_link_script CMakeFiles/cmTC_31521.dir/link.txt --verbose=1
    /usr/bin/cc -rdynamic CMakeFiles/cmTC_31521.dir/testCCompiler.c.o -o cmTC_31521
    collect2: fatal error: cannot find 'ld'
    compilation terminated.
    gmake[1]: *** [CMakeFiles/cmTC_31521.dir/build.make:99: cmTC_31521] Error 1
    gmake[1]: Leaving directory '/home/ma-user/work/protobuf/build_source/CMakeFiles/CMakeScratch/TryCompile-DJ5duj'
    gmake: *** [Makefile:127: cmTC_31521/fast] Error 2
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:20 (project)


-- Configuring incomplete, errors occurred!

希望能够快速得到解决!!!

我要发帖子