From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: muriloo@linux.ibm.com, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [RFC] configure script mistakenly detects static libraries
Date: Mon, 23 Apr 2018 17:30:41 +0100 [thread overview]
Message-ID: <20180423163041.GQ3267@redhat.com> (raw)
In-Reply-To: <CAFEAcA-KJb6L0bCKQAE-TjfSQg6OSb0JvumGjVyYYTE46mdKbA@mail.gmail.com>
On Mon, Apr 23, 2018 at 05:16:02PM +0100, Peter Maydell wrote:
> On 23 April 2018 at 17:10, Murilo Opsfelder Araujo
> <muriloo@linux.ibm.com> wrote:
> > Hi, everyone!
> >
> > I'm facing an issue on how configure script detects static libraries and
> > would like to hear from community to find a common ground on how to
> > possibly fix it.
> >
> > Throughout configure, we use pkg-config command to verify if a library
> > is installed so qemu can be linked to it. This works fine when linking
> > qemu dynamically. However, configuring qemu with --static can mistakenly
> > detect a library that is actually not present on the system.
> >
> > For example, on Ubuntu Xenial, libcacard-dev package provides only
> > libcacard.so (not libcacard.a) and pkg-config reports success in both
> > cases:
> >
> > $ pkg-config libcacard
> > $ echo $?
> > 0
> >
> > $ pkg-config --static libcacard
> > $ echo $?
> > 0
> >
> > Since we use `pkg-config libcacard` to set smartcard=yes, this
> > mistakenly enables smartcard feature. This is acceptable with dynamic
> > linkage, but can be an issue with static linkage, where libcacard.a
> > doesn't exist on the system, resulting on a build error:
>
> This seems to me to be an error in your distro's pkg-config information.
> If static linking against libcacard doesn't work, then
> "pkg-config --static libcacard" should fail.
IIUC, --static isn't actually proving that a static version of a library
exists. Rather it just changes the logic for figuring out the dependancy
graph & compiler/linker flags. So --static will always work fine even if
only the .so is present, and no .a file exists.
Similarly pkg-config without --static doesn't actually guarantee that a
shared .so exists either - just tells you the flags you would need if
it did exist.
This works fine if you always build & ship static & shared versions of
every library, but distros often ditch static builds of all but a
handful of libraries, because of the ripple effect static linking
has when security updates are issued.
> Unfortunately IME the static linking support in distro-suppled
> pkgconfig files is rarely tested, so it's not uncommon for it to
> be broken.
>
> From an upstream QEMU point of view, we primarily support --static
> for the benefit of the linux-user binaries, not for system emulation.
> So we care more if a "configure --disable-system --disable-tools --static"
> build doesn't work, than if the problem is only with features used
> by the system emulator binaries.
That reduces the 3rd party deps to essentially just your C library and
glib2, which makes it more tractable from a security update POV. I would
certainly not wish to see static linking of a system emulator which pulls
in 150+ 3rd party libraries on my system !
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2018-04-23 16:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 16:10 [Qemu-devel] [RFC] configure script mistakenly detects static libraries Murilo Opsfelder Araujo
2018-04-23 16:16 ` Peter Maydell
2018-04-23 16:30 ` Daniel P. Berrangé [this message]
2018-04-23 16:40 ` Murilo Opsfelder Araujo
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=20180423163041.GQ3267@redhat.com \
--to=berrange@redhat.com \
--cc=muriloo@linux.ibm.com \
--cc=peter.maydell@linaro.org \
--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.