Skip to contentSkip to conversation

partly fix cross-build of ioemu-remote

PATCH In review Aron Griffis 4 participants 13 messages Jul 31, 2008 – Aug 11, 2008 1 message not in the archive Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 partly fix cross-build of ioemu-remote

These two patches partly repair cross-building of ioemu-dir. There's still a problem where the translation layer is being built, which doesn't exist for ia64, so it bombs out eventually.

The first patch applies to xen-unstable.hg, second patch applies to the ioemu git tree.

Thanks,
Aron

#1 lore raw

PATCH 1/1 pass IOEMU_CONFIGURE_CROSS to ioemu-remote/xen-setup

# HG changeset patch
# User Aron Griffis <[email protected]>
# Date 1217515818 14400
# Node ID be6b349abfb8d1d84618597c5304ab2e0500d5b4 # Parent 05391ca07588c45f5c8dd16c2a470b0d615767b8 pass IOEMU_CONFIGURE_CROSS to ioemu-remote/xen-setup

Add --cpu to IOEMU_CONFIGURE_CROSS since otherwise qemu uses the output of uname -m even for cross-building. Pass IOEMU_CONFIGURE_CROSS to xen-setup which passes it on to ioemu/configure.

tools/Makefile +3 -2
diff -r 05391ca07588 -r be6b349abfb8 tools/Makefile
@@ -55,7 +55,8 @@
 clean distclean: subdirs-clean
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
-IOEMU_CONFIGURE_CROSS ?= --cross-prefix=$(CROSS_COMPILE) \
+IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
+			 --cross-prefix=$(CROSS_COMPILE) \
 			 --interp-prefix=$(CROSS_SYS_ROOT)
 endif
 
@@ -96,7 +97,7 @@
 		esac; \
 		export XEN_ROOT; \
 		cd ioemu-dir; \
-		./xen-setup
+		./xen-setup $(IOEMU_CONFIGURE_CROSS)
 
 subdir-all-ioemu-dir subdir-install-ioemu-dir: ioemu-dir-find
#2 lore raw

PATCH 1/1 cross-build fixes in ioemu-remote

In reply to Aron Griffis

Partly fix cross-building in ioemu-remote:

- Don't call install -s; it uses the host strip program which doesn't understand cross-built binaries. This same change was in the legacy ioemu dir.

- The ioemu version of cc-option doesn't take $(CC) as the first argument, so all builds were getting -msse2 regardless of architecture.

Makefile +1 -1
index bebd244..b055b3f 100644
@@ -205,7 +205,7 @@ endif
 install: all $(if $(BUILD_DOCS),install-doc)
 	mkdir -p "$(DESTDIR)$(bindir)"
 ifneq ($(TOOLS),)
-	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
+	$(INSTALL) -m 755 $(TOOLS) "$(DESTDIR)$(bindir)"
 endif
 	mkdir -p "$(DESTDIR)$(datadir)"
 	set -e; for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
Makefile.target +1 -1
index 1aace9c..e796d61 100644
@@ -707,7 +707,7 @@ clean:
 
 install: all install-hook
 ifneq ($(PROGS),)
