You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

树莓派3(Raspbian Stretch)安装CMake失败求助

Fixing CMake Installation on Raspbian Stretch 2018-03-13 (Raspberry Pi 3)

Hey there! Let's work through this CMake issue you're facing. The error you're seeing happens because the 2018-03-13 Raspbian Stretch build uses outdated package sources that have been archived by Debian. Let's start with the most reliable fix, then move to manual extraction if needed.

First: Update Your APT Sources to Use Archived Repositories

Since Stretch is no longer supported, the default sources don't host the packages anymore. We need to point APT to the archive servers:

  1. Backup your original sources list first (just in case):
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
    
  2. Edit the sources list file with nano:
    sudo nano /etc/apt/sources.list
    
  3. Replace all existing content with these archive sources:
    deb http://archive.debian.org/debian stretch main contrib non-free
    deb-src http://archive.debian.org/debian stretch main contrib non-free
    deb http://archive.debian.org/debian-security stretch/updates main contrib non-free
    deb-src http://archive.debian.org/debian-security stretch/updates main contrib non-free
    
  4. Save and exit nano (press Ctrl+O, then Enter, then Ctrl+X).
  5. Add a config to bypass expired package signature checks (since archive packages are no longer signed with valid dates):
    sudo sh -c 'echo "Acquire::Check-Valid-Until \"false\";" >> /etc/apt/apt.conf.d/10-nocheckvalid'
    
  6. Update your package list and try installing again:
    sudo apt-get update && sudo apt-get install build-essential cmake pkg-config
    

If this works, you're all set! If not, let's go with manual extraction of a pre-compiled CMake binary.

Alternative: Manually Install Pre-Compiled CMake (Extracting Library/Binary Files)

This method involves downloading a pre-built CMake package for ARM architectures and copying its files to your system directories:

  1. Confirm your Raspberry Pi's architecture (should be armhf or armv7l):
    uname -m
    
  2. Download a compatible CMake version (we'll use 3.13.5, which works well with Stretch):
    wget https://github.com/Kitware/CMake/releases/download/v3.13.5/cmake-3.13.5-Linux-armhf.tar.gz
    
  3. Extract the tarball:
    tar -xzvf cmake-3.13.5-Linux-armhf.tar.gz
    
  4. Copy the extracted files to system-wide directories (this "extracts" the library/binary files to where your system can find them):
    sudo cp -r cmake-3.13.5-Linux-armhf/bin/* /usr/local/bin/
    sudo cp -r cmake-3.13.5-Linux-armhf/lib/* /usr/local/lib/
    sudo cp -r cmake-3.13.5-Linux-armhf/share/* /usr/local/share/
    
  5. Verify the installation worked:
    cmake --version
    

Note on pip install cmake

Just to clarify: the cmake package on PyPI is a Python wrapper for CMake, not the actual system CMake binary. That's why installing it didn't fix your issue—you need the standalone system tool, not the Python binding.

内容的提问来源于stack exchange,提问作者shawng

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 07:16:47