Skip to content

Commit

Permalink
modules: do not include gmodule-2.0 in static builds
Browse files Browse the repository at this point in the history
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>
Message-id: 1393346215-5636-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
bonzini authored and pm215 committed Feb 25, 2014
1 parent a89d97d commit aa0d1f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion configure
Expand Up @@ -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
Expand Down Expand Up @@ -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`
Expand Down
2 changes: 2 additions & 0 deletions util/module.c
Expand Up @@ -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"
Expand Down

0 comments on commit aa0d1f4

Please sign in to comment.