Building the Google Protobuf library

You use two versions of the Google Protobuf library. One version of the library runs on your virtual machine and the other runs on your Raspberry Pi.

Building the Google Protobuf library for your virtual machine

To build the Google Protobuf library for your virtual machine:

  1. Enter the following commands:

    cd $BASEDIR/protobuf
    git submodule update --init --recursive
    ./autogen.sh ./configure --prefix=$BASEDIR/protobuf-host make

    Arm estimates that your virtual machine will take approximately 15 minutes to execute these commands.

  2. Enter the following commands:

    make install
    make clean

Building the Google Protobuf library for your Raspberry Pi

    To build the Google Protobuf library for your Raspberry Pi:

  1. Enter the following commands:

    ./configure --prefix=$BASEDIR/protobuf-arm --host=arm-linux CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ --with-protoc=$BASEDIR/protobuf-host/bin/protoc
    make

    Arm estimates that your virtual machine will take approximately 15 minutes to execute these commands.

  2. Enter the following command:

    make install

Generating the TensorFlow Protobuf library

To generate the TensorFlow library, enter the following command:

cd $BASEDIR/tensorflow
../armnn/scripts/generate_tensorflow_protobuf.sh ../tensorflow-protobuf ../protobuf-host

Building ONNX

To build ONNX, enter the following commands:

cd $BASEDIR/onnx

export LD_LIBRARY_PATH=$BASEDIR/protobuf-host/lib:$LD_LIBRARY_PATH        
$BASEDIR/protobuf-host/bin/protoc onnx/onnx.proto --proto_path=. --proto_path=$BASEDIR/protobuf-host/include --cpp_out $BASEDIR/onnx

 

Building FlatBuffers

To build FlatBuffers, enter the following commands:

cd flatbuffers-1.12.0
rm -f CMakeCache.txt
rm -rf build
mkdir build
cd build
CXXFLAGS="-fPIC" cmake .. -DFLATBUFFERS_BUILD_FLATC=1 \
-DCMAKE_INSTALL_PREFIX:PATH=$WORKING_DIR/flatbuffers
make all install

Building FlatBuffers for your Raspberry Pi

To build FlatBuffers for your Raspberry Pi, enter the following commands:

cd $BASEDIR/flatbuffers-1.12.0
mkdir build-arm32
cd build-arm32
CXXFLAGS="-fPIC" cmake .. -DCMAKE_C_COMPILER=/usr/bin/arm-linux-gnueabihf-gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/arm-linux-gnueabihf-g++ \
-DFLATBUFFERS_BUILD_FLATC=1 \
-DCMAKE_INSTALL_PREFIX:PATH=$BASEDIR/flatbuffers-arm32 \
-DFLATBUFFERS_BUILD_TESTS=0
make all install

Building FlatBuffers for your Raspberry Pi

To build TensorFlow Lite, enter the following commands:

cd $BASEDIR
mkdir tflite
cd tflite
cp $BASEDIR/tensorflow/tensorflow/lite/schema/schema.fbs .       
$BASEDIR/flatbuffers-1.12.0/build/flatc -c --gen-object-api --reflect-types --reflect-names schema.fbs
Previous Next