When compiling GRPC
on Balena Docker, Balena OS restarts itself after a certain progress. Here is what GRPC part looks like when compiling:
# Install GRPC
RUN echo "Installing GRPC"
ENV GRPC_VERSION=v1.32.0
# https://github.com/grpc/grpc/blob/master/test/distrib/cpp/run_distrib_test_raspberry_pi.sh
RUN GRPC_DIR=/grpc && \
git clone --depth 1 --branch $GRPC_VERSION --recurse-submodules https://github.com/grpc/grpc.git $GRPC_DIR && \
# gRPC on the host
GRPC_BUILD_DIR=$GRPC_DIR/cmake/build && \
mkdir -p $GRPC_BUILD_DIR && \
cd $GRPC_BUILD_DIR && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_SSL_PROVIDER=package \
../.. && \
make install && \
cd ../../.. && rm -rf $GRPC_DIR
The base image used was balenalib/raspberrypi3-debian
.
For overcoming the issue, I had to make sure that CPU freq is always at highest by specifying force_turbo=1
in /boot/config.txt
. This prevented Balena OS from restarting in the middle of the compilation. I thought that restarting can be because of very much high processing required during GRPC compilation.
Not sure if it is a bug or I was missing something.