Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 602656

Summary: app-emulation/xen-tools-4.8.0 build fails: implicit declaration of function 'unlikely'
Product: Gentoo Linux Reporter: John L. Poole <prestopoole>
Component: Current packagesAssignee: Gentoo Xen Devs <xen>
Status: UNCONFIRMED ---    
Severity: normal CC: aliaksei.urbanski, hydrapolic
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 870412    
Attachments: emerge --info
ebuild environment

Description John L. Poole 2016-12-14 16:26:02 UTC
Compile of xen-tools-4.8.0 fails at:

In file included from x86_emulate.c:53:0:
x86_emulate/x86_emulate.c: In function ‘in_longmode’:
x86_emulate/x86_emulate.c:1300:10: error: implicit declaration of function ‘unlikely’ [-Werror=implicit-function-declaration]
          unlikely(ops->read_msr(MSR_EFER, &efer, ctxt) != X86EMUL_OKAY) )
          ^


Reproducible: Always

Steps to Reproduce:
1. emerge  xen-tools


Note special use flags, notably "debug":

zeta package.use # pwd; cat emulation_xen-tools
/etc/portage/package.use
app-emulation/xen-tools flask hvm ovmf qemu screen sdl  debug

zeta package.use # 

Actual Results:  
>>> Failed to emerge app-emulation/xen-tools-4.8.0, Log file:

>>>  '/var/tmp/portage/app-emulation/xen-tools-4.8.0/temp/build.log'

 * Messages for package app-emulation/xen-tools-4.8.0:

 * ERROR: app-emulation/xen-tools-4.8.0::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=app-emulation/xen-tools-4.8.0::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-emulation/xen-tools-4.8.0::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/app-emulation/xen-tools-4.8.0/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-emulation/xen-tools-4.8.0/temp/environment'.
 * Working directory: '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0'
 * S: '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0'
zeta package.use # 

Expected Results:  
successful build.

I'm having problems creating a HVM guest and altered the USE flags for xen-tools to debug so I might be able to provide more information to the Xen Developers.  I think I successfully compiled xen-tools 4.8.0 previously, but now it fails.

The build log is too large to include:
zeta package.use # ls -la /var/tmp/portage/app-emulation/xen-tools-4.8.0/temp/
total 10372
drwxr-xr-x 3 portage portage     4096 Dec 14 08:10 .
drwxr-xr-x 7 portage portage     4096 Dec 14 08:10 ..
-rw-rw---- 1 portage portage 10452160 Dec 14 08:10 build.log
-rw-rw-r-- 1 portage portage     3283 Dec 14 07:59 eclass-debug.log
-rw-rw-r-- 1 portage portage   147116 Dec 14 08:00 environment
drwxr-xr-x 2 portage portage     4096 Dec 14 08:10 logging
zeta package.use # 

so I'll make it available on my web site.

Information and files requested will follow in the next half hour.
Comment 1 John L. Poole 2016-12-14 16:55:41 UTC
[ebuild   R   ] app-emulation/xen-tools-4.8.0  USE="debug* flask hvm ovmf pam qemu qemu-traditional screen sdl -api -custom-cflags -doc -ocaml -pygrub -python -static-libs -system-qemu -system-seabios" PYTHON_TARGETS="python2_7"
Comment 2 John L. Poole 2016-12-14 16:56:16 UTC
Created attachment 456182 [details]
emerge --info
Comment 3 John L. Poole 2016-12-14 17:05:27 UTC
Created attachment 456194 [details]
ebuild environment
Comment 4 John L. Poole 2016-12-14 17:15:02 UTC
The build log is 10MBs.  Here's a URL to the entire log:
http://napadata.net/2016/Gentoo/Bug_602656/build_log_xen-tools_4.80_Bug_602656.log

I think the relevant portion is at the end:

