centos7编译安装libzip-1.5.1

  1. 官网下载最新的libzip 地址
  2. centos上wget 下载
    1. wget https://libzip.org/download/libzip-1.5.1.tar.gz
  3. 解压
    1. tar -zxvf libzip-1.5.1.tar.gz
  4. 进入的libzip-1.5.1 目录
    1. cd libzip-1.5.1
  5. 编译安装
    1. mkdir build && cd build && cmake .. && make && make install

报错:

CMake Error at CMakeLists.txt:4 (CMAKE_MINIMUM_REQUIRED):
CMake 3.0.2 or higher is required. You are running version 2.8.12.2

解决办法:
  1. 卸载系统自带的cmake
    1. yum remove cmake
  2. 官网下载最新的cmake 3.13.3 地址
  3. centos直接下载
    1. wget https://github.com/Kitware/CMake/releases/download/v3.13.3/cmake-3.13.3.tar.gz
  4. 解压
    1. tar -zxvf cmake-3.13.3.tar.gz
  5. 安装 gcc 等必备程序包(已经安装 gcc 则略过此步)
    1. gcc C C++ 的编译工具,我的 CentOS 中有 gcc 所以就不用安装了,但是没有安装的话,执行以下命令:
    2. yum install -y gcc gcc-c++ make automake
  6. 进入目录
    1. cd cmake-3.13.3
  7. 执行编译
    1. ./bootstrap
  8. 安装
    1. gmake && gmake install
  9. 测试看下安装成功没
    1. cmake -version
    2. /usr/bin/cmake: No such file or directory
    3. 因为直接使用cmake系统回到默认的/usr/bin中去寻找,但是src中安装的cmake是在/usr/local/bin中,所以当然不会找到。解决方法:
    4. 做一个链接即可:ln -s /usr/local/bin/cmake /usr/bin
    5. 然后使用/usr/local/bin/cmake进行编译。

继续安装 libzip

  1. mkdir build && cd build && cmake .. && make && make install