From patchwork Sun Aug 9 03:50:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Dickinson X-Patchwork-Id: 505705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D496614012C for ; Tue, 11 Aug 2015 01:45:19 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 8CE9828BD97; Mon, 10 Aug 2015 17:44:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, DATE_IN_PAST_24_48 autolearn=no version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 4463A28BC81 for ; Mon, 10 Aug 2015 17:44:27 +0200 (CEST) X-policyd-weight: using cached result; rate: -8.5 Received: from s1.neomailbox.net (s1.neomailbox.net [5.148.176.57]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Mon, 10 Aug 2015 17:44:25 +0200 (CEST) From: Daniel Dickinson Date: Sat, 8 Aug 2015 23:50:43 -0400 To: openwrt-devel@lists.openwrt.org Message-Id: <20150810153021.796FC23A1534@danielcent.thecshore.com> Subject: [OpenWrt-Devel] [PATCH 1/1] [buildroot] Fix for liblzma breaks redhat-like systems X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" On RedHat/Fedora and derivatives we must use the system liblzma from xz-devel because the liblzma in tools/xz breaks these systems due to system tools (which use liblzma) having missing symbols when staging_dir/host/lib has liblzma (because buildroot puts staging_dir/host/lib first in library load path and therefore all binaries not just buildroot's binaries use liblzma from staging_dir/host/lib, at least while building OpenWrt). Closes: 20134 Signed-off-by: Daniel Dickinson --- include/host.mk | 7 ++++++- include/prereq-build.mk | 7 +++++++ tools/Makefile | 11 ++++++++--- tools/squashfs4/Makefile | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/include/host.mk b/include/host.mk index ec3ae27..fc55b63 100644 --- a/include/host.mk +++ b/include/host.mk @@ -45,7 +45,12 @@ $(TMP_DIR)/.host.mk: $(TOPDIR)/include/host.mk echo "FIND_L=find -L \$$(1)" >> $@; \ else \ echo "FIND_L=find \$$(1) -follow" >> $@; \ - fi \ + fi ; \ + [ -r /etc/os-release ] && \ + eval "$$(cat /etc/os-release)" && \ + echo "$$ID_LIKE" | grep -qE '(rhel|fedora)' && \ + [ "$$VERSION_ID" -ge 7 ] && \ + echo "USE_HOST_LZMA:=1" >> $@ \ ) >/dev/null 2>/dev/null endif diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 211201a..312eabf 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -70,6 +70,13 @@ $(eval $(call TestHostCommand,libssl, \ echo 'int main(int argc, char **argv) { SSL_library_init(); return 0; }' | \ gcc -include openssl/ssl.h -x c -o $(TMP_DIR)/a.out - -lcrypto -lssl)) +ifeq ($(USE_HOST_LZMA),1) +$(eval $(call TestHostCommand,liblzma, \ + Please install xz development package. (Missing liblzma.so or lzma.h), \ + echo 'int main(int argc, char **argv) { lzma_stream strm = LZMA_STREAM_INIT; lzma_ret ret = lzma_easy_encoder(&strm, 1, LZMA_CHECK_CRC64); if (ret == LZMA_OK) { lzma_end(&strm); return 0; } else { return -1; } }' | \ + gcc -include lzma.h -x c -o $(TMP_DIR)/a.out - -llzma)) +endif + $(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \ gtar --version 2>&1 | grep GNU, \ diff --git a/tools/Makefile b/tools/Makefile index 60041dd..a4bc127 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -27,7 +27,10 @@ tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf expat tools-y += m4 libtool autoconf automake flex bison pkg-config sed mklibs tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage tools-y += firmware-utils patch-image patch quilt yaffs2 flock padjffs2 -tools-y += mm-macros missing-macros xz cmake scons bc findutils gengetopt patchelf +tools-y += mm-macros missing-macros cmake scons bc findutils gengetopt patchelf +ifneq ($(USE_HOST_LZMA),1) +tools-y += xz +endif tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2 tools-$(CONFIG_powerpc) += upx tools-$(CONFIG_TARGET_x86) += qemu @@ -45,16 +48,18 @@ $(curdir)/flex/compile := $(curdir)/libtool/install $(curdir)/pkg-config/compile := $(curdir)/sed/install $(curdir)/libtool/compile := $(curdir)/sed/install $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/automake/install $(curdir)/missing-macros/install $(curdir)/squashfs/compile := $(curdir)/lzma-old/install +ifneq ($(USE_HOST_LZMA),1) $(curdir)/squashfs4/compile := $(curdir)/xz/install +endif $(curdir)/quilt/compile := $(curdir)/sed/install $(curdir)/autoconf/install $(curdir)/findutils/install $(curdir)/autoconf/compile := $(curdir)/m4/install -$(curdir)/automake/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/pkg-config/install $(curdir)/xz/install +$(curdir)/automake/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/pkg-config/install $(if $(filter 1,$(USE_HOST_LZMA)),,$(curdir)/xz/install) $(curdir)/gmp/compile := $(curdir)/libtool/install $(curdir)/mpc/compile := $(curdir)/mpfr/install $(curdir)/gmp/install $(curdir)/mpfr/compile := $(curdir)/gmp/install $(curdir)/ppl/compile := $(curdir)/gmp/install $(curdir)/cloog/compile := $(curdir)/ppl/install -$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/install $(curdir)/xz/install +$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/install $(if $(filter 1,$(USE_HOST_LZMA)),,$(curdir)/xz/install) $(curdir)/mkimage/compile := $(curdir)/sed/install $(curdir)/mklibs/compile := $(curdir)/libtool/install $(curdir)/qemu/compile := $(curdir)/e2fsprogs/install diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile index 50b70fb..2c0ee0d 100644 --- a/tools/squashfs4/Makefile +++ b/tools/squashfs4/Makefile @@ -24,7 +24,7 @@ define Host/Compile XZ_SUPPORT=1 \ LZMA_XZ_SUPPORT=1 \ XATTR_SUPPORT= \ - LZMA_LIB="$(STAGING_DIR_HOST)/lib/liblzma.a" \ + $(if $(filter 1,$(USE_HOST_LZMA)),,LZMA_LIB="$(STAGING_DIR_HOST)/lib/liblzma.a") \ EXTRA_CFLAGS="-I$(STAGING_DIR_HOST)/include" \ mksquashfs unsquashfs endef