HowTo build dlib on TX1(AArch64 CPU)

  1. (Optional) For the best performance, first install openBLAS.
    $ sudo apt-get install libopenblas-dev
  2. Download latest dlib stable archive [here]
  3. Extract and change working directory into it. Then creat a directory to put our build file.
(dlib src dir)$ mkdir build
(dlib src dir)$ cd build
(dlib src dir)/build$ cmake .. -DDLIB_USE_CUDA=ON -DCMAKE_C_FLAGS ="-O3 -fprofile-use -DENABLE_NEON" -DNEON=ON -DDLIB_PNG_SUPPORT=ON -DDLIB_JPEG_SUPPORT=ON
(dlib src dir)$ cmake --build .
  1. Install, done.
    sudo make install

For some other ARM platforms, you might face a memory exhausted problem while compiling. Here is the solution below.

  1. Open /etc/dphys-swapfile with your favorite editor. For example I use vi.
    $ sudo vi /etc/dphys-swapfile
  2. Change CONF_SWAPSIZE=100 to CONF_SWAPSIZE=1024
  3. Then $ sudo /etc/init.d/dphys-swapfile restart

After compile just change CONF_SWAPSIZE=1024 back to default CONF_SWAPSIZE=100 then do step 3 again.

Related Article