Can't build GStreamer 1.23 on Raspberry Pi 3B, failed in call to ‘always_inline’ ‘vld1_u8’: target specific option mismatch

When I try to build latest gstreamer from git on my Raspberry Pi 3B, I get an error:

[2257/7835] Compiling C object subprojects/vpx/libvpx-neon.a.p/vpx_dsp_arm_vpx_scaled_convolve8_neon.c.o
FAILED: subprojects/vpx/libvpx-neon.a.p/vpx_dsp_arm_vpx_scaled_convolve8_neon.c.o
cc -Isubprojects/vpx/libvpx-neon.a.p -Isubprojects/vpx -I../subprojects/vpx -fdiagnostics-color=always -Wall -Winvalid-pch -Wextra -std=gnu89 -O2 -g -fPIC -pthread -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wd
eclaration-after-statement -Wdisabled-optimization -Wfloat-conversion -Wformat=2 -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wuni
nitialized -Wunused -Wundef -Wframe-larger-than=52000 -Wdisabled-optimization -Winline -MD -MQ subprojects/vpx/libvpx-neon.a.p/vpx_dsp_arm_vpx_scaled_convolve8_neon.c.o -MF subprojects/vpx/libvpx-neon.a.p/vpx_d
sp_arm_vpx_scaled_convolve8_neon.c.o.d -o subprojects/vpx/libvpx-neon.a.p/vpx_dsp_arm_vpx_scaled_convolve8_neon.c.o -c ../subprojects/vpx/vpx_dsp/arm/vpx_scaled_convolve8_neon.c
../subprojects/vpx/vpx_dsp/arm/vpx_scaled_convolve8_neon.c:271:6: warning: no previous prototype for ‘vpx_scaled_2d_neon’ [-Wmissing-prototypes]
  271 | void vpx_scaled_2d_neon(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
      |      ^~~~~~~~~~~~~~~~~~
In file included from ../subprojects/vpx/vpx_dsp/arm/vpx_scaled_convolve8_neon.c:11:
../subprojects/vpx/vpx_dsp/arm/mem_neon.h: In function ‘load_u8_8x4’:
/usr/lib/gcc/arm-linux-gnueabihf/10/include/arm_neon.h:10307:1: error: inlining failed in call to ‘always_inline’ ‘vld1_u8’: target specific option mismatch
10307 | vld1_u8 (const uint8_t * __a)
      | ^~~~~~~
In file included from ../subprojects/vpx/vpx_dsp/arm/vpx_scaled_convolve8_neon.c:18:
../subprojects/vpx/vpx_dsp/arm/mem_neon.h:214:9: note: called from here
  214 |   *s3 = vld1_u8(s);
      |         ^~~~~~~~~~
In file included from ../subprojects/vpx/vpx_dsp/arm/vpx_scaled_convolve8_neon.c:11:
/usr/lib/gcc/arm-linux-gnueabihf/10/include/arm_neon.h:10307:1: error: inlining failed in call to ‘always_inline’ ‘vld1_u8’: target specific option mismatch
10307 | vld1_u8 (const uint8_t * __a)
      | ^~~~~~~
In file included from ../subprojects/vpx/vpx_dsp/arm/vpx_scaled_convolve8_neon.c:18:
../subprojects/vpx/vpx_dsp/arm/mem_neon.h:212:9: note: called from here
  212 |   *s2 = vld1_u8(s);
      |         ^~~~~~~~~~
In file included from ../subprojects/vpx/vpx_dsp/arm/vpx_scaled_convolve8_neon.c:11:
/usr/lib/gcc/arm-linux-gnueabihf/10/include/arm_neon.h:10307:1: error: inlining failed in call to ‘always_inline’ ‘vld1_u8’: target specific option mismatch
10307 | vld1_u8 (const uint8_t * __a)
      | ^~~~~~~
In file included from ../subprojects/vpx/vpx_dsp/arm/vpx_scaled_convolve8_neon.c:18:
../subprojects/vpx/vpx_dsp/arm/mem_neon.h:210:9: note: called from here
  210 |   *s1 = vld1_u8(s);
      |         ^~~~~~~~~~
In file included from ../subprojects/vpx/vpx_dsp/arm/vpx_scaled_convolve8_neon.c:11:
/usr/lib/gcc/arm-linux-gnueabihf/10/include/arm_neon.h:10307:1: error: inlining failed in call to ‘always_inline’ ‘vld1_u8’: target specific option mismatch
10307 | vld1_u8 (const uint8_t * __a)
      | ^~~~~~~
In file included from ../subprojects/vpx/vpx_dsp/arm/vpx_scaled_convolve8_neon.c:18:
../subprojects/vpx/vpx_dsp/arm/mem_neon.h:208:9: note: called from here
  208 |   *s0 = vld1_u8(s);
      |         ^~~~~~~~~~

As you can see here, this is probably caused by missing extension on my Raspberry Pi CPU.

This might help

You shouldn’t really need to build the libvpx subproject when building GStreamer on the RPi.

Pass --wrap-mode=nodownload to Meson so it won’t download subprojects (or even --wrap-mode=nofallback), and perhaps start with a clean checkout where it hasn’t yet downloaded libvpx.

If you do want the vpx elements (vp9 dec/enc + vp8 dec/enc) then you should install libvpx from your distro, e.g. apt install libvpx-dev.

I’ve actually got to OpenCV this time, but got another error:

FAILED: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstopencv.cpp.o
c++ -Isubprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p -Isubprojects/gst-plugins-bad/ext/opencv -I../subprojects/gst-plugins-bad/ext/opencv -Isubprojects/gst-plugins-bad -I../subprojects/gst-plugins-bad -Isubprojects/gst-plugins-bad/gst-libs -I../subprojects/gst-plugins-bad/gst-libs -Isubprojects/gstreamer/libs -I../subprojects/gstreamer/libs -Isubprojects/gstreamer -I../subprojects/gstreamer -Isubprojects/gst-plugins-base/gst-libs -I../subprojects/gst-plugins-base/gst-libs -Isubprojects/gstreamer/libs/gst/base -Isubprojects/gstreamer/gst -Isubprojects/gst-plugins-base/gst-libs/gst/video -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/orc-0.4 -I/usr/include/opencv4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++14 -O2 -g -Wno-non-virtual-dtor -fvisibility=hidden -fno-strict-aliasing -Wformat-nonliteral -Wmissing-declarations -Wredundant-decls -Wwrite-strings -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar -Wvla -Wpointer-arith -fPIC -pthread -DHAVE_CONFIG_H '-DGST_HAAR_CASCADES_DIR="@0@"' '-DOPENCV_PREFIX="/usr"' -Wno-missing-include-dirs -Wno-format-nonliteral '-DOPENCV_PATH_NAME="opencv4"' -DGST_USE_UNSTABLE_API -MD -MQ subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstopencv.cpp.o -MF subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstopencv.cpp.o.d -o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstopencv.cpp.o -c ../subprojects/gst-plugins-bad/ext/opencv/gstopencv.cpp
In file included from /usr/include/opencv4/opencv2/tracking/tracking_legacy.hpp:55,
                 from ../subprojects/gst-plugins-bad/ext/opencv/gstcvtracker.h:61,
                 from ../subprojects/gst-plugins-bad/ext/opencv/gstopencv.cpp:47:
/usr/include/opencv4/opencv2/tracking/tracking_internals.hpp:18:10: fatal error: opencv2/video/detail/tracking.private.hpp: No such file or directory
   18 | #include "opencv2/video/detail/tracking.private.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~