可以按照以下步骤进行操作:

  1. 确保已经设置好交叉编译工具链并将其添加到系统的环境变量中。

  2. 打开终端,进入你想要存放源码的目录:

    cd /path/to/source/directory
    
  3. 使用git命令克隆zip库的源码仓库:

    git clone https://github.com/nih-at/libzip.git
    
  4. 进入源码目录:

    cd libzip
    
  5. 创建一个用于交叉编译的构建目录,并进入该目录:

    mkdir build && cd build
    
  6. 配置交叉编译环境:

    export CC=/path/to/cross-compiler   # 设置交叉编译工具链的路径和前缀
    export CXX=/path/to/cross-compiler  # 设置交叉编译工具链的路径和前缀
    export AR=/path/to/cross-ar         # 设置交叉编译工具链的静态库归档工具路径
    export RANLIB=/path/to/cross-ranlib # 设置交叉编译工具链的ranlib工具路径
    
  7. 运行CMake进行配置:

    cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install/directory
    

    在上述命令中,/path/to/install/directory 是你希望安装zip库的路径。

  8. 运行make命令进行编译:

    make
    
  9. 运行make install命令安装编译后的库文件和头文件到指定目录:

    make install
    
10-25 17:44