Compiling Error: Library not found: /home/src/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/lib/libc.so

When compiling the last git-version openwrt for GL .iNet MT3000, got the error:

Library not found: /home/src/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/lib/libc.so in p
ath: /lib:/usr/lib:/usr/lib/samba:/usr/lib/samba/ldb:/usr/lib/samba:/usr/lib/samba/vfs:/usr/lib/samba:/usr/lib
/samba/krb5:/usr/lib/samba:/usr/lib:/usr/lib/pppd/2.4.9:/usr/lib:/usr/lib/rpcd:/usr/lib:/usr/lib/ucode:/usr/li
b/ucode/luci:/usr/lib/ucode:/usr/lib

There was no this error a few days ago.
What's wrong with it?

Library not found ?

libc is the main C function lib provided by the musl C lib.
It should always be found as the basic foundation of compilation.

I guess that the reason is that musl was upgraded to version 1.25 yesterday

If you have not yet fully cleaned and rebuilt your toolchain, you may have slightly incompatible packages or inconsistency errors.
I recommend that after updating git sources you clear the normal target firmware build artefacts (=make clean) and also the toolchain with "make targetclean" (or even wider "make dirclean").

I have built it from pure clean source codes, and tried it with a new laptop, but the error still exists. musl compiled correctly, and the libc.so was in /home/src/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/lib/. It seems the error message is a little strange: an absolute path/libc.so in path……?

The error message:

......
warning: /home/src/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/sbin/nmbd may need rpath, but --root not specified
warning: /home/src/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/sbin/smbd may need rpath, but --root not specified
I: library reduction pass 1
12497 symbols, 18 unresolved
I: library reduction pass 2
12499 symbols, 20 unresolved
Library not found: /home/src/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/lib/libc.so in path: /lib:/usr/lib:/usr/lib/samba:/usr/lib/samba/ldb:/usr/lib/samba:/usr/lib/samba/vfs:/usr/lib/samba:/usr/lib/samba/krb5:/usr/lib/samba:/usr/lib:/usr/lib/pppd/2.4.9:/usr/lib:/usr/lib/rpcd:/usr/lib:/usr/lib/ucode:/usr/lib/ucode/luci:/usr/lib/ucode:/usr/lib
make[2]: *** [package/Makefile:74: package/install] Error 1
make[2]: Leaving directory '/home/src/openwrt'
make[1]: *** [package/Makefile:124: /home/src/openwrt/staging_dir/target-aarch64_cortex-a53_musl/stamp/.package_install] Error 2
make[1]: Leaving directory '/home/src/openwrt'
make: *** [/home/src/openwrt/include/toplevel.mk:233: world] Error 2

I think I found the solution to your problem. Try removing the "Strip unnecessary functions from libraries" from the config, then clean and rebuild (e.g. "make clean && make make -j $(nproc) world".

I had the same problem and I fixed it after viewing this issue on github:

https://github.com/openwrt/openwrt/issues/15666