Package: qemu
Version: 1:2.3+dfsg-3
Severity: serious
Tags: sid
User: debian-m...@lists.debian.org
Usertags: mips-patch


Package qemu_1:2.3+dfsg-3 FTBFS on mips, mipsel, armhf, arm64, kfreebsd-amd64 
with "recompile with -fPIC" message.
https://buildd.debian.org/status/package.php?p=qemu&suite=sid

This issue occur because few object .o files are built without -fPIC
and later they are used for creating library .so file with -fPIC enabled.

Solution for this is available upstream:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=d24697e1824467f3921c84a94f011f43d6466403

--- a/rules.mak
+++ b/rules.mak
@@ -102,7 +102,8 @@ endif
 %.o: %.dtrace
        $(call quiet-command,dtrace -o $@ -G -s $<, "  GEN   $(TARGET_DIR)$@")

-%$(DSOSUF): CFLAGS += -fPIC -DBUILD_DSO
+DSO_OBJ_CFLAGS := -fPIC -DBUILD_DSO
+module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS)
 %$(DSOSUF): LDFLAGS += $(LDFLAGS_SHARED)
 %$(DSOSUF): %.mo
        $(call LINK,$^)
@@ -351,6 +352,7 @@ define unnest-vars
         # For non-module build, add -m to -y
         $(if $(CONFIG_MODULES),
              $(foreach o,$($v),
+                   $(eval $($o-objs): CFLAGS += $(DSO_OBJ_CFLAGS))
                    $(eval $o: $($o-objs)))
              $(eval $(patsubst %-m,%-y,$v) += $($v))
              $(eval modules: $($v:%.mo=%$(DSOSUF))),

This issue does not occur on i386 and amd64 because -fPIE is used for build on 
those archs.

Part of the configure file:

 if test "$pie" = ""; then
   case "$cpu-$targetos" in
     i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
       ;;
     *)
       pie="no"
       ;;
   esac
 fi

With this patch from upstream (attached) package does build on mipsel 
successfully.

Thank you!

Regards,
Jurica
--- qemu-2.3+dfsg.orig/rules.mak
+++ qemu-2.3+dfsg/rules.mak
@@ -102,7 +102,8 @@ endif
 %.o: %.dtrace
 	$(call quiet-command,dtrace -o $@ -G -s $<, "  GEN   $(TARGET_DIR)$@")
 
-%$(DSOSUF): CFLAGS += -fPIC -DBUILD_DSO
+DSO_OBJ_CFLAGS := -fPIC -DBUILD_DSO
+module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS)
 %$(DSOSUF): LDFLAGS += $(LDFLAGS_SHARED)
 %$(DSOSUF): %.mo
 	$(call LINK,$^)
@@ -351,6 +352,7 @@ define unnest-vars
         # For non-module build, add -m to -y
         $(if $(CONFIG_MODULES),
              $(foreach o,$($v),
+                   $(eval $($o-objs): CFLAGS += $(DSO_OBJ_CFLAGS))
                    $(eval $o: $($o-objs)))
              $(eval $(patsubst %-m,%-y,$v) += $($v))
              $(eval modules: $($v:%.mo=%$(DSOSUF))),

Reply via email to