如何在不使用 sudo 的情况下编译和安装 protobuf

以下是在你没有 root 权限的 Linux 系统上编译和安装 protobuf 的方法。在此示例中,我们将 protobuf 安装到 $HOME/usr

build_protobuf.sh
git clone -b v28.3 https://github.com/protocolbuffers/protobuf.git
git submodule update --init --recursive
cmake -DCMAKE_INSTALL_PREFIX=$HOME/usr .
make -j8 install

Check out similar posts by category: Protobuf, Linux