1 下载snappy
wget https://kojipkgs.fedoraproject.org//vol/fedora_koji_archive00/packages/snappy/1.1.0/1.fc19/src/snappy-1.1.0-1.fc19.src.rpm
rpm -ivh snappy-1.1.0-2.fc20.src.rpm
2 rpmbuild -ba /root/rpmbuild/SPECS/snappy.spec
【error: Failed build dependencies:
gtest-devel is needed by snappy-1.1.0-2.el7.aarch64】
安装gtest
安装 gcc cmake gcc-c++ python2-devel
yum install -y cmake gcc gcc-c++ python2-devel
安装 gtest
wget https://kojipkgs.fedoraproject.org//packages/gtest/1.8.1/1.fc30/src/gtest-1.8.1-1.fc30.src.rpm
rpm -ivh gtest
rpmbuild -ba /root/rpmbuild/SPECS/gtest.spec
报错:
【CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool】
安装make
yum install -y make
报错:
【CMake Error at /usr/share/cmake/Modules/WriteBasicConfigVersionFile.cmake:39 (message):
No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()】
解决好久都不行
编译安装 gtest:
解压
cd googletest-release-1.8.1
mkdir build && cd build
cmake .. && make
将生成的libgtest.a和libgtest_main.a, 复制到/usr/local/lib/下去 或者 make install
cp ./googlemock/gtest/libgtest_main.a /usr/local/lib/
cp ./googlemock/gtest/libgtest.a /usr/local/lib/
将include中的gtest文件夹复制到/usr/local/include
cp -r ./googletest/include/gtest /usr/local/include/
安装 gtest-devel
wget http://rpmfind.net/linux/fedora/linux/releases/28/Everything/aarch64/os/Packages/g/gtest-devel-1.8.0-3.fc28.aarch64.rpm
rpm -ivh gtest-devel-1.8.0-3.fc28.aarch64.rpm --force --nodeps
最后安装snappy:
rpmbuild -ba /root/rpmbuild/SPECS/snappy.spec
执行成功:
cd /root/rpmbuild/RPMS
安装 rpm即可。