Uwsgi: Failed to link libpython3.10.so

I'm trying to perform my first custom build for my WRT3200ACM.

I am trying to build v22.03.0-rc6. I wasn't brave enough to build master on my first try.

I have configured the build to use LuCI with nginx and OpenSSL (luci-ssl-nginx).

This introduces a transitive dependency on uwsgi. I am not trying to install Python in particular, but I understand that WSGI originates from that world.

When I try the build, I get a linking error. Here is a truncated output when trying to build just this package:

$ make -j1 V=sc package/uwsgi/compile
[...]
*** uWSGI building and linking plugin plugins/python ***
[arm-openwrt-linux-muslgnueabi-gcc] ./python_plugin.so
/usr/lib/libpython3.10.so: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
*** unable to build python plugin ***
make[2]: *** [Makefile:170: /home/csb/openwrt-csb/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/pypi/uwsgi-2.0.20/.built] Error 1
make[2]: Leaving directory '/home/csb/openwrt-csb/openwrt/feeds/packages/net/uwsgi'
time: package/feeds/packages/uwsgi/compile#4.25#0.52#4.64
    ERROR: package/feeds/packages/uwsgi failed to build.
make[1]: *** [package/Makefile:116: package/feeds/packages/uwsgi/compile] Error 1
make[1]: Leaving directory '/home/csb/openwrt-csb/openwrt'
make: *** [/home/csb/openwrt-csb/openwrt/include/toplevel.mk:230: package/uwsgi/compile] Error 2

The key thing I notice is:

[arm-openwrt-linux-muslgnueabi-gcc] ./python_plugin.so
/usr/lib/libpython3.10.so: file not recognized: file format not recognized

I am building from Arch Linux, which uses GCC 12 by default. I tried setting CC=gcc-11, but that got the same error.

What am I missing? Is the problem my host system or the package? What should be my next steps in debugging this?

EDIT: I do have /usr/lib/libpython3.10.so on my host system (x86) which is obviously a different format from the one in my staging_dir (ARM). Could the build be looking at the wrong file?

$ file -L /usr/lib/libpython3.10.so
/usr/lib/libpython3.10.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=bdbd1aeff9cdfd03031f9d7c6d6b8f0c2434f1a4, stripped

$ file -L ./staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/usr/lib/libpython3.10.so
./staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/usr/lib/libpython3.10.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, with debug_info, not stripped