Import dlib on Jetson NX got Illegal instruction (core dumped)

JetPack version: 4.6

I am trying to use dlib (GPU) on Jetson Xavier NX, following are my steps to install dlib

dowload repo: https://github.com/davisking/dlib
cd dlib-master
mkdir build
cd build/
cmake .. -DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1
cmake --build .
cd ..
sudo python3 setup.py install --set USE_AVX_INSTRUCTIONS=1 --set DLIB_USE_CUDA=1

When I run import dlib

Illegal instruction (core dumped)

How to solve this issue?

AVX instruction set is for Intel/x86 architecture only. SimplyYou may want to try building dlib without this option…

Hi @dkreutz ,

I noticed that, and I think it didn’t be the point. Due to the message,

CMake Warning:
  Manually-specified variables were not used by the project:

    USE_AVX_INSTRUCTIONS

it seems that it directly ignore this term while compiling.

Assuming you are using Numpy you might have this issue: Illegal instruction (core dumped) on import for numpy 1.19.5 on ARM64 · Issue #18131 · numpy/numpy · GitHub

setting environment variable OPENBLAS_CORETYPE=ARMV8 should help in this case

Yes, I read this post yesterday, so I already change the version of numpy, now is 1.19.4.

For " setting environment variable OPENBLAS_CORETYPE=ARMV8"
is this should be done before install dlib? I already did it after installing dlib but it still not work. if this need to be done before dlib installing, maybe I can give it a try.

Type export OPENBLAS_CORETYPE=ARMV8 on the console before running any application/python script that uses Numpy.

You may want toadd this as last line to your ~/.profile to make this permant…

Hi @dkreutz,

Thanks for your advice. I just figured out it probably caused by the following error.

File "/usr/local/lib/python3.6/dist-packages/dlib-19.22.99-py3.6-linux-aarch64.egg/dlib/__init__.py", line 19, in <module>
    from _dlib_pybind11 import *
ImportError: /usr/local/lib/python3.6/dist-packages/dlib-19.22.99-py3.6-linux-aarch64.egg/_dlib_pybind11.cpython-36m-aarch64-linux-gnu.so: undefined symbol: png_riffle_palette_neon

is there any suggestion on this issue?

Might be this problem: Import Error: undefined symbol: png_riffle_palette_neon

Hi @dkreutz ,

Thanks for quickly response.
I tried the solution “sudo apt-get install libpng-dev”, but still the same problem.

Looks like there is a bug in latest dlib. Is this your issue?

Can you try an older dlib version, maybe 19.19?

After trying to install dlib-19.19, get the following message mentioned that do not use cudnn

Checking if you have the right version of cuDNN installed.
-- *** Found cuDNN, but it looks like the wrong version so dlib will not use it.              ***
-- *** Dlib requires cuDNN V5.0 OR GREATER.  Since cuDNN is not found DLIB WILL NOT USE CUDA. ***
-- *** If you have cuDNN then set CMAKE_PREFIX_PATH to include cuDNN's folder.                ***
-- Disabling CUDA support for dlib.  DLIB WILL NOT USE CUDA

what’s the path that I should set for CMAKE_PREFIX_PATH, where is normally cudnn existing?

cuDNN shared libraries are located at /usr/lib/aarch64-linux-gnu
cuDNN header files are located at /usr/include/aarch64-linux-gnu/

@dkreutz
Thanks for the response. How to set CMAKE_PREFIX_PATH?
Not sure is that directly set CMAKE_PREFIX_PATH = one of the path you mentioned right?

I would try both, starting with the header include path first.

Hi @dkreutz ,

I have tried set CMAKE_PREFIX_PATH=/usr/lib/aarch64-linux-gnu and /usr/include/aarch64-linux-gnu/ respectifully, then both got the same result.

-- Found CUDA: /usr/local/cuda (found suitable version "10.2", minimum required is "7.5") 
-- Looking for cuDNN install...
-- Found cuDNN: /usr/lib/aarch64-linux-gnu/libcudnn.so
-- Building a CUDA test project to see if your compiler is compatible with CUDA...
-- Checking if you have the right version of cuDNN installed.
-- *** Found cuDNN, but it looks like the wrong version so dlib will not use it.              ***
-- *** Dlib requires cuDNN V5.0 OR GREATER.  Since cuDNN is not found DLIB WILL NOT USE CUDA. ***
-- *** If you have cuDNN then set CMAKE_PREFIX_PATH to include cuDNN's folder.                ***
-- Disabling CUDA support for dlib.  DLIB WILL NOT USE CUDA

Any ideas on this? How to check that it use whether it use the right version of cudnn? it seems that cudnn’s version or path is wrong…

Hi,

We have verified the dlib functionality on JetPack 4.6.
Please check the below comment to install v19.21:

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.