# xen-3.4.2-r4 compile fails

## rsnfunky

Dear All,

I am trying to compile XEN but it fails. The version automatically picked up by emerge is xen-3.4.2-r4.

The error comes at the configuration stage - 

"ERROR: app-emulation/xen-3.4.2-r4 failed (compile phase):"

output of emerge --info =app-emulation/xen-3.4.2-r4

```
emerge --info =app-emulation/xen-3.4.2-r4

Portage 2.1.10.11 (default/linux/amd64/10.0/desktop/kde, gcc-4.4.5, glibc-2.12.2-r0, 2.6.32-gentoo-r7 x86_64)

=================================================================

                        System Settings

=================================================================

System uname: Linux-2.6.32-gentoo-r7-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_6400+-with-gentoo-2.0.3

Timestamp of tree: Sun, 30 Oct 2011 04:00:01 +0000

ccache version 2.4 [enabled]

app-shells/bash:          4.1_p9

dev-java/java-config:     2.1.10

dev-lang/python:          2.6.5-r3, 3.1.3-r1

dev-util/ccache:          2.4-r9

dev-util/cmake:           2.8.4-r1

dev-util/pkgconfig:       0.25-r2

sys-apps/baselayout:      2.0.3

sys-apps/openrc:          0.8.3-r1

sys-apps/sandbox:         2.4

sys-devel/autoconf:       2.13, 2.65-r1

sys-devel/automake:       1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:       2.21.1-r1

sys-devel/gcc:            4.3.4, 4.4.5

sys-devel/gcc-config:     1.4.1-r1

sys-devel/libtool:        2.2.10

sys-devel/make:           3.82-r1

sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)

sys-libs/glibc:           2.12.2

Repositories: gentoo

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="*"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -pipe -march=athlon64"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/config /var/lib/hsqldb"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"

CXXFLAGS="-O2 -pipe -march=athlon64"

DISTDIR="/usr/portage/distfiles"

EMERGE_DEFAULT_OPTS="--autounmask=n"

FEATURES="assume-digests binpkg-logs ccache distlocks ebuild-locks fail-clean fixlafiles fixpackages multilib-strict news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS=""

GENTOO_MIRRORS="http://gentoo.mneisen.org/ http://de-mirror.org/distro/gentoo/ http://gentoo.tiscali.nl/ http://gentoo.supp.name/ http://mirrors.ludost.net/gentoo/ http://gentoo.mirror.pw.edu.pl/ http://gentoo.wheel.sk/ http://mirror.mdfnet.se/mirror/gentoo http://gentoo.prz.rzeszow.pl"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_COMPRESS="bzip2"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="3dnow X a52 aac acl acpi acqua alsa amd64 bash-completion bcmath berkdb bittorrent bluetooth branding bzip2 cairo cdda cdr cgi clamav clamdtop cli consolekit cracklib crypt ctype cups cxx dbus declarative dga djvu dri dts dvd dvdr emboss encode exchange exif extras fam ffmpeg firefox flac fontconfig fortran gd gdbm gdu gif gmp gpm gstreamer gtk h264enc iconv ieee1394 ipfilter ipv6 java java6 javascript joystick jpeg kde kipi lcms ldap libnotify lm_sensors mad mmx mng modules mp3 mp4 mpeg mplayer mudflap multilib ncurses nls nptl nptlonly nspluginwrapper ogg opengl openmp pam pango pcre pda pdf phonon plasma png policykit ppds pppd qt qt3support qt4 quicktime quotes readline reports sasl sdl semantic-desktop session spell sse sse2 ssl startup-notification svg sysfs tcpd templates threads tidy tiff tk truetype udev unicode usb vcd vorbis x264 xcb xcomposite xinerama xml xorg xpm xscreensaver xterm xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fglrx" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

output of emerge -pqv =app-emulation/xen-3.4.2-r4 is 

```
emerge -pqv =app-emulation/xen-3.4.2-r4

[ebuild     U ] app-emulation/xen-3.4.2-r4 [3.4.2-r3] USE="-acm -custom-cflags -debug -flask -pae -xsm"                                                         

 * IMPORTANT: 13 news items need reading for repository 'gentoo'.

 * Use eselect news to read news items.
```

The last few lines before the compile fail are given below -

```
make[4]: Entering directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/common/libelf'

