[openwrt/openwrt] tools: bzip2: use static lib and tools

LEDE Commits lede-commits at lists.infradead.org
Sat Sep 28 03:05:52 PDT 2024


robimarko pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/87477c756e1136ee338a9fd67e0df81f853f74d4

commit 87477c756e1136ee338a9fd67e0df81f853f74d4
Author: Robert Marko <robimarko at gmail.com>
AuthorDate: Fri Sep 27 00:30:44 2024 +0200

    tools: bzip2: use static lib and tools
    
    Currently, bzip2 is built with a dynamically linked library on which all
    of the bzip2 tools depend on.
    
    However, when trying to use the staging dir bzip2 during building on
    Fedora 40 the following error appers:
    staging_dir/host/bin/bzip2: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file: No such file or directory
    
    Looking into it, the binary is dynamically linked:
    $ ldd staging_dir/host/bin/bzip2
    linux-vdso.so.1 (0x00007f5ebd9ff000)
    libbz2.so.1.0 => not found
    libc.so.6 => /lib64/libc.so.6 (0x00007f5ebd7f5000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f5ebda01000)
    
    libbz2.so.1.0 is installed into staging_dir/lib but that directory is not
    evaluated for the required libraries and Fedora only ships:
    /usr/lib64/libbz2.so.1
    /usr/lib64/libbz2.so.1.0.8
    
    Thus it cannot find the libbz2 that bzip2 is linked against and thus
    trying to use bzip2 will fail and stop compilation as it is used for
    bzip2 compressed tarballs.
    
    So, to avoid OpenWrt compiled bzip2 to even attempt to load a required
    library from the host we can just static compile libbz2 and bzip2.
    
    Link: https://github.com/openwrt/openwrt/pull/16520
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 tools/bzip2/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/bzip2/Makefile b/tools/bzip2/Makefile
index 0c5a92849a..d438832cdf 100644
--- a/tools/bzip2/Makefile
+++ b/tools/bzip2/Makefile
@@ -29,9 +29,9 @@ HOST_CFLAGS += $(HOST_FPIC)
 HOST_MAKE_FLAGS+= \
 	CFLAGS="$(HOST_CFLAGS)" \
 	LDFLAGS="$(HOST_LDFLAGS)" \
-	ENABLE_BIN_SHARED=1 \
-	ENABLE_BIN_STATIC=0 \
-	ENABLE_LIB_SHARED=1 \
+	ENABLE_BIN_SHARED=0 \
+	ENABLE_BIN_STATIC=1 \
+	ENABLE_LIB_SHARED=0 \
 	ENABLE_LIB_STATIC=1 \
 	ENABLE_DEV=1 \
 	ENABLE_DOCS=1 \




More information about the lede-commits mailing list