After not having built my own OpenWRT for 2.5 years, I just bought a BananaPi R4 and started a new build system again. One option I always selected was Strip unnecessary functions from libraries
in Global Build Settings. This option is using mklibs. Now, when I select that option, the make process fails in the last stage, make[2] package/install
mklibs is a python3 package and quite old. My build system is running Ubuntu 24.04.2 LTS and python3 version is 3.12.3.
Without the function stripping, the build finishes successfully. So, my question is: is function stripping still supported?
The error I get when building (make -j1 V=s 2>&1) is:
rm -rf /home/anton/openwrt/bananapi4/openwrt/tmp/mklibs-progs /home/anton/openwrt/bananapi4/openwrt/tmp/mklibs-out
# first find all programs and add them to the mklibs list
find /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek -type f -perm /100 -exec file -r -N -F '' {} + | awk ' /executable.*dynamically/ { print $1 }' > /home/anton/openwrt/bananapi4/openwrt/tmp/mklibs-progs
# find all loadable objects that are not regular libraries and add them to the list as well
find /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek -type f -name \*.so\* -exec file -r -N -F '' {} + | awk ' /shared object/ { print $1 }' > /home/anton/openwrt/bananapi4/openwrt/tmp/mklibs-libs
mkdir -p /home/anton/openwrt/bananapi4/openwrt/tmp/mklibs-out
/home/anton/openwrt/bananapi4/openwrt/staging_dir/host/bin/mklibs -D -d /home/anton/openwrt/bananapi4/openwrt/tmp/mklibs-out --sysroot /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek `cat /home/anton/openwrt/bananapi4/openwrt/tmp/mklibs-libs | sed 's:/*[^/]\+/*$::' | uniq | sed 's:^/home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek:-L :'` --ldlib /lib/ld-musl-aarch64.so.1 --target aarch64-openwrt-linux-musl `cat /home/anton/openwrt/bananapi4/openwrt/tmp/mklibs-progs /home/anton/openwrt/bananapi4/openwrt/tmp/mklibs-libs` 2>&1
/home/anton/openwrt/bananapi4/openwrt/staging_dir/host/bin/mklibs:115: SyntaxWarning: invalid escape sequence '\S'
match = re.match("^(((?P<ld>ld\S*)|(lib(?P<lib>\S+))))\.so.*$", i)
/home/anton/openwrt/bananapi4/openwrt/staging_dir/host/bin/mklibs:361: SyntaxWarning: invalid escape sequence '\.'
so_pattern = re.compile("((lib|ld).*)\.so(\..+)*")
/home/anton/openwrt/bananapi4/openwrt/staging_dir/host/bin/mklibs:362: SyntaxWarning: invalid escape sequence '\s'
script_pattern = re.compile("^#!\s*/")
/home/anton/openwrt/bananapi4/openwrt/staging_dir/host/bin/mklibs:495: SyntaxWarning: invalid escape sequence '\.'
if (not (re.search("libthread_db\.so", obj)
/home/anton/openwrt/bananapi4/openwrt/staging_dir/host/bin/mklibs:636: SyntaxWarning: invalid escape sequence '\d'
for lib in sorted(regexpfilter(os.listdir(dest_path), "(.*so[.\d]*)$")):
I: Using /lib/ld-musl-aarch64.so.1 as dynamic linker.
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/ipsec/charon may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/ipsec/libcharon.so.0.0.0 may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/ipsec/libcharon.so.0.0.0 may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/ipsec/libtls.so.0.0.0 may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/ipsec/libvici.so.0.0.0 may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/ipsec/plugins/libstrongswan-eap-tls.so may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/ipsec/starter may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/ipsec/stroke may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/libhistory.so.8.3 may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/libreadline.so.8.3 may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/libsqlite3.so.3.49.1 may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/lib/libunbound.so.8.1.31 may need rpath, but --root not specified
warning: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/usr/sbin/swanctl may need rpath, but --root not specified
I: library reduction pass 1
6500 symbols, 5 unresolved
I: library reduction pass 2
6502 symbols, 7 unresolved
Library not found: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/root-mediatek/lib/libc.so in path: /lib:/usr/lib:/usr/lib/gawk:/usr/lib:/usr/lib/rpcd:/usr/lib:/usr/lib/pppd/2.5.2:/usr/lib:/usr/lib/ossl-modules:/usr/lib:/usr/lib/ipsec:/usr/lib/ipsec/plugins:/usr/lib/ipsec:/usr/lib:/usr/lib/iptables:/usr/lib:/usr/lib/collectd:/usr/lib:/usr/lib/ucode:/usr/lib/ucode/luci:/usr/lib/ucode:/usr/lib:/usr/lib/lua/luci
make[2]: *** [package/Makefile:102: package/install] Error 1
make[2]: Leaving directory '/home/anton/openwrt/bananapi4/openwrt'
make[1]: *** [package/Makefile:178: /home/anton/openwrt/bananapi4/openwrt/staging_dir/target-aarch64_cortex-a53_musl/stamp/.package_install] Error 2
make[1]: Leaving directory '/home/anton/openwrt/bananapi4/openwrt'
make: *** [/home/anton/openwrt/bananapi4/openwrt/include/toplevel.mk:233: world] Error 2