Skip to content

Instantly share code, notes, and snippets.

@naxvm
Created February 4, 2020 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naxvm/7c2f2c0433063a05b94ff25a92dad0be to your computer and use it in GitHub Desktop.
Save naxvm/7c2f2c0433063a05b94ff25a92dad0be to your computer and use it in GitHub Desktop.
Install protobuf-3.8.0 on Jetson TX2 (JetPack 4.2)
#!/bin/bash
# Original code by @jkjung-avt: https://github.com/jkjung-avt/jetson_nano/blob/master/install_protobuf-3.8.0.sh
# Modified by @naxvm in order to compile protobuf in a custom location with 4 threads
# and install it into a virtual environment.
#
set -e
folder=$1
mkdir -p $folder
echo "** Download protobuf-3.8.0 sources"
cd $folder
if [ ! -f protobuf-python-3.8.0.zip ]; then
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.8.0/protobuf-python-3.8.0.zip
fi
if [ ! -f protoc-3.8.0-linux-aarch_64.zip ]; then
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.8.0/protoc-3.8.0-linux-aarch_64.zip
fi
echo "** Install protoc"
unzip protobuf-python-3.8.0.zip
unzip protoc-3.8.0-linux-aarch_64.zip -d protoc-3.8.0
sudo cp protoc-3.8.0/bin/protoc /usr/local/bin/protoc
echo "** Build and install protobuf-3.8.0 libraries"
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
cd protobuf-3.8.0/
./autogen.sh
./configure --prefix=/usr/local
make -j4
make -j4 check
sudo make -j4 install
sudo ldconfig
echo "** Update python3 protobuf module"
# remove previous installation of python3 protobuf module
pip uninstall -y protobuf
pip install Cython
cd python/
python setup.py build --cpp_implementation
python setup.py test --cpp_implementation
python setup.py install --cpp_implementation
echo "** Build protobuf-3.8.0 successfully"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment