I'm also trying to compile for OSMC for RPi4.
I get this error when compiling x264 as part of tvheadend:
cd /home/osmc/tvheadend/tvheadend/build.linux/ffmpeg/x264-7ed753b10a61d0be95f683289dfb925b800b0676 && FFMPEG_PREFIX=/home/osmc/tvheadend/tvheadend/build.linux/ffmpeg/build/ffmpeg PKG_CONFIG=/home/osmc/tvheadend/tvheadend/support/pkg-config.ffmpeg ./configure --prefix=/ffmpeg --enable-static --disable-shared \
	--extra-asflags="-DPIC" \
	--extra-cflags="-fPIE" \
	--disable-cli \
	--disable-swscale \
	--disable-lavf \
	--disable-avs \
	--disable-ffms \
	--disable-gpac \
	--disable-lsmash \
	
Unknown option --disable-shared, ignored
no NEON support, try adding -mfpu=neon to CFLAGS
If you really want to run on such a CPU, configure with --disable-asm.
make[1]: *** [Makefile.ffmpeg:233: /home/osmc/tvheadend/tvheadend/build.linux/ffmpeg/x264-7ed753b10a61d0be95f683289dfb925b800b0676/.tvh_build] Error 1
make[1]: Leaving directory '/home/osmc/tvheadend/tvheadend'
make: *** [Makefile:858: /home/osmc/tvheadend/tvheadend/build.linux/ffmpeg/build/ffmpeg/lib/libavcodec.a] Error 2
I modified the Makefile.ffmpeg and removed --disable-shared. Similar error, but without the warning.
Then, I tried to setup several CFLAGS and CXXFLAGS, using -mfpu=neon and others like:
export CFLAGS="-mcpu=cortex-a72 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mtune=c
ortex-a72"
export CXXFLAGS="-mcpu=cortex-a72 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mtune=c
ortex-a72"
It always fails the test:
osmc@osmc:~/tvheadend/tvheadend$ tail build.linux/ffmpeg/x264-7ed753b10a61d0be95f683289dfb925b800b0676/config.log 
Failed commandline was:
--------------------------------------------------
gcc conftest.c  -Wall -I. -I$(SRCPATH) -fPIE -std=gnu99 -D_GNU_SOURCE   -Werror=attributes -Werror=ignored-attributes    -lm -o conftest
/tmp/ccp8pwlC.s: Assembler messages:
/tmp/ccp8pwlC.s:30: Error: bad instruction `cmeq v0.8h,v0.8h,#0'
--------------------------------------------------
Failed program was:
--------------------------------------------------
int main (void) { __asm__("cmeq v0.8h, v0.8h, #0"); return 0; }
--------------------------------------------------
Finally I modified the Makefile.ffmpeg and added the --disable-asm to be able to continue.
This is my architecture:
osmc@osmc:~/tvheadend/tvheadend$ gcc -Q --help=target -march=native -mtune=native
The following options are target specific:
  -mabi=                      		aapcs-linux
  -mabort-on-noreturn         		[disabled]
  -mandroid                   		[disabled]
  -mapcs                      		[disabled]
  -mapcs-frame                		[disabled]
  -mapcs-reentrant            		[disabled]
  -mapcs-stack-check          		[disabled]
  -march=                     		armv8-a+crc+simd
  -marm                       		[disabled]
  -masm-syntax-unified        		[enabled]
  -mbe32                      		[enabled]
  -mbe8                       		[disabled]
  -mbig-endian                		[disabled]
  -mbionic                    		[disabled]
  -mbranch-cost=              		-1
  -mcallee-super-interworking 		[disabled]
  -mcaller-super-interworking 		[disabled]
  -mcmse                      		[disabled]
  -mcpu=                      		
  -mfdpic                     		[disabled]
  -mfix-cortex-m3-ldrd        		[disabled]
  -mflip-thumb                		[disabled]
  -mfloat-abi=                		hard
  -mfp16-format=              		none
  -mfpu=                      		vfpv3-d16
  -mgeneral-regs-only         		[disabled]
  -mglibc                     		[enabled]
  -mhard-float                		-mfloat-abi=hard
  -mlittle-endian             		[enabled]
  -mlong-calls                		[disabled]
  -mmusl                      		[disabled]
  -mneon-for-64bits           		[disabled]
  -mpic-data-is-text-relative 		[enabled]
  -mpic-register=             		
  -mpoke-function-name        		[disabled]
  -mprint-tune-info           		[disabled]
  -mpure-code                 		[disabled]
  -mrestrict-it               		[disabled]
  -msched-prolog              		[enabled]
  -msingle-pic-base           		[disabled]
  -mslow-flash-data           		[disabled]
  -msoft-float                		-mfloat-abi=soft
  -mstructure-size-boundary=  		8
  -mthumb                     		[enabled]
  -mthumb-interwork           		[disabled]
  -mtls-dialect=              		gnu
  -mtp=                       		cp15
  -mtpcs-frame                		[disabled]
  -mtpcs-leaf-frame           		[disabled]
  -mtune=                     		cortex-a72
  -muclibc                    		[disabled]
  -munaligned-access          		[enabled]
  -mvectorize-with-neon-double 		[disabled]
  -mvectorize-with-neon-quad  		[enabled]
  -mword-relocations          		[enabled]
  Known ARM ABIs (for use with the -mabi= option):
    aapcs aapcs-linux apcs-gnu atpcs iwmmxt
  Known __fp16 formats (for use with the -mfp16-format= option):
    alternative ieee none
  Known ARM FPUs (for use with the -mfpu= option):
    auto crypto-neon-fp-armv8 fp-armv8 fpv4-sp-d16
    fpv5-d16 fpv5-sp-d16 neon neon-fp-armv8
    neon-fp16 neon-vfpv3 neon-vfpv4 vfp vfp3 vfpv2
    vfpv3 vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16
    vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16
  Valid arguments to -mtp=:
    auto cp15 soft
  Known floating-point ABIs (for use with the -mfloat-abi= option):
    hard soft softfp
  TLS dialect to use:
    gnu gnu2
Is there a way to optimize for this CPU?
Anyway compilation broke later:
/home/osmc/tvheadend/tvheadend/build.linux/ffmpeg/x265_4.1/source/common/aarch64/dct-prim.h:38:33: error: 'vqtbx1q_s8' was not declared in this scope; did you mean 'vtbx1_s8'?
   38 |     return vreinterpretq_s16_s8(vqtbx1q_s8(a_s8, a_s8, tbl));
      |                                 ^~~~~~~~~~
      |                                 vtbx1_s8