-	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
+	$(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
 endif
 
 # Include automatically generated dependency files
xen-hooks.mak +1 -1
index af977ef..c90f546 100644
@@ -3,7 +3,7 @@ CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore
 CPPFLAGS+= -I$(XEN_ROOT)/tools/include
 CPPFLAGS+= -I$(XEN_ROOT)/tools/blktap/lib
 
-SSE2 := $(call cc-option,$(CC),-msse2,)
+SSE2 := $(call cc-option,-msse2,)
 ifeq ($(SSE2),-msse2)
 CFLAGS += -DUSE_SSE2=1 -msse2
 endif
#4 lore raw

Re: [Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote

In reply to a message not in the archive

Aron Griffis writes ("[Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote"):

Quoted 5 lines

Partly fix cross-building in ioemu-remote:

- The ioemu version of cc-option doesn't take $(CC) as the first argument, so all builds were getting -msse2 regardless of architecture.

I'll commit this in just a moment.

Quoted 3 lines

- Don't call install -s; it uses the host strip program which doesn't understand cross-built binaries. This same change was in the legacy ioemu dir.

I think this should be fixed by the build environment, or possibly $(INSTALL), being arranged to not have this bug. If $(INSTALL) -s doesn't work then this should be fixed. Options include putting a symlink to /bin/true on the path somewhere under the name `strip', or overriding INSTALL somehow to a more clever program.

I really don't want to apply these Makefile changes. That is the kind of thing which makes merging painful.

Ian.

#5 lore raw

Re: [Xen-ia64-devel] Re: [PATCH 2 of 2] cross-build fixes in ioemu-remote

Quoted 10 lines · Ian Jackson, le Thu 31 Jul 2008 16:16:37 +0100, a écrit :

Aron Griffis writes ("[Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote"):

Quoted 3 lines

- Don't call install -s; it uses the host strip program which doesn't understand cross-built binaries. This same change was in the legacy ioemu dir.

I think this should be fixed by the build environment, or possibly $(INSTALL), being arranged to not have this bug. If $(INSTALL) -s doesn't work then this should be fixed. Options include putting a symlink to /bin/true on the path somewhere under the name `strip', or overriding INSTALL somehow to a more clever program.

I have the same issue when cross-compiling some other projects. I wonder how install would be able to know which strip command it should use.

Samuel

#13 lore raw

Re: Re: [Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote

In reply to Ian Jackson
Quoted 8 lines · Ian Jackson, le Thu 31 Jul 2008 16:16:37 +0100, a écrit :

Aron Griffis writes ("[Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote"):

Quoted 5 lines

Partly fix cross-building in ioemu-remote:

- The ioemu version of cc-option doesn't take $(CC) as the first argument, so all builds were getting -msse2 regardless of architecture.

I'll commit this in just a moment.

Mmm, actually I think we don't need that sse2 option any more: thanks to dirty bit tracking, the sse2-optimized memcmp loop is gone. At least -DUSE_SSE2 is not used anywhere.

Samuel

#6 lore raw

Re: [Xen-ia64-devel] Re: [PATCH 2 of 2] cross-build fixes in ioemu-remote

In reply to Samuel Thibault

Samuel Thibault writes ("Re: [Xen-ia64-devel] Re: [Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote"):

Quoted 3 lines

I have the same issue when cross-compiling some other projects. I wonder how install would be able to know which strip command it should use.

Perhaps it should call STRIP if it exists, or perhaps the cross-building setup should provide a `strip' which will always DTRT (perhaps by examining the file to decide which real strip to invoke).

Ian.

#7 lore raw

Re: [Xen-ia64-devel] Re: [PATCH 2 of 2] cross-build fixes in ioemu-remote

Ian Jackson wrote: [Thu Jul 31 2008, 12:48:15PM EDT]

Quoted 8 lines

Samuel Thibault writes ("Re: [Xen-ia64-devel] Re: [Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote"):

Quoted 3 lines

I have the same issue when cross-compiling some other projects. I wonder how install would be able to know which strip command it should use.

Perhaps it should call STRIP if it exists, or perhaps the cross-building setup should provide a `strip' which will always DTRT (perhaps by examining the file to decide which real strip to invoke).

I don't think it's necessary to provide one that will DTRT. The compiler and linker don't need that abstraction, and "install" is only called for stuff that will be installed on the target system.

qemu seems to have the ability to set the install command using configure. Seems something like the following should work, except that (1) i386-dm/hookstarget.mak uses $(INSTALL_PROG) which seems to be defined outside of the ioemu tree, and (2) I'm having enough trouble cross-building qemu that it's hard to test.

Thanks,
Aron

tools/Makefile +5 -2
diff -r 40daf3257cad tools/Makefile
@@ -36,9 +36,11 @@ SUBDIRS-$(PYTHON_TOOLS) += pygrub
 SUBDIRS-$(PYTHON_TOOLS) += pygrub
 endif
 
-# For the sake of linking, set the sys-root
+# For the sake of linking, set the path to "strip" and the sys-root
 ifneq ($(CROSS_COMPILE),)
+CROSS_BIN_PATH ?= /usr/$(CROSS_COMPILE:-=)/bin
 CROSS_SYS_ROOT ?= /usr/$(CROSS_COMPILE:-=)/sys-root
+# export sys-root to environment for check/funcs.sh
 export CROSS_SYS_ROOT
 endif
 
@@ -57,7 +59,8 @@ ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
 			 --cross-prefix=$(CROSS_COMPILE) \
-			 --interp-prefix=$(CROSS_SYS_ROOT)
+			 --interp-prefix=$(CROSS_SYS_ROOT) \
+			 --install='env PATH="$(CROSS_BIN_PATH):$$$$PATH" install'
 endif
 
 ioemu/config-host.mak:
#8 lore raw

Re: [Xen-ia64-devel] Re: [PATCH 2 of 2] cross-build fixes in ioemu-remote

Aron Griffis writes ("Re: [Xen-ia64-devel] Re: [Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote"):

tools/Makefile ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ · line 63

Quoted 3 lines
tools/Makefile +2 -1
-			 --interp-prefix=$(CROSS_SYS_ROOT)
+			 --interp-prefix=$(CROSS_SYS_ROOT) \
+			 --install='env PATH="$(CROSS_BIN_PATH):$$$$PATH" install'

This is a bit bizarre (not to mention the fact that the number of $'s will depend on undocumented properties of the way qemu's configure inteprets that option).

Why not just set PATH directly and export it ?

But in general I think this is a reasonable approach.

Ian.

#9 lore raw

Re: Re: [Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote

Ian Jackson wrote: [Fri Aug 01 2008, 12:26:54PM EDT]

Quoted 8 lines

Aron Griffis writes ("Re: [Xen-ia64-devel] Re: [Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote"):

Review

Quoted 3 lines
(quoted diff) +2 -1
-			 --interp-prefix=$(CROSS_SYS_ROOT)
+			 --interp-prefix=$(CROSS_SYS_ROOT) \
+			 --install='env PATH="$(CROSS_BIN_PATH):$$$$PATH" install'

This is a bit bizarre (not to mention the fact that the number of $'s will depend on undocumented properties of the way qemu's configure inteprets that option).

qemu's configure uses quoting properly and applies no interpretation on the way through. The dollars are doubled once for the Makefile where this is set, once for the inner Makefile where it is used.

However... there is a Solaris hack in configure that will break with any --install option other than a bare word. And I agree with you anyway, it's a fragile approach.

Quoted 1 line

Why not just set PATH directly and export it ?

qemu expects "gcc" and the like to refer to the host toolchain. I think we only want the PATH set for install. Ideally there would be an /usr/bin/ia64-linux-gnu-install to accompany the others and use the right strip, but oh well.

Quoted 1 line

But in general I think this is a reasonable approach.

How about...

# HG changeset patch
# User Aron Griffis <[email protected]>
# Date 1217610812 14400
# Node ID 714215c06a98ea845e3f25371945d62abb1c18c7 # Parent f69a23b209c4ab04827051734e37f095607400ed add cross-install to find the right "strip"

tools/Makefile +5 -2
@@ -38,8 +38,10 @@
 
 # For the sake of linking, set the sys-root
 ifneq ($(CROSS_COMPILE),)
+CROSS_BIN_PATH ?= /usr/$(CROSS_COMPILE:-=)/bin
 CROSS_SYS_ROOT ?= /usr/$(CROSS_COMPILE:-=)/sys-root
-export CROSS_SYS_ROOT
+export CROSS_SYS_ROOT # exported for check/funcs.sh
+export CROSS_BIN_PATH # exported for cross-install.sh
 endif
 
 .PHONY: all
@@ -57,7 +59,8 @@
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
 			 --cross-prefix=$(CROSS_COMPILE) \
-			 --interp-prefix=$(CROSS_SYS_ROOT)
+			 --interp-prefix=$(CROSS_SYS_ROOT) \
+			 --install=$(CURDIR)/cross-install
 endif
 
 ioemu/config-host.mak:
tools/cross-install new file +8 -0
new file mode 100755
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# prepend CROSS_BIN_PATH to find the right "strip"
+if [ -n "$CROSS_BIN_PATH" ]; then
+    PATH="$CROSS_BIN_PATH:$PATH"
+fi
+
+exec install "$@"
#10 lore raw

Re: [Xen-ia64-devel] Re: [PATCH 2 of 2] cross-build fixes in ioemu-remote

Any responses to my last email and patch in this thread?

It would be nice to get cross-install (or something like it) in the tree, along with fixing the build on ia64.

The build problem is that translate-all.c doesn't build on ia64, because there's no support for instruction translation on ia64. But it shouldn't need to build translate-all.c at all for ioemu. It didn't on the legacy ioemu, and it's only working right now on ia32 and x86_64 because those arches can build translate-all.c, however unnecessary it is.

I took a quick look but I'm not quickly seeing how to change the build to omit translate-all.c. It would be great if somebody more familiar with ioemu could take a glance.

Thanks,
Aron

#11 lore raw

Re: [Xen-ia64-devel] Re: [PATCH 2 of 2] cross-build fixes in ioemu-remote

Unfortunately Ian is away this week, so these changes aren't likely to get picked up or commented on until Monday.

-- Keir

Quoted 23 lines · Aron Griffis

Any responses to my last email and patch in this thread?

It would be nice to get cross-install (or something like it) in the tree, along with fixing the build on ia64.

The build problem is that translate-all.c doesn't build on ia64, because there's no support for instruction translation on ia64. But it shouldn't need to build translate-all.c at all for ioemu. It didn't on the legacy ioemu, and it's only working right now on ia32 and x86_64 because those arches can build translate-all.c, however unnecessary it is.

I took a quick look but I'm not quickly seeing how to change the build to omit translate-all.c. It would be great if somebody more familiar with ioemu could take a glance.

Thanks,
Aron

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#12 lore raw

Re: Re: [Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote

In reply to Aron Griffis

Aron Griffis writes ("Re: [Xen-ia64-devel] Re: [Xen-devel] [PATCH 2 of 2] cross-build fixes in ioemu-remote"):

Quoted 6 lines

# HG changeset patch
# User Aron Griffis <[email protected]>
# Date 1217610812 14400
# Node ID 714215c06a98ea845e3f25371945d62abb1c18c7 # Parent f69a23b209c4ab04827051734e37f095607400ed add cross-install to find the right "strip"

I think this is a good patch.

Ian.