ERROR: tools/mkimage failed to build

I'm currently trying to build OpenWRT 23.05.2 for x86_64 from source.

I checked out the source at tag v23.05.2 and copied the upstream config to .config.

After rebuilding with make -j1 V=sc world it reveals the following issue.

make[3]: Entering directory '/home/clerie/openwrt/openwrt/tools/mkimage'
. /home/clerie/openwrt/openwrt/include/shell.sh; bzcat /home/clerie/openwrt/openwrt/dl/u-boot-2023.04.tar.bz2 | tar -C /home/clerie/openwrt/openwrt/build_dir/host/u-boot-2023.04/.. -xf -
bzcat: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file: No such file or directory
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
make[3]: *** [Makefile:56: /home/clerie/openwrt/openwrt/build_dir/host/u-boot-2023.04/.prepared7a61ae0f69c3ca447759f7ce9852b7de_18f1e190c5d53547fed41a3eaa76e9e9] Error 2
make[3]: Leaving directory '/home/clerie/openwrt/openwrt/tools/mkimage'
time: tools/mkimage/compile#0.01#0.04#0.05
    ERROR: tools/mkimage failed to build.
make[2]: *** [tools/Makefile:226: tools/mkimage/compile] Error 1
make[2]: Leaving directory '/home/clerie/openwrt/openwrt'
make[1]: *** [tools/Makefile:222: /home/clerie/openwrt/openwrt/staging_dir/host/stamp/.tools_compile_nyyyyyyynnyyyynynyyyyyyynyyynnynyyyyynyyyyyyyyyyyyyyyyyynynnyyyyyyy] Error 2
make[1]: Leaving directory '/home/clerie/openwrt/openwrt'
make: *** [/home/clerie/openwrt/openwrt/include/toplevel.mk:232: world] Error 2

I haven't found out how the OpenWRT buildroot tools setup works, but I found the library in question in a spot I would consider it to be found by buildroot.

[clerie@fuedra:~/openwrt/openwrt]$ find -name libbz2.so.1.0
./staging_dir/host/lib/libbz2.so.1.0

Is there any environment setting that I got wrong and that might influence the buildroot?

I managed to successfully build OpenWRT 22.03.6 in a similar way.

I am having the same issue... while we wait for the real fix, adding the path to "lib" on "LD_LIBRARY_PATH" seems to allow the build to continue.

2 Likes

Thanks, it fixed an error on 23.05.4 for Octeon cpu.

1 Like