Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/3] zstd: install to staging directory
Date: Sat, 21 Oct 2017 16:30:04 +0200	[thread overview]
Message-ID: <20171021163004.4f8e21cf@windsurf> (raw)
In-Reply-To: <20171016215904.3380-2-judge.packham@gmail.com>

Hello,

On Tue, 17 Oct 2017 10:59:02 +1300, Chris Packham wrote:
> Install libzstd to the staging directory.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
>  package/zstd/zstd.mk | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
> index 089d654749..f149ad2f91 100644
> --- a/package/zstd/zstd.mk
> +++ b/package/zstd/zstd.mk
> @@ -6,6 +6,7 @@
>  
>  ZSTD_VERSION = v1.3.2
>  ZSTD_SITE = $(call github,facebook,zstd,$(ZSTD_VERSION))
> +ZSTD_INSTALL_STAGING = YES
>  ZSTD_LICENSE = BSD-3-Clause, GPL-2.0
>  ZSTD_LICENSE_FILES = LICENSE COPYING
>  
> @@ -46,4 +47,9 @@ define ZSTD_INSTALL_TARGET_CMDS
>  		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/programs install
>  endef
>  
> +define ZSTD_INSTALL_STAGING_CMDS
> +	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
> +		DESTDIR=$(STAGING_DIR) PREFIX=/usr -C $(@D)/lib install
> +endef

This is a bit problematic. Following this, you have the libzstd shared
library installed in staging, which means that when you build a program
with "-lzstd", it gets linked against this shared library.

However, the libzstd shared library is not installed to TARGET_DIR, and
therefore such a program will fail to run on the target. The shared
library is currently not needed on the target, because the zstd program
is directly linked with the individual object files that compose the
library.

So, one option is to simply install the shared library as well on the
target, but that doubles the installation size: ~300 KB for the zstd
tool, and ~275 KB for the shared library.

Two possible solutions:

 - Fix the build system of zstd so that its program is dynamically
   linked against the libzstd shared library.

 - Add a sub-option "BR2_PACKAGE_ZSTD_INSTALL_LIB" that would install
   the library (to both staging and target), and that would be
   selected by the target squashfs package.

It is worth mentioning that your changes to the target squashfs package
most likely don't work correctly, because the mksquashfs on target will
be linked against the shared libzstd, but that library is not present
on the target.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-10-21 14:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 21:59 [Buildroot] [RFC PATCH 0/3] squashfs support for zstd Chris Packham
2017-10-16 21:59 ` [Buildroot] [PATCH 1/3] zstd: install to staging directory Chris Packham
2017-10-21 14:30   ` Thomas Petazzoni [this message]
2017-10-16 21:59 ` [Buildroot] [PATCH 2/3] zstd: build for host Chris Packham
2017-10-16 21:59 ` [Buildroot] [PATCH 3/3] squashfs: add support for zstd Chris Packham
2017-10-21 14:22   ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171021163004.4f8e21cf@windsurf \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox