<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>143999</bug_id>
          
          <creation_ts>2006-08-15 06:07 0000</creation_ts>
          <short_desc>app-emulation/xen{,tools}-3.0.2 &quot;cross&quot; build failed</short_desc>
          <delta_ts>2006-10-13 17:06:41 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Ebuilds</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <status_whiteboard>scheduled for xen-tools-3.0.2-r4</status_whiteboard>
          <keywords>Bug</keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>144994</blocked>
          
          <everconfirmed>1</everconfirmed>
          <reporter>tonich@artparade.ru</reporter>
          <assigned_to>aross@gentoo.org</assigned_to>
          <cc>swegener@gentoo.org</cc>
    
    <cc>xen@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>tonich@artparade.ru</who>
            <bug_when>2006-08-15 06:07:55 0000</bug_when>
            <thetext>I&apos;m trying build xen in 32bit system with 64 bit kernel booted (ia32 emulation), but it fails with errors:

# emerge xen
Calculating dependencies... done!
&gt;&gt;&gt; Emerging (1 of 1) app-emulation/xen-3.0.2 to /
&gt;&gt;&gt; checking ebuild checksums ;-)
&gt;&gt;&gt; checking auxfile checksums ;-)
&gt;&gt;&gt; checking miscfile checksums ;-)
&gt;&gt;&gt; checking xen-3.0.2-src.tgz ;-)
&gt;&gt;&gt; Unpacking source...
&gt;&gt;&gt; Unpacking xen-3.0.2-src.tgz to /var/tmp/portage/xen-3.0.2/work
&gt;&gt;&gt; Source unpacked.
&gt;&gt;&gt; Compiling source in /var/tmp/portage/xen-3.0.2/work/xen-3.0.2 ...
make: Entering directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen&apos;
make -C tools
make[1]: Entering directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/tools&apos;
make -C figlet
make[2]: Entering directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/tools/figlet&apos;
gcc -o figlet figlet.c
make[2]: Leaving directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/tools/figlet&apos;
make symbols
make[2]: Entering directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/tools&apos;
gcc -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer -Wdeclaration-after-statement -o symbols symbols.c
make[2]: Leaving directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/tools&apos;
make[1]: Leaving directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/tools&apos;
make include/xen/compile.h
make[1]: Entering directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen&apos;
tools/figlet/figlet -d tools/figlet Xen 3.0.2 &gt; include/xen/banner.h.new
 __  __            _____  ___   ____
 \ \/ /___ _ __   |___ / / _ \ |___ \
  \  // _ \ &apos;_ \    |_ \| | | |  __) |
  /  \  __/ | | |  ___) | |_| | / __/
 /_/\_\___|_| |_| |____(_)___(_)_____|

make[1]: Leaving directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen&apos;
make include/xen/acm_policy.h
make[1]: Entering directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen&apos;
make[1]: Leaving directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen&apos;
[ -e include/asm ] || ln -sf asm-x86 include/asm
make -C arch/x86 asm-offsets.s
make[1]: Entering directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/arch/x86&apos;
gcc -O2 -fomit-frame-pointer -DNDEBUG -m64 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -nostdinc -fno-builtin -fno-common -fno-strict-aliasing -iwithprefix include -Werror -Wno-pointer-arith -pipe -I/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/include -I/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/include/asm-x86/mach-generic -I/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/include/asm-x86/mach-default -msoft-float -mno-red-zone -fpic -fno-reorder-blocks -fno-asynchronous-unwind-tables -g -D__XEN__ -S -o asm-offsets.s x86_64/asm-offsets.c
x86_64/asm-offsets.c:1: sorry, unimplemented: 64-bit mode not compiled in
x86_64/asm-offsets.c: In function `__dummy__&apos;:
x86_64/asm-offsets.c:29: error: structure has no member named `r15&apos;
x86_64/asm-offsets.c:30: error: structure has no member named `r14&apos;
x86_64/asm-offsets.c:31: error: structure has no member named `r13&apos;
x86_64/asm-offsets.c:32: error: structure has no member named `r12&apos;
x86_64/asm-offsets.c:33: error: structure has no member named `rbp&apos;
x86_64/asm-offsets.c:34: error: structure has no member named `rbx&apos;
x86_64/asm-offsets.c:35: error: structure has no member named `r11&apos;
x86_64/asm-offsets.c:36: error: structure has no member named `r10&apos;
x86_64/asm-offsets.c:37: error: structure has no member named `r9&apos;
x86_64/asm-offsets.c:38: error: structure has no member named `r8&apos;
x86_64/asm-offsets.c:39: error: structure has no member named `rax&apos;
x86_64/asm-offsets.c:40: error: structure has no member named `rcx&apos;
x86_64/asm-offsets.c:41: error: structure has no member named `rdx&apos;
x86_64/asm-offsets.c:42: error: structure has no member named `rsi&apos;
x86_64/asm-offsets.c:43: error: structure has no member named `rdi&apos;
x86_64/asm-offsets.c:46: error: structure has no member named `rip&apos;
x86_64/asm-offsets.c:49: error: structure has no member named `rsp&apos;
x86_64/asm-offsets.c:63: error: structure has no member named `syscall_callback_eip&apos;
make[1]: *** [asm-offsets.s] Error 1
make[1]: Leaving directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/arch/x86&apos;
make: *** [/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen/xen] Error 2
make: Leaving directory `/var/tmp/portage/xen-3.0.2/work/xen-3.0.2/xen&apos;

