LoginSignup
2
0

More than 1 year has passed since last update.

Raspberry Pi Zero2 W を使ってAmazon Kinesis Video Streams(CPP)のビルド

Posted at

1. 概要

以前、Raspberry Pi Zero WHにBuster(Debian 10)をで試したことを、Pi Zero2 Wにbullseye(Debian 11)でやり直そうとしたときに「 index-pack died of signal 9」が出てcmakeが成功しなかった。とりあえずの回避策を書いておく。

以前の記事

2. 手順

2.1. OSインストール

Raspberry Pi Imangerを使って、bullseye 64bit Liteをインストールする。

2.2. アップデートやライブラリインストール

今回の件と関係ない気がするのだが、事前に行った操作を記載。

$ sudo apt update
$ sudo apt upgrade
$ sudo apt -y install libssl-dev libcurl4-openssl-dev liblog4cplus-dev cmake m4 git
$ sudo apt -y install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-bad gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-tools 

3. Amazon Kinesis Video Streams Producerのビルド

gitリポジトリをクローンしてビルドする。これらは公式に乗っている手順。

$ git clone https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp
$ mkdir -p amazon-kinesis-video-streams-producer-sdk-cpp/build
$ cd amazon-kinesis-video-streams-producer-sdk-cpp/build
$ cmake -DBUILD_GSTREAMER_PLUGIN=ON ..
$ make

4. 問題発生

cmake中にエラーが出て、最終的に「-- Configuring incomplete, errors occurred!」と表示される。
gitの処理中のエラーっぽい。

Submodule 'boringssl' (https://boringssl.googlesource.com/boringssl) registered for path 'boringssl'
Submodule 'krb5' (https://github.com/krb5/krb5) registered for path 'krb5'
Submodule 'pyca.cryptography' (https://github.com/pyca/cryptography.git) registered for path 'pyca-cryptography'
Cloning into '/home/outlaw/work/amazon-kinesis-video-streams-producer-sdk-cpp/open-source/local/libopenssl/build/src/project_libopenssl/boringssl'...
error: index-pack died of signal 9
fatal: index-pack failed
fatal: clone of 'https://boringssl.googlesource.com/boringssl' into submodule path '/home/outlaw/work/amazon-kinesis-video-streams-producer-sdk-cpp/open-source/local/

5. 対策

「index-pack died of signal 9」は大きなgitリポジトリを取得しようとしたときに出るエラーらしい。メモリ不足が原因とのこと。
「boringssl.googlesource.com/boringssl」をPCでcloneしてみたら、314MBだった。しかし、メモリ上に落とすとは思えないのだが。

これの対策にはサーバー側で行うもの、clone時にdepthを一旦浅くするものがあるようだが、後段でも同じことが起きたら面倒なので、SWAPを広げて一時対策することにした。
というか、cmakeでgitのdepthを変更する方法がわからなかった。

5.1. SWAPを増やす

サービスを止めて、設定値を変更、サービスを再開する。OSの再起動などは不要。

$ sudo service dphys-swapfile stop
$ sudo nano /etc/dphys-swapfile

100 -> 500へ変更してファイル保存.

$ sudo service dphys-swapfile start

気になる場合は終わってからもとに戻せばよい.

6. 結論

Amazon Kinesis Video Streams(CPP)のcmakeがRaspberry Pi Zero2 Wでも完了するようになった。
他のRaspberry Piでも起きるのかもしれないと不安である。

以上

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0