How to install PDlib on your Server💻 (EASY)

schBenedikt - Aug 10 '23 - - Dev Community

If you like our articles, we would appreciate a like and a comment!


Today we will show you how easy it is to install PDlib. You need this, for example, for face recognition in NextCloud, as in this article: Face Recognition in NextCloud • Schächner (xn--schchner-2za.de).


If you want us to help you with the installation, please write to us!


You can also use it to fix the following error: App "Face Recognition" cannot be installed because the following dependencies are not fulfilled: The library pdlib is not available.

But let's start right away:

First we edit a file:

sudo nano /etc/apt/sources.list.d/20-pdlib.list
There we need to add the package source at the end:

deb [signed-by=/usr/share/keyrings/delellis-archive-keyring.gpg arch=amd64] https://repo.delellis.com.ar jammy jammy
Enter fullscreen mode Exit fullscreen mode

After that we download the key with this command:

wget -O- https://repo.delellis.com.ar/repo.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/delellis-archive-keyring.gpg
That was the hardest part.

Now we still lead

sudo apt update
out and then we can take the package with you

sudo apt install php8.1-pdlib
to install.

Now we install PDlib "again" (specifically for the Face Recognition App):

For this we need some dependencies again

sudo apt-get install libx11-dev
sudo apt-get install libopenblas-dev liblapack-dev
sudo apt install cmake
sudo apt install php-dev
Then install the shared library (Dlib):

sudo git clone https://github.com/davisking/dlib.git
cd dlib/dlib
sudo mkdir build
CD build
sudo cmake -DBUILD_SHARED_LIBS=ON ..
sudo make
sudo make install
Now for the actual installation:

sudo git clone https://github.com/goodspb/pdlib.git
cd pdlib
sudo phpize
sudo ./configure --enable-debug
sudo make
sudo make install
So. We're done with the installation. 🥴

Now you only have to go into the php.ini file under the point ; dynamic extensions ; add the following content:

sudo nano /etc/php/8.2/cli/php.ini

[pdlib]
extension="pdlib.so"
Enter fullscreen mode Exit fullscreen mode

We're still testing that

sudo apt-get install php-bz2
sudo make test

Good luck and have fun!
Thanks for reading, Schächner

. . . . . . . . . . . . . .