x86_64-pc-linux-gnu-gcc -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement  -DNDEBUG -nostdinc -fno-builtin -fno-common -iwithprefix include  -Wno-pointer-arith -pipe -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include  -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include/asm-x86/mach-generic -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -mno-red-zone -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -g -D__XEN__ -MMD -MF .libelf-tools.o.d -c libelf-tools.c -o libelf-tools.o

x86_64-pc-linux-gnu-gcc -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement  -DNDEBUG -nostdinc -fno-builtin -fno-common -iwithprefix include  -Wno-pointer-arith -pipe -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include  -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include/asm-x86/mach-generic -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -mno-red-zone -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -g -D__XEN__ -MMD -MF .libelf-loader.o.d -c libelf-loader.c -o libelf-loader.o

x86_64-pc-linux-gnu-gcc -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement  -DNDEBUG -nostdinc -fno-builtin -fno-common -iwithprefix include  -Wno-pointer-arith -pipe -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include  -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include/asm-x86/mach-generic -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -mno-red-zone -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -g -D__XEN__ -MMD -MF .libelf-dominfo.o.d -c libelf-dominfo.c -o libelf-dominfo.o

make[4]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/drivers/passthrough'

ld -O1 --as-needed -r -o built_in.o char/built_in.o cpufreq/built_in.o pci/built_in.o passthrough/built_in.o acpi/built_in.o video/built_in.o

ld -O1 --as-needed -r -o built_in.o libelf-tools.o libelf-loader.o libelf-dominfo.o

make[4]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/common/libelf'

ld -O1 --as-needed -r -o built_in.o bitmap.o domctl.o domain.o event_channel.o grant_table.o kernel.o keyhandler.o kexec.o lib.o memory.o multicall.o page_alloc.o rangeset.o sched_credit.o sched_sedf.o schedule.o shutdown.o softirq.o spinlock.o stop_machine.o string.o symbols.o sysctl.o time.o timer.o trace.o version.o vsprintf.o xmalloc_tlsf.o rcupdate.o xenoprof.o compat/built_in.o hvm/built_in.o libelf/built_in.o

make[3]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/drivers'

make[3]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/common'

make[2]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86'

make[1]: *** [/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/xen] Error 2

make[1]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen'

make: *** [build] Error 2

make: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen'

emake failed

 * ERROR: app-emulation/xen-3.4.2-r4 failed (compile phase):

 *   compile failed

 * 

 * Call stack:

 *     ebuild.sh, line  56:  Called src_compile

 *   environment, line 2756:  Called die

 * The specific snippet of code:

 *       emake CC="$(tc-getCC)" LDFLAGS="$(raw-ldflags)" -C xen ${myopt} || die "compile failed"

 * 

 * If you need support, post the output of 'emerge --info =app-emulation/xen-3.4.2-r4',

 * the complete build log and the output of 'emerge -pqv =app-emulation/xen-3.4.2-r4'.

 * The complete build log is located at '/var/tmp/portage/app-emulation/xen-3.4.2-r4/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/app-emulation/xen-3.4.2-r4/temp/environment'.

 * S: '/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2'
```

Please let me know what am I doing wrong in compilation.

Thanks a ton in advance.

Regards,

----------

## Hu

Please post the topmost build error.  Since you are building in parallel, the successful jobs produced enough output that you only provided the notice that the build failed.

----------

## rsnfunky

hi posting the error log again. This time I have built it with makeopts="-j1"

```
set -e; id=_$(echo compat/arch-x86_32.h | tr '[:lower:]-/.' '[:upper:]___'); \

echo "#ifndef $id" >compat/arch-x86_32.h.new; \

echo "#define $id" >>compat/arch-x86_32.h.new; \

echo "#include <xen/compat.h>" >>compat/arch-x86_32.h.new; \

 \

echo "#pragma pack(4)" >>compat/arch-x86_32.h.new; \

grep -v '^# [0-9]' compat/arch-x86_32.i | \

/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/tools/compat-build-header.py | uniq >>compat/arch-x86_32.h.new; \

echo "#pragma pack()" >>compat/arch-x86_32.h.new; \

echo "#endif /* $id */" >>compat/arch-x86_32.h.new

mv -f compat/arch-x86_32.h.new compat/arch-x86_32.h

grep -v '^[      ]*#' xlat.lst | \