make[5]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/tests/x86_emulator'
make[5]: Entering directory '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/tests/x86_emulator'
x86_64-pc-linux-gnu-gcc  -m64 -DBUILD_ID -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs   -O0 -g3 -fno-omit-frame-pointer -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -MMD -MF .blowfish.bin.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE   -fno-stack-protector -fno-exceptions -fno-builtin -msoft-float  -c blowfish.c
x86_64-pc-linux-gnu-ld -melf_x86_64 -N -Ttext 0x100000 -o blowfish.tmp blowfish.o
objcopy -O binary blowfish.tmp blowfish.bin
rm -f blowfish.tmp
make[5]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/tests/x86_emulator'
mv blowfish.h.new blowfish.h
x86_64-pc-linux-gnu-gcc -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -Wdeclaration-after-statement -I/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/tests/x86_emulator/../../../tools/include -c -g -o x86_emulate.o x86_emulate.c
x86_64-pc-linux-gnu-gcc -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -Wdeclaration-after-statement -I/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/tests/x86_emulator/../../../tools/include -c -g -o test_x86_emulator.o test_x86_emulator.c
In file included from [01m[Kx86_emulate.c:53:0[m[K:
[01m[Kx86_emulate/x86_emulate.c:[m[K In function ‘[01m[Kin_longmode[m[K’:
[01m[Kx86_emulate/x86_emulate.c:1300:10:[m[K [01;31m[Kerror: [m[Kimplicit declaration of function ‘[01m[Kunlikely[m[K’ [-Werror=implicit-function-declaration]
          unlikely(ops->read_msr(MSR_EFER, &efer, ctxt) != X86EMUL_OKAY) )
[01;32m[K          ^[m[K
cc1: all warnings being treated as errors
Makefile:49: recipe for target 'x86_emulate.o' failed
make[4]: *** [x86_emulate.o] Error 1
make[4]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/tests/x86_emulator'
/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/tests/../../tools/Rules.mk:218: recipe for target 'subdir-all-x86_emulator' failed
make[3]: *** [subdir-all-x86_emulator] Error 2
make[3]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/tests'
/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/tests/../../tools/Rules.mk:213: recipe for target 'subdirs-all' failed
make[2]: *** [subdirs-all] Error 2
make[2]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/tests'
/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/../tools/Rules.mk:218: recipe for target 'subdir-all-tests' failed
make[1]: *** [subdir-all-tests] Error 2
make[1]: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools'
/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools/../tools/Rules.mk:213: recipe for target 'subdirs-all' failed
make: *** [subdirs-all] Error 2
make: Leaving directory '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0/tools'
 [31;01m*[0m ERROR: app-emulation/xen-tools-4.8.0::gentoo failed (compile phase):
 [31;01m*[0m   emake failed
 [31;01m*[0m 
 [31;01m*[0m If you need support, post the output of `emerge --info '=app-emulation/xen-tools-4.8.0::gentoo'`,
 [31;01m*[0m the complete build log and the output of `emerge -pqv '=app-emulation/xen-tools-4.8.0::gentoo'`.
 [31;01m*[0m The complete build log is located at '/var/tmp/portage/app-emulation/xen-tools-4.8.0/temp/build.log'.
 [31;01m*[0m The ebuild environment file is located at '/var/tmp/portage/app-emulation/xen-tools-4.8.0/temp/environment'.
 [31;01m*[0m Working directory: '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0'
 [31;01m*[0m S: '/var/tmp/portage/app-emulation/xen-tools-4.8.0/work/xen-4.8.0'
Comment 5 John L. Poole 2016-12-14 17:28:41 UTC
zeta xen-tools-4.8.0 # pwd;find . -type f -name "*.c" |xargs grep unlikely |wc -l
/var/tmp/portage/app-emulation/xen-tools-4.8.0
1768
zeta xen-tools-4.8.0 #

Given that I successfully installed xen-tools before without the "debug" flag and that the function unlikely occurs 1768 times, this must be a missing header or something related to the activation of "debug".
Comment 6 John L. Poole 2016-12-14 21:09:24 UTC
I just re-installed xen-tool omitting the "debug" flag and it successfully built.  So the problem that occurs is when "debug" is specified.  

This is not an important issue for me, I was hoping debug might offer some features that would help me provide further details.  I do not know if it would, some postings in the Xen developer list suggest that the "include" function is for portability to 64bit platform testing -- not something I'm focused on.
Comment 7 Aliaksei Urbanski 2024-03-15 23:04:08 UTC
Hello everyone,

I suppose the issue was fixed by removing the usage of `unlikely` from xen/arch/x86/x86_emulate/x86_emulate.c in https://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=f1db33e953633c9dd421664d54134f211b052336, so starting from 4.9.0 it shouldn't be reproducible.
I believe this bug might be closed now.

Best regards!