All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Christophe de Dinechin <dinechin@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] Makefile: Compute libraries for libqemuutil.a and libvhost-user.a
Date: Tue, 23 Jun 2020 15:44:15 +0100	[thread overview]
Message-ID: <20200623144415.GP36568@stefanha-x1.localdomain> (raw)
In-Reply-To: <20200616161814.891053-1-dinechin@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1940 bytes --]

On Tue, Jun 16, 2020 at 06:18:14PM +0200, Christophe de Dinechin wrote:
> In util/Makefile.objs, there is a setting for dbus.o-libs.
> Trying to copy-paste that to add a library for module.o that was was
> not otherwise linked yields link errors on a number of binaries,
> e.g. qemu-ga, with unsatisfied symbols in libqemuutil.a(module.o).
> The reason is that library dependencies are not propagated to the .a
> files automatically.
> 
> Adding a call to extract-libs to get the libraries for the two .a
> files that are used elsewhere.
> 
> Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
> ---
>  Makefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 2e93068894..5fb0c78a0b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -598,6 +598,8 @@ Makefile: $(version-obj-y)
>  ######################################################################
>  # Build libraries
>  
> +libqemuutil.a-libs += $(call extract-libs, $(util-obj-y) $(trace-obj-y) $(stub-obj-y))
> +libvhost-user.a-libs += $(call extract-libs, $(libvhost-user-obj-y) $(util-obj-y) $(stub-obj-y))
>  libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y)
>  libvhost-user.a: $(libvhost-user-obj-y) $(util-obj-y) $(stub-obj-y)

I wonder if there is GNU Make syntax to avoid duplicating the
dependencies of libqemuutil.a and libvhost-user.a?

Another thing I wonder about: the purpose of the .a files is to compile
all object files and only link those .o files needed by the program
(i.e. a subset of the .a file).

Now that libqemuutil.a-libs is defined, do programs using libqemuutil.a
link libs required by .o files that aren't being used?

For example, say we had util/mp3encoder.o which depends on an MP3
encoder library. A utility like qemu-img does not depend on mp3encoder.o
from libqemuutil.a. Therefore -lmp3enc or whatever shouldn't be on
qemu-img's linker command-line.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-06-23 15:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 16:18 [PATCH] Makefile: Compute libraries for libqemuutil.a and libvhost-user.a Christophe de Dinechin
2020-06-23 14:44 ` Stefan Hajnoczi [this message]
2020-07-01  9:12   ` Christophe de Dinechin
2020-07-02 13:06     ` Michael Tokarev
2020-07-28 10:14       ` Stefan Hajnoczi

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=20200623144415.GP36568@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=dinechin@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.