Re: [Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-05 Thread Stefan Hajnoczi
On Sun, Sep 02, 2012 at 03:09:44PM +0200, Yann E. MORIN wrote:
> Hello All!
> 
> Currently, configure checks for cURL and SDL with either pkg-config (the
> default), or with {curl,sdl}-config (as a fallback).
> 
> But pkg-config and {curl,sdl}-config do not have the same set of options:
>   - to check for shared libs, both use the option: --libs
>   - to check for static libs:
> - pkg-config uses  : --static --libs
> - {curl,sdl}-config use: --static-libs
> 
> To add to the complexity, pkg-config is called through the querry_pkg_config
> wrapper, that already passes --static when static linking is required, but
> there is no such wrapper for {curl,sdl}-config, so we miss the occasion to
> pass --static-libs.
> 
> To fix this:
>   - introduce a new variable QEMU_XXX_CONFIG_LIBS_FLAGS that mirrors the
> behavior of QEMU_PKG_CONFIG_FLAGS; this variable can be used by all
> xxx-config scripts (eg. curl-config, but later sdl-config too).
> Default it to '--libs', which is for shared linking.
>   - properly use either --libs for pkg-config (--static is already taken
> care of in the wrapper), or $QEMU_XXX_CONFIG_LIBS_FLAGS for
> {curl,sdl}-config.
> 
> 
> Changes since v2:
>   - remove trailing reference to cURL in the SDL patch (Stefan Hajnoczi)
>   - sent to qemu-devel and cc qemu-trivial (Peter Maydell, Stefan)
>   - fix type in the name of the new variable
> 
> Changes since v1:
>   - drop the spice fix, it is not needed (bad env locally)
>   - drop the added --static to calls to pkg-config, as it's already in the
> wrapper (Stefan Hajnoczi)

Any more discussion around this?

I'm happy with the patches.

Stefan



Re: [Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-03 Thread Yann E. MORIN
Peter, All,

On Monday 03 September 2012 18:38:48 Peter Maydell wrote:
> On 3 September 2012 17:28, Yann E. MORIN  wrote:
> > On Monday 03 September 2012 17:44:51 Peter Maydell wrote:
> >> Personally I think it might indeed be a good idea to just say
> >> "statically linked softmmu isn't supported" and forbid it, unless
> >> somebody has a good use case for it...
> >
> > I personnally have such a use-case: provide run-everywhere qemu softmmu
> > binaries that do have minimal requirements on the distro they'll be
> > running on, especially when the distros can be very different (in kinds
> > and in age).
> 
> ...have you audited all of qemu's library usage to confirm that it
> doesn't use any of the bits of glibc that don't work in the static
> linking scenario? I'm reasonably confident that the linux-user binaries
> are OK, much less so for the system binaries...

I guess you mean the nsswitch stuff?

I'm using a uClibc-based toolchain that does not have such libs, and allows
a truly static link.

Regards,
Yann E. MORIN.

-- 
.-..--..
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN |  ___   |
| +33 223 225 172 `.---:  X  AGAINST  |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL|   v   conspiracy.  |
'--^---^--^'



Re: [Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-03 Thread Peter Maydell
On 3 September 2012 17:28, Yann E. MORIN  wrote:
> On Monday 03 September 2012 17:44:51 Peter Maydell wrote:
>> Personally I think it might indeed be a good idea to just say
>> "statically linked softmmu isn't supported" and forbid it, unless
>> somebody has a good use case for it...
>
> I personnally have such a use-case: provide run-everywhere qemu softmmu
> binaries that do have minimal requirements on the distro they'll be
> running on, especially when the distros can be very different (in kinds
> and in age).

...have you audited all of qemu's library usage to confirm that it
doesn't use any of the bits of glibc that don't work in the static
linking scenario? I'm reasonably confident that the linux-user binaries
are OK, much less so for the system binaries...

-- PMM



Re: [Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-03 Thread Yann E. MORIN
Hello All,

On Monday 03 September 2012 17:44:51 Peter Maydell wrote:
> On 3 September 2012 16:41, Andreas Färber  wrote:
> > The only use case for QEMU's --static compilation I know is linux-user,
> > and that doesn't need cURL or SDL AFAIK. Shouldn't we rather sanitize
> > our configure-time checks to only look for the actually needed stuff
> > than making sure that unnecessary dependencies are generated nicely?
> 
> In particular it might be nice to be able to build in a single
> run both (a) dynamically linked softmmu targets and (b) statically
> linked linux-user targets (and maybe even also (c) dynamically
> linked linux-user targets?).
> 
> Personally I think it might indeed be a good idea to just say
> "statically linked softmmu isn't supported" and forbid it, unless
> somebody has a good use case for it...

I personnally have such a use-case: provide run-everywhere qemu softmmu
binaries that do have minimal requirements on the distro they'll be
running on, especially when the distros can be very different (in kinds
and in age).

For example, I can use it to provide:
  - a qemu binary
  - a VM image
  - a script
that users can simply drop anywhere they want (without needing root
access) and run the VM, without requiring them to install a myriad
packages, especially on older distros that may lack those packages,
or whose packaged versions are too old for qemu.

Regards,
Yann E. MORIN.

-- 
.-..--..
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN |  ___   |
| +33 223 225 172 `.---:  X  AGAINST  |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL|   v   conspiracy.  |
'--^---^--^'



Re: [Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-03 Thread Peter Maydell
On 3 September 2012 16:41, Andreas Färber  wrote:
> The only use case for QEMU's --static compilation I know is linux-user,
> and that doesn't need cURL or SDL AFAIK. Shouldn't we rather sanitize
> our configure-time checks to only look for the actually needed stuff
> than making sure that unnecessary dependencies are generated nicely?

In particular it might be nice to be able to build in a single
run both (a) dynamically linked softmmu targets and (b) statically
linked linux-user targets (and maybe even also (c) dynamically
linked linux-user targets?).

Personally I think it might indeed be a good idea to just say
"statically linked softmmu isn't supported" and forbid it, unless
somebody has a good use case for it...

-- PMM



Re: [Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-03 Thread Andreas Färber
Hello,

Am 02.09.2012 15:09, schrieb Yann E. MORIN:
> Currently, configure checks for cURL and SDL with either pkg-config (the
> default), or with {curl,sdl}-config (as a fallback).
> 
> But pkg-config and {curl,sdl}-config do not have the same set of options:
>   - to check for shared libs, both use the option: --libs
>   - to check for static libs:
> - pkg-config uses  : --static --libs
> - {curl,sdl}-config use: --static-libs
> 
> To add to the complexity, pkg-config is called through the querry_pkg_config
> wrapper, that already passes --static when static linking is required, but
> there is no such wrapper for {curl,sdl}-config, so we miss the occasion to
> pass --static-libs.
> 
> To fix this:
>   - introduce a new variable QEMU_XXX_CONFIG_LIBS_FLAGS that mirrors the
> behavior of QEMU_PKG_CONFIG_FLAGS; this variable can be used by all
> xxx-config scripts (eg. curl-config, but later sdl-config too).
> Default it to '--libs', which is for shared linking.
>   - properly use either --libs for pkg-config (--static is already taken
> care of in the wrapper), or $QEMU_XXX_CONFIG_LIBS_FLAGS for
> {curl,sdl}-config.

While this patch set looks okay technically, I wonder if this is fixing
the wrong problem...

The only use case for QEMU's --static compilation I know is linux-user,
and that doesn't need cURL or SDL AFAIK. Shouldn't we rather sanitize
our configure-time checks to only look for the actually needed stuff
than making sure that unnecessary dependencies are generated nicely?

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-03 Thread Stefan Hajnoczi
On Sun, Sep 2, 2012 at 2:09 PM, Yann E. MORIN  wrote:
> Hello All!
>
> Currently, configure checks for cURL and SDL with either pkg-config (the
> default), or with {curl,sdl}-config (as a fallback).
>
> But pkg-config and {curl,sdl}-config do not have the same set of options:
>   - to check for shared libs, both use the option: --libs
>   - to check for static libs:
> - pkg-config uses  : --static --libs
> - {curl,sdl}-config use: --static-libs
>
> To add to the complexity, pkg-config is called through the querry_pkg_config
> wrapper, that already passes --static when static linking is required, but
> there is no such wrapper for {curl,sdl}-config, so we miss the occasion to
> pass --static-libs.
>
> To fix this:
>   - introduce a new variable QEMU_XXX_CONFIG_LIBS_FLAGS that mirrors the
> behavior of QEMU_PKG_CONFIG_FLAGS; this variable can be used by all
> xxx-config scripts (eg. curl-config, but later sdl-config too).
> Default it to '--libs', which is for shared linking.
>   - properly use either --libs for pkg-config (--static is already taken
> care of in the wrapper), or $QEMU_XXX_CONFIG_LIBS_FLAGS for
> {curl,sdl}-config.
>
>
> Changes since v2:
>   - remove trailing reference to cURL in the SDL patch (Stefan Hajnoczi)
>   - sent to qemu-devel and cc qemu-trivial (Peter Maydell, Stefan)
>   - fix type in the name of the new variable
>
> Changes since v1:
>   - drop the spice fix, it is not needed (bad env locally)
>   - drop the added --static to calls to pkg-config, as it's already in the
> wrapper (Stefan Hajnoczi)

Reviewed-by: Stefan Hajnoczi 



[Qemu-devel] [PATCH 0/2 v3] Fix static linking for cURL and SDL

2012-09-02 Thread Yann E. MORIN
Hello All!

Currently, configure checks for cURL and SDL with either pkg-config (the
default), or with {curl,sdl}-config (as a fallback).

But pkg-config and {curl,sdl}-config do not have the same set of options:
  - to check for shared libs, both use the option: --libs
  - to check for static libs:
- pkg-config uses  : --static --libs
- {curl,sdl}-config use: --static-libs

To add to the complexity, pkg-config is called through the querry_pkg_config
wrapper, that already passes --static when static linking is required, but
there is no such wrapper for {curl,sdl}-config, so we miss the occasion to
pass --static-libs.

To fix this:
  - introduce a new variable QEMU_XXX_CONFIG_LIBS_FLAGS that mirrors the
behavior of QEMU_PKG_CONFIG_FLAGS; this variable can be used by all
xxx-config scripts (eg. curl-config, but later sdl-config too).
Default it to '--libs', which is for shared linking.
  - properly use either --libs for pkg-config (--static is already taken
care of in the wrapper), or $QEMU_XXX_CONFIG_LIBS_FLAGS for
{curl,sdl}-config.


Changes since v2:
  - remove trailing reference to cURL in the SDL patch (Stefan Hajnoczi)
  - sent to qemu-devel and cc qemu-trivial (Peter Maydell, Stefan)
  - fix type in the name of the new variable

Changes since v1:
  - drop the spice fix, it is not needed (bad env locally)
  - drop the added --static to calls to pkg-config, as it's already in the
wrapper (Stefan Hajnoczi)

Regards,
Yann E. MORIN.