while read what name hdr; do \

        /bin/sh /var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/tools/get-fields.sh "$what" compat_$name $(echo compat/$hdr | sed 's,@arch@,x86_32,g') || exit $?; \

done >compat/xlat.h.new

mv -f compat/xlat.h.new compat/xlat.h

rm compat/kexec.i compat/arch-x86_32.c compat/arch-x86/xen-x86_32.c compat/memory.c compat/sched.c compat/trace.i compat/vcpu.c compat/xen.i compat/physdev.i compat/features.i compat/callback.c compat/event_channel.i compat/xencomm.i compat/arch-x86/xen.i compat/elfnote.c compat/arch-x86/xen-mca.i compat/version.i compat/platform.i compat/xen.c compat/kexec.c compat/nmi.i compat/elfnote.i compat/physdev.c compat/vcpu.i compat/trace.c compat/features.c compat/event_channel.c compat/grant_table.i compat/xencomm.c compat/arch-x86/xen.c compat/arch-x86/xen-mca.c compat/version.c compat/arch-x86_32.i compat/platform.c compat/memory.i compat/sched.i compat/nmi.c compat/callback.i compat/xenoprof.c compat/xenoprof.i compat/grant_table.c compat/arch-x86/xen-x86_32.i

make[2]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include'

make -f /var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/Rules.mk -C arch/x86 asm-offsets.s

make[2]: Entering directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86'

x86_64-pc-linux-gnu-gcc -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement  -DNDEBUG -nostdinc -fno-builtin -fno-common -iwithprefix include  -Wno-pointer-arith -pipe -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include  -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include/asm-x86/mach-generic -I/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -mno-red-zone -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -g -D__XEN__ -MMD -MF .asm-offsets.s.d -S -o asm-offsets.s x86_64/asm-offsets.c

make[2]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86'

make -f /var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/Rules.mk include/asm-x86/asm-offsets.h

make[2]: Entering directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen'

make[2]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen'

make -f /var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/Rules.mk -C arch/x86 /var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/xen

make[2]: Entering directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86'

make -f /var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/Rules.mk -C /var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86/boot built_in.o

make[3]: Entering directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86/boot'

RELOC=0x8c000 make -f build32.mk reloc.S

make[4]: Entering directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86/boot'

make[4]: *** ../../../../.config: Is a directory.  Stop.

make[4]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86/boot'

make[3]: *** [reloc.S] Error 2

make[3]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86/boot'

make[2]: *** [/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86/boot/built_in.o] Error 2

make[2]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/arch/x86'

make[1]: *** [/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen/xen] Error 2

make[1]: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen'

make: *** [build] Error 2

make: Leaving directory `/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2/xen'

emake failed

 * ERROR: app-emulation/xen-3.4.2-r4 failed (compile phase):

 *   compile failed

 * 

 * Call stack:

 *     ebuild.sh, line  56:  Called src_compile

 *   environment, line 2756:  Called die

 * The specific snippet of code:

 *       emake CC="$(tc-getCC)" LDFLAGS="$(raw-ldflags)" -C xen ${myopt} || die "compile failed"

 * 

 * If you need support, post the output of 'emerge --info =app-emulation/xen-3.4.2-r4',

 * the complete build log and the output of 'emerge -pqv =app-emulation/xen-3.4.2-r4'.

 * The complete build log is located at '/var/tmp/portage/app-emulation/xen-3.4.2-r4/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/app-emulation/xen-3.4.2-r4/temp/environment'.

 * S: '/var/tmp/portage/app-emulation/xen-3.4.2-r4/work/xen-3.4.2'

```

----------

## rsnfunky

Hu, Thanks to your query, I could solve the issue.

When I again retried with -j1 makeopts I found the error code which was - make[4]: *** ../../../../.config: Is a directory.  Stop. 

There was a directory named .config on my / (root folder). I renamed it to .config.old and xen compiled with no issues. 

Regards,

----------

## Hu

That sounds like a bug in the upstream build system for Xen.

----------

## VoidMage

 *Hu wrote:*   

> That sounds like a bug in the upstream build system for Xen.

 

...or perhaps simply trash in make.conf/environment.

----------

## Hu

I can understand a build system succumbing to environment variable pollution, but this one reacted very badly to the presence of a file in an area that the build system had no business inspecting.

----------

