qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] modules: do not include gmodule-2.0 in static builds
@ 2014-02-25 16:36 Paolo Bonzini
  2014-02-25 16:42 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2014-02-25 16:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

gmodule-2.0's pkg-config files include -Wl,--export-dynamic, which breaks
static builds.  It is a glib bug, but we need to support --static builds for
the linux-user targets, and in the end all that is needed to fix this is:

* outlaw --enable-modules --static, which makes little sense anyway

* only include gmodule-2.0's cflags and ldflags if --enable-modules is
specified on the command line.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure     | 9 ++++++++-
 util/module.c | 2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 2735f9a..423f435 100755
--- a/configure
+++ b/configure
@@ -1424,6 +1424,9 @@ if compile_prog "-Werror -fno-gcse" "" ; then
 fi
 
 if test "$static" = "yes" ; then
+  if test "$modules" = "yes" ; then
+    error_exit "static and modules are mutually incompatible"
+  fi
   if test "$pie" = "yes" ; then
     error_exit "static and pie are mutually incompatible"
   else
@@ -2483,8 +2486,12 @@ if test "$mingw32" = yes; then
 else
     glib_req_ver=2.12
 fi
+glib_modules=gthread-2.0
+if test "$modules" = yes; then
+    glib_modules="$glib_modules gmodule-2.0"
+fi
 
-for i in gthread-2.0 gmodule-2.0; do
+for i in $glib_modules; do
     if $pkg_config --atleast-version=$glib_req_ver $i; then
         glib_cflags=`$pkg_config --cflags $i`
         glib_libs=`$pkg_config --libs $i`
diff --git a/util/module.c b/util/module.c
index 42bc373..dc08c16 100644
--- a/util/module.c
+++ b/util/module.c
@@ -14,7 +14,9 @@
  */
 
 #include <stdlib.h>
+#ifdef CONFIG_MODULES
 #include <gmodule.h>
+#endif
 #include "qemu-common.h"
 #include "qemu/queue.h"
 #include "qemu/module.h"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] modules: do not include gmodule-2.0 in static builds
  2014-02-25 16:36 [Qemu-devel] [PATCH] modules: do not include gmodule-2.0 in static builds Paolo Bonzini
@ 2014-02-25 16:42 ` Peter Maydell
  2014-02-25 19:00   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2014-02-25 16:42 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On 25 February 2014 16:36, Paolo Bonzini <pbonzini@redhat.com> wrote:
> gmodule-2.0's pkg-config files include -Wl,--export-dynamic, which breaks
> static builds.  It is a glib bug, but we need to support --static builds for
> the linux-user targets, and in the end all that is needed to fix this is:
>
> * outlaw --enable-modules --static, which makes little sense anyway
>
> * only include gmodule-2.0's cflags and ldflags if --enable-modules is
> specified on the command line.
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

This does indeed fix the problem; I'll apply it to master
later today since it's a build-fix.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] modules: do not include gmodule-2.0 in static builds
  2014-02-25 16:42 ` Peter Maydell
@ 2014-02-25 19:00   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2014-02-25 19:00 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On 25 February 2014 16:42, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 25 February 2014 16:36, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> gmodule-2.0's pkg-config files include -Wl,--export-dynamic, which breaks
>> static builds.  It is a glib bug, but we need to support --static builds for
>> the linux-user targets, and in the end all that is needed to fix this is:
>>
>> * outlaw --enable-modules --static, which makes little sense anyway
>>
>> * only include gmodule-2.0's cflags and ldflags if --enable-modules is
>> specified on the command line.
>>
>> Reported-by: Peter Maydell <peter.maydell@linaro.org>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> This does indeed fix the problem; I'll apply it to master
> later today since it's a build-fix.

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-25 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-25 16:36 [Qemu-devel] [PATCH] modules: do not include gmodule-2.0 in static builds Paolo Bonzini
2014-02-25 16:42 ` Peter Maydell
2014-02-25 19:00   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).