OpenCV error: arm_neon.h unknown type name

Hello everyone,
I am trying to write a Python wrapper for a C++ project that uses OpenCV (my C++ knowledge is very limited). I installed OpenCV 4.5.0, then I managed to compile the project on the nano and create an .so file, which I then try to load with cppyy, but I’m getting a very long list of errors when I try to load one of the headers:

Traceback (most recent call last):
  File "AlgoTest.py", line 9, in <module>
    cppyy.include('NewAlgoManager.h')
  File "/home/jetson/.local/lib/python3.6/site-packages/cppyy/__init__.py", line 245, in include
    raise ImportError('Failed to load header file "%s"%s' % (header, err.err))
ImportError: Failed to load header file "NewAlgoManager.h"
In file included from input_line_18:1:
In file included from ./include/NewAlgoManager.h:4:
In file included from /usr/include/opencv4/opencv2/opencv.hpp:52:
In file included from /usr/include/opencv4/opencv2/core.hpp:52:
In file included from /usr/include/opencv4/opencv2/core/cvdef.h:343:
In file included from /usr/include/opencv4/opencv2/core/cv_cpu_dispatch.h:213:
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:38:9: error: unknown type name '__Int8x8_t'
typedef __Int8x8_t int8x8_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:39:9: error: unknown type name '__Int16x4_t'
typedef __Int16x4_t int16x4_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:40:9: error: unknown type name '__Int32x2_t'
typedef __Int32x2_t int32x2_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:41:9: error: unknown type name '__Int64x1_t'
typedef __Int64x1_t int64x1_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:42:9: error: unknown type name '__Float16x4_t'
typedef __Float16x4_t float16x4_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:43:9: error: unknown type name '__Float32x2_t'
typedef __Float32x2_t float32x2_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:44:9: error: unknown type name '__Poly8x8_t'
typedef __Poly8x8_t poly8x8_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:45:9: error: unknown type name '__Poly16x4_t'
typedef __Poly16x4_t poly16x4_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:46:9: error: unknown type name '__Uint8x8_t'
typedef __Uint8x8_t uint8x8_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:47:9: error: unknown type name '__Uint16x4_t'
typedef __Uint16x4_t uint16x4_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:48:9: error: unknown type name '__Uint32x2_t'
typedef __Uint32x2_t uint32x2_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:49:9: error: unknown type name '__Float64x1_t'
typedef __Float64x1_t float64x1_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:50:9: error: unknown type name '__Uint64x1_t'
typedef __Uint64x1_t uint64x1_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:51:9: error: unknown type name '__Int8x16_t'
typedef __Int8x16_t int8x16_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:52:9: error: unknown type name '__Int16x8_t'
typedef __Int16x8_t int16x8_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:53:9: error: unknown type name '__Int32x4_t'
typedef __Int32x4_t int32x4_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:54:9: error: unknown type name '__Int64x2_t'
typedef __Int64x2_t int64x2_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:55:9: error: unknown type name '__Float16x8_t'
typedef __Float16x8_t float16x8_t;
        ^
/usr/lib/gcc/aarch64-linux-gnu/7/include/arm_neon.h:56:9: error: unknown type name '__Float32x4_t'
typedef __Float32x4_t float32x4_t;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

I saw there’s a flag ENABLE_NEON=ON that I can turn off while comiling OpenCV, but I understood that it’s not recommended. Anyone got an idea what could be causing this?

Thank you for the help.

Hi,

Based on the following command, there is no support for the NEON instructions on Nano:

$ cat /proc/cpuinfo
processor	: 0
model name	: ARMv8 Processor rev 1 (v8l)
BogoMIPS	: 38.40
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32
...

Could you turn it off and recompile it again?
Or below is a script to build OpenCV for Jetson that you can refer to.
https://github.com/AastaNV/JEP/blob/master/script/install_opencv4.5.0_Jetson.sh

Thanks.

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