Installation guide for Facerecognition on a Pi4 with arm64 Debian Bullseye

Since it took my quite a while, I want to save some time for those who want to install Matias De Lellis facerecognition app on a Raspberry Pi4 (or 3) with the 64bit Raspberry OS, since there are no precompiled packages for dlib and pdlib and the Bullseye has C++11 installed, but not C++14.

Prepare the system and get the needed libs:

sudo apt-get install libx11-dev libopenblas-dev liblapack-dev php8.1-bz2

Then head over for the Dlib install (as described on the facerecognition website):

git clone GitHub - davisking/dlib: A toolkit for making real world machine learning and data analysis applications in C++
cd dlib/dlib
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON …
make
sudo make install

The next part needs a bit patching, install the pdlib:

git clone GitHub - goodspb/pdlib: PHP extension for Dlib.
cd pdlib

nano +50 config.m4
In this line and the next line (line 51) write “c++14” instead of “c++11”
save the file.

for your convenience:
nano +6 README.md
Edit “C++11” to “C++14”
save the file

phpize
PKG_CONFIG_PATH=/usr/lib/pkgconfig ./configure --enable-debug
make
sudo make install

Dlib and PDlib should both be compiled and installed.

Edit your /etc/php/x.x/cli/php.ini / /etc/php/x.x/fpm/php.ini / /etc/php/x.x/apache2/php.ini and add at the end:

[pdlib]
extension="pdlib.so"

Finally, head over to the apps page and install Facerecognition and configure it.