dlib hangs when building on Google Coral dev board
Asked Answered
A

3

6

I am struggling with installing latest version of dlib (http://dlib.net/, v19.17) for Python on the Google Coral Dev Board. It works well with Raspberry Pi 3 B+ (that seems to have exactly the same CPU and amount of RAM), but gets stuck on the Coral Dev Board at 80% (while compiling vector.cpp). This happens when you run running:

python3 setup.py install

I have tried following on Mendel Linux (that Dev Board runs) without any success:

  • upgrading the cmake to the latest version,
  • changing number of cores that setup.py uses to build dlib
  • adding SWAP file

The main difference I have seen between RPI and Coral/Mendel is older versions of cmake and gcc on Mendel.

I have upgraded cmake to the latest version without any success, but have not touched the gcc yet.

Amphibian answered 7/7, 2019 at 17:23 Comment(0)
C
2

How much swap space did you add to it? I added 1GB in /swapfile and it's finished building.

creating build/bdist.linux-aarch64
creating build/bdist.linux-aarch64/egg
copying build/lib.linux-aarch64-3.5/dlib.cpython-35m-aarch64-linux-gnu.so -> build/bdist.linux-aarch64/egg
creating stub loader for dlib.cpython-35m-aarch64-linux-gnu.so
byte-compiling build/bdist.linux-aarch64/egg/dlib.py to dlib.cpython-35.pyc
creating build/bdist.linux-aarch64/egg/EGG-INFO
copying dlib.egg-info/PKG-INFO -> build/bdist.linux-aarch64/egg/EGG-INFO
copying dlib.egg-info/SOURCES.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying dlib.egg-info/dependency_links.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying dlib.egg-info/not-zip-safe -> build/bdist.linux-aarch64/egg/EGG-INFO
copying dlib.egg-info/top_level.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
writing build/bdist.linux-aarch64/egg/EGG-INFO/native_libs.txt
creating dist
creating 'dist/dlib-19.18.0-py3.5-linux-aarch64.egg' and adding 'build/bdist.linux-aarch64/egg' to it
removing 'build/bdist.linux-aarch64/egg' (and everything under it)
Processing dlib-19.18.0-py3.5-linux-aarch64.egg
creating /usr/local/lib/python3.5/dist-packages/dlib-19.18.0-py3.5-linux-aarch64.egg
Extracting dlib-19.18.0-py3.5-linux-aarch64.egg to /usr/local/lib/python3.5/dist-packages
Adding dlib 19.18.0 to easy-install.pth file

Installed /usr/local/lib/python3.5/dist-packages/dlib-19.18.0-py3.5-linux-aarch64.egg
Processing dependencies for dlib==19.18.0
Finished processing dependencies for dlib==19.18.0
mendel@arid-valet:~ % python3 -c 'print(__import__("dlib").__version__)'
19.18.0

Although I'm not sure if you will get full benefit of the dev board by dlib on it. Since the dev board's main advantage for fast inference is the TPU, you're better off using the tflite_runtime APIs or the provided engine to run your inferences.

Carbonado answered 14/10, 2019 at 21:50 Comment(1)
also, FYI: cmake version 3.7.2 and I did not change number of cores to compile.Carbonado
R
1

@NamVu's solution worked for me: increase size of swapfile. I was also failing to compile dlib (version: 19.19.0, CMake: 3.7.2) at vector.cpp. I increased my swap to 2GB and was able to finish the build. I mounted an external SD card and large swap file according to this excellent guide. After mounting the SD card these were the steps from the guid to create the swap file:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Rudimentary answered 21/4, 2020 at 22:7 Comment(0)
A
0

It seems that the problem was with an outdated compiler version. It was fine after upgrading C compiler packages.

Amphibian answered 2/12, 2019 at 8:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.