!!! ERROR: app-emulation/xen-3.0.2 failed.
Call stack:
  ebuild.sh, line 1539:   Called dyn_compile
  ebuild.sh, line 939:   Called src_compile
  xen-3.0.2.ebuild, line 60:   Called die

command:
# XEN_TARGET_ARCH=&quot;x86_32&quot; emerge xen
solves this problem</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>tonich@artparade.ru</who>
            <bug_when>2006-08-15 06:19:25 0000</bug_when>
            <thetext>xen-tools have the same problem</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>aross@gentoo.org</who>
            <bug_when>2006-08-15 20:59:58 0000</bug_when>
            <thetext>Sven, are you in a position to duplicate this with your amd64 hardware? I only have x86.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>swegener@gentoo.org</who>
            <bug_when>2006-08-16 00:13:58 0000</bug_when>
            <thetext>Sure, I just need to set up a 32bit domain, but I&apos;m pretty sure I don&apos;t need to do it. The xen packages use uname -m to find the architecture, which in case of a 64bit kernel will be x86_64, for which a 32bit system can&apos;t compile code.

Pretty simple and straightforward fix is to force XEN_TARGET_ARCH to the correct value, as tonich did on the command line. I&apos;m thinking about code like the following:

--- xen-3.0.2.ebuild.orig	2006-08-16 06:48:16.000000000 +0000
+++ xen-3.0.2.ebuild	2006-08-16 07:03:36.000000000 +0000
@@ -25,6 +25,21 @@
 
 RESTRICT=&quot;test&quot;
 
+pkg_setup() {
+	if [[ -z ${XEN_TARGET_ARCH} ]]
+	then
+		if use x86
+		then
+			export XEN_TARGET_ARCH=&quot;x86_32&quot;
+		elif use amd64
+		then
+			export XEN_TARGET_ARCH=&quot;x86_64&quot;
+		else
+			die &quot;Unsupported architecture!&quot;
+		fi
+	fi
+}
+
 src_unpack() {
 	unpack ${A}
 	# if the user *really* wants to use their own custom-cflags, let them

Another thing might be to integrate complete cross-compile support into the packages. I haven&apos;t tried to cross-compile the beast on x86 for amd64, which might be worth a shot.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>aross@gentoo.org</who>
            <bug_when>2006-10-06 16:21:59 0000</bug_when>
            <thetext>Fixed in app-emulation/xen-3.0.2 without a bump, since the other change intended for -r1 (#147876) was scrapped.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>aross@gentoo.org</who>
            <bug_when>2006-10-13 17:06:41 0000</bug_when>
            <thetext>Fixed in app-emulation/xen-tools-3.0.2-r4, thanks.</thetext>
          </long_desc>
      
    </bug>

</bugzilla>