Skip to contentSkip to conversation

modules: Fix building with --enable-modules

PATCH Superseded Fam Zheng 3 participants 3 messages Feb 26, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 modules: Fix building with --enable-modules

Compiling util/modules.c with modules enabled fails now.

Fix it by:

1) Add "#define CONFIG_MODULES" with --enable-modules

2) Include qemu-common.h before #ifdef testing in module.c.

---
 scripts/create_config | 3 +++
 util/module.c         | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
scripts/create_config +3 -0
index 546f889..a0654c6 100755
@@ -30,6 +30,9 @@ case $line in
     value=${line#*=}
     echo "#define CONFIG_IASL $value"
     ;;
+ CONFIG_MODULES=y)
+    echo "#define CONFIG_MODULES 1"
+    ;;
  CONFIG_AUDIO_DRIVERS=*)
     drivers=${line#*=}
     echo "#define CONFIG_AUDIO_DRIVERS \\"
util/module.c +1 -1
index dc08c16..863a8a3 100644
@@ -14,10 +14,10 @@
  */
 
 #include <stdlib.h>
+#include "qemu-common.h"
 #ifdef CONFIG_MODULES
 #include <gmodule.h>
 #endif
-#include "qemu-common.h"
 #include "qemu/queue.h"
 #include "qemu/module.h"
 
Signature · 1 line
1.9.0
#1 lore raw
Quoted 33 lines · Fam Zheng

Compiling util/modules.c with modules enabled fails now.

Fix it by:

1) Add "#define CONFIG_MODULES" with --enable-modules

2) Include qemu-common.h before #ifdef testing in module.c.

---
 scripts/create_config | 3 +++
 util/module.c         | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
scripts/create_config +3 -0
index 546f889..a0654c6 100755
@@ -30,6 +30,9 @@ case $line in
     value=${line#*=}
     echo "#define CONFIG_IASL $value"
     ;;
+ CONFIG_MODULES=y)
+    echo "#define CONFIG_MODULES 1"
+    ;;
  CONFIG_AUDIO_DRIVERS=*)
     drivers=${line#*=}
     echo "#define CONFIG_AUDIO_DRIVERS \\"
util/module.c +0 -0
index dc08c16..863a8a3 100644

util/module.c line 17

Quoted 4 lines
util/module.c +1 -0
@@ -14,10 +14,10 @@
  */
 
 #include <stdlib.h>
+#include "qemu-common.h"

So it's moved up here for CONFIG_MODULES. BTW, the stdlib.h line can be removed since qemu-common.h includes it already.

Reviewed&tested-by: Hu Tao <[email protected]>

Quoted 10 lines
util/module.c +0 -1
 #ifdef CONFIG_MODULES
 #include <gmodule.h>
 #endif
-#include "qemu-common.h"
 #include "qemu/queue.h"
 #include "qemu/module.h"
 
Signature · 1 line
1.9.0
#2 lore raw
In reply to Fam Zheng

Il 26/02/2014 06:56, Fam Zheng ha scritto:

Quoted 19 lines

Compiling util/modules.c with modules enabled fails now.

Fix it by:

1) Add "#define CONFIG_MODULES" with --enable-modules

2) Include qemu-common.h before #ifdef testing in module.c.

---
 scripts/create_config | 3 +++
 util/module.c         | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
scripts/create_config +0 -0
index 546f889..a0654c6 100755

scripts/create_config case $line in · line 35

Quoted 6 lines
scripts/create_config +3 -0
@@ -30,6 +30,9 @@ case $line in
     value=${line#*=}
     echo "#define CONFIG_IASL $value"
     ;;
+ CONFIG_MODULES=y)
+    echo "#define CONFIG_MODULES 1"
+    ;;

Not needed:

CONFIG_*=y) # configuration

    name=${line%=*}
    echo "#define $name 1"
    ;;

Paolo

Quoted 20 lines
scripts/create_config +0 -0
  CONFIG_AUDIO_DRIVERS=*)
     drivers=${line#*=}
     echo "#define CONFIG_AUDIO_DRIVERS \\"
util/module.c +1 -1
index dc08c16..863a8a3 100644
@@ -14,10 +14,10 @@
  */
 
 #include <stdlib.h>
+#include "qemu-common.h"
 #ifdef CONFIG_MODULES
 #include <gmodule.h>
 #endif
-#include "qemu-common.h"
 #include "qemu/queue.h"
 #include "qemu/module.h"