libfacedetection
libfacedetection copied to clipboard
CMake build failed on Raspberry Pi (ARM) with NEON
Problem:
Build failed on Raspberry Pi (ARM) when ENABLE_NEON=ON
:
$ cmake \
-D CMAKE_BUILD_TYPE=Release \
-D ENABLE_AVX2=OFF \
-D ENABLE_AVX512=OFF \
-D ENABLE_NEON=ON \
-D USE_OPENMP=ON \
-D DEMO=OFF \
..
$ cmake --build .
Solution:
Please add -mfpu=neon
to CMAKE_CXX_FLAGS
when ENABLE_NEON=ON
in CMakeLists.txt.
The following command run successfully (added -mfpu=neon
to CMAKE_CXX_FLAGS
) in command-line:
$ cmake \
-D CMAKE_BUILD_TYPE=Release \
-D ENABLE_AVX2=OFF \
-D ENABLE_AVX512=OFF \
-D ENABLE_NEON=ON \
-D USE_OPENMP=ON \
-D DEMO=OFF \
-D CMAKE_CXX_FLAGS=-mfpu=neon \
..
$ cmake --build .
Error details:
$ cmake \
-D CMAKE_BUILD_TYPE=Release \
-D ENABLE_AVX2=OFF \
-D ENABLE_AVX512=OFF \
-D ENABLE_NEON=ON \
-D USE_OPENMP=ON \
-D DEMO=OFF \
..
$ cmake --build .
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h: In function ‘int dotProductUint8Int8(unsigned char*, signed char*, int)’:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:6733:1: error: inlining failed in call to always_inline ‘int32x4_t vdupq_n_s32(int32_t)’: target specific option mismatch
vdupq_n_s32 (int32_t __a)
^~~~~~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:93:29: note: called from here
result_vec = vdupq_n_s32(0); //zeros
~~~~~~~~~~~^~~
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:11211:1: error: inlining failed in call to always_inline ‘int8x8x2_t vld2_s8(const int8_t*)’: target specific option mismatch
vld2_s8 (const int8_t * __a)
^~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:97:41: note: called from here
a = vld2_s8((signed char*)p1 + i);
^
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:11211:1: error: inlining failed in call to always_inline ‘int8x8x2_t vld2_s8(const int8_t*)’: target specific option mismatch
vld2_s8 (const int8_t * __a)
^~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:98:27: note: called from here
b = vld2_s8(p2 + i);
^
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:1332:1: error: inlining failed in call to always_inline ‘int16x8_t vmull_s8(int8x8_t, int8x8_t)’: target specific option mismatch
vmull_s8 (int8x8_t __a, int8x8_t __b)
^~~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:99:32: note: called from here
mul_s32x4 = vpaddlq_s16(vaddq_s16(vmull_s8(a.val[0], b.val[0]), vmull_s8(a.val[1], b.val[1])));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:1332:1: error: inlining failed in call to always_inline ‘int16x8_t vmull_s8(int8x8_t, int8x8_t)’: target specific option mismatch
vmull_s8 (int8x8_t __a, int8x8_t __b)
^~~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:99:32: note: called from here
mul_s32x4 = vpaddlq_s16(vaddq_s16(vmull_s8(a.val[0], b.val[0]), vmull_s8(a.val[1], b.val[1])));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:3608:1: error: inlining failed in call to always_inline ‘int32x4_t vpaddlq_s16(int16x8_t)’: target specific option mismatch
vpaddlq_s16 (int16x8_t __a)
^~~~~~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:99:32: note: called from here
mul_s32x4 = vpaddlq_s16(vaddq_s16(vmull_s8(a.val[0], b.val[0]), vmull_s8(a.val[1], b.val[1])));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:589:1: error: inlining failed in call to always_inline ‘int16x8_t vaddq_s16(int16x8_t, int16x8_t)’: target specific option mismatch
vaddq_s16 (int16x8_t __a, int16x8_t __b)
^~~~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:99:32: note: called from here
mul_s32x4 = vpaddlq_s16(vaddq_s16(vmull_s8(a.val[0], b.val[0]), vmull_s8(a.val[1], b.val[1])));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:596:1: error: inlining failed in call to always_inline ‘int32x4_t vaddq_s32(int32x4_t, int32x4_t)’: target specific option mismatch
vaddq_s32 (int32x4_t __a, int32x4_t __b)
^~~~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:100:31: note: called from here
result_vec = vaddq_s32(result_vec, mul_s32x4);
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:6247:1: error: inlining failed in call to always_inline ‘int32_t vgetq_lane_s32(int32x4_t, int)’: target specific option mismatch
vgetq_lane_s32 (int32x4_t __a, const int __b)
^~~~~~~~~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:102:26: note: called from here
sum += vgetq_lane_s32(result_vec, 0);
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:6247:1: error: inlining failed in call to always_inline ‘int32_t vgetq_lane_s32(int32x4_t, int)’: target specific option mismatch
vgetq_lane_s32 (int32x4_t __a, const int __b)
^~~~~~~~~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:103:26: note: called from here
sum += vgetq_lane_s32(result_vec, 1);
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:6247:1: error: inlining failed in call to always_inline ‘int32_t vgetq_lane_s32(int32x4_t, int)’: target specific option mismatch
vgetq_lane_s32 (int32x4_t __a, const int __b)
^~~~~~~~~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:104:26: note: called from here
sum += vgetq_lane_s32(result_vec, 2);
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.h:60,
from /home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:39:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:6247:1: error: inlining failed in call to always_inline ‘int32_t vgetq_lane_s32(int32x4_t, int)’: target specific option mismatch
vgetq_lane_s32 (int32x4_t __a, const int __b)
^~~~~~~~~~~~~~
/home/pi/Attendance/libfacedetection/libfacedetection-master/src/facedetectcnn.cpp:105:26: note: called from here
sum += vgetq_lane_s32(result_vec, 3);
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/facedetection.dir/build.make:89: CMakeFiles/facedetection.dir/src/facedetectcnn.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/facedetection.dir/all] Error 2
make: *** [Makefile:130: all] Error 2