Hello.

I'm trying to compile libvirt from scratch on my ARM chromebook using
Ubuntu 22.04 as host os where I have recompiled the kernel 5.4.244 enabling
kvm, also recompiling qemu 5.1 from scratch and where I have installed
these kernel sources and libraries :

https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.244/armhf/linux-headers-5.4.244-0504244-generic_5.4.2
44- <goog_504463333>0504244.202305301242_armhf.deb

https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.244/armhf/linux-image-5.4.244-0504244-generic_5.4.244
- <goog_504463330>0504244.202305301242_armhf.deb

https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.244/armhf/linux-modules-5.4.244-0504244-generic_5.4.2
44- <goog_504463329>0504244.202305301242_armhf.deb

https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.244/amd64/linux-headers-5.4.244-0504244_5.4.244-05042
44.202305301242_all.deb

dpkg -i
linux-headers-5.4.244-0504244-generic_5.4.244-0504244.202305301242_armhf.deb
dpkg -i linux-headers-5.4.244-0504244_5.4.244-0504244.202305301242_all.deb
dpkg -i
linux-image-5.4.244-0504244-generic_5.4.244-0504244.202305301242_armhf.deb
dpkg -i
linux-modules-5.4.244-0504244-generic_5.4.244-0504244.202305301242_armhf.deb

be careful about the version of those files. It is the same version of the
kernel that I'm using,5.4.244 :

# uname -a
Linux chromarietto 5.4.244 #9 SMP Mon Aug 28 16:14:27 UTC 2023 armv7l
armv7l armv7l GNU/Linux

The idea behind is to place the correct files needed by libvirt to the
right places.

Unfortunately I haven't reached the solution yet,as you can see below. Can
you tell me which files libvirt wants to find and into which directories it
wants them ? thanks :

root@chromarietto:/Dati/libvirt# ninja -C build

ninja: Entering directory `build'
[64/1485] Compiling C object src/util/libvirt_util.a.p/virhostcpu.c.o
FAILED: src/util/libvirt_util.a.p/virhostcpu.c.o
cc -Isrc/util/libvirt_util.a.p -Isrc/util -I../src/util -Iinclude
-I../include -Isrc -I../src -I. -I.. -I/usr/include/p11-kit-1 -I/usr/
include/libnl3 -I/usr/include/glib-2.0
-I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/gio-unix-2.0
-I/usr/include/libmo
unt -I/usr/include/blkid -I/usr/include/libxml2 -I/usr/include/yajl
-fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-p
ch -Wextra -std=gnu99 -O2 -g -Werror -fasynchronous-unwind-tables
-fexceptions -fipa-pure-const -fno-common -Wabsolute-value -Waddress
-Waddress-of-packed-member -Waggressive-loop-optimizations
-Walloc-size-larger-than=2147483647 -Walloca -Warray-bounds=2 -Wattribute-al
ias=2 -Wattribute-warning -Wattributes -Wbool-compare -Wbool-operation
-Wbuiltin-declaration-mismatch -Wbuiltin-macro-redefined -Wcanno
t-profile -Wcast-align -Wcast-align=strict -Wno-cast-function-type
-Wchar-subscripts -Wclobbered -Wcomment -Wcomments -Wcoverage-mismat
ch -Wcpp -Wdangling-else -Wdate-time -Wdeclaration-after-statement
-Wdeprecated-declarations -Wdesignated-init -Wdiscarded-array-qualif
iers -Wdiscarded-qualifiers -Wdiv-by-zero -Wduplicated-cond
-Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wexpansion-to-defin
ed -Wformat-contains-nul -Wformat-extra-args -Wno-format-nonliteral
-Wformat-overflow=2 -Wformat-security -Wno-format-truncation -Wform
at-y2k -Wformat-zero-length -Wframe-address -Wframe-larger-than=2048
-Wfree-nonheap-object -Whsa -Wif-not-aligned -Wignored-attributes
-Wignored-qualifiers -Wimplicit -Wimplicit-fallthrough=5
-Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types
-W
init-self -Winline -Wint-conversion -Wint-in-bool-context
-Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch
-Wjump-misses-init
-Wlogical-not-parentheses -Wlogical-op -Wmain -Wmaybe-uninitialized
-Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentatio
n -Wmissing-attributes -Wmissing-braces -Wmissing-declarations
-Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-parameter-
type -Wmissing-profile -Wmissing-prototypes -Wmultichar
-Wmultistatement-macros -Wnarrowing -Wnested-externs -Wnonnull
-Wnonnull-compar
e -Wnormalized=nfc -Wnull-dereference -Wodr -Wold-style-declaration
-Wold-style-definition -Wopenmp-simd -Woverflow -Woverride-init -Wp
acked-bitfield-compat -Wpacked-not-aligned -Wparentheses -Wpointer-arith
-Wpointer-compare -Wpointer-sign -Wpointer-to-int-cast -Wpragm
as -Wpsabi -Wrestrict -Wreturn-local-addr -Wreturn-type
-Wscalar-storage-order -Wsequence-point -Wshadow -Wshift-count-negative
-Wshift
-count-overflow -Wshift-negative-value -Wshift-overflow=2 -Wno-sign-compare
-Wsizeof-array-argument -Wsizeof-pointer-div -Wsizeof-point
er-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wstringop-overflow=2
-Wstringop-truncation -Wsuggest-attribute=cold -Wno-suggest-at
tribute=const -Wsuggest-attribute=format -Wsuggest-attribute=noreturn
-Wno-suggest-attribute=pure -Wsuggest-final-methods -Wsuggest-fin
al-types -Wswitch -Wswitch-bool -Wswitch-enum -Wswitch-unreachable
-Wsync-nand -Wtautological-compare -Wtrampolines -Wtrigraphs -Wtype-
limits -Wuninitialized -Wunknown-pragmas -Wunused
-Wunused-but-set-parameter -Wunused-but-set-variable
-Wunused-const-variable=2 -Wunus
ed-function -Wunused-label -Wunused-local-typedefs -Wunused-parameter
-Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvari
adic-macros -Wvector-operation-performance -Wvla -Wvolatile-register-var
-Wwrite-strings -fstack-protector-strong -Wdouble-promotion -f
PIC -pthread -DIN_LIBVIRT '-Dabs_top_builddir="/Dati/libvirt/build"'
'-Dabs_top_srcdir="/Dati/libvirt"' -MD -MQ src/util/libvirt_util.a
.p/virhostcpu.c.o -MF src/util/libvirt_util.a.p/virhostcpu.c.o.d -o
src/util/libvirt_util.a.p/virhostcpu.c.o -c ../src/util/virhostcpu.
c
../src/util/virhostcpu.c: In function ‘virHostCPUGetKVMMaxVCPUs’:
../src/util/virhostcpu.c:1212:26: error: ‘KVM_CHECK_EXTENSION’ undeclared
(first use in this function); did you mean ‘G_GNUC_EXTENSION’
?
1212 |     if ((ret = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS)) >
0)
     |                          ^~~~~~~~~~~~~~~~~~~
     |                          G_GNUC_EXTENSION
../src/util/virhostcpu.c:1212:26: note: each undeclared identifier is
reported only once for each function it appears in
../src/util/virhostcpu.c:1212:47: error: ‘KVM_CAP_NR_VCPUS’ undeclared
(first use in this function)
1212 |     if ((ret = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS)) >
0)
     |                                               ^~~~~~~~~~~~~~~~
[66/1485] Compiling C object src/util/libvirt_util.a.p/virhostmem.c.o
ninja: build stopped: subcommand failed.

On Wed, Aug 30, 2023 at 5:02 PM Mario Marietto <marietto2...@gmail.com>
wrote:

> So. ok. If I understood correctly : In my system the file kvm.h is
> missing. I should install the kernel headers file if I want it. I could do
> this if the kernel in use was 6.1,but I'm forced to use 5.4. I can't
> install the kernel headers for the kernel 5.4 on top of debian bookworm. Or
> at least,at the moment I don't know how to do this. I'm not sure that the
> kernel headers for the 5.4 kernel are present between the packages. Or
> maybe I can build it from scratch or I can find it somewhere ? Even in this
> case, I'm not sure that they will work on a system that has been compiled
> on top of a 6.x kernel. I think that I should re-compile libvirt and QEMU
> on top of the 5.4 kernel and for this reason I should use an older version
> of Debian,maybe 8 or 9. Maybe later,I can upgrade the userland from 8/9 to
> 12,keeping intact the same kernel. What do you think ? Do you see a shorter
> solution ? for sure I don't like to reinstall and recompile everything on
> an older version of Linux.
>
> On Wed, Aug 30, 2023 at 11:19 AM Mario Marietto <marietto2...@gmail.com>
> wrote:
>
>> ok. I've copied this file :
>>
>> /home/marietto/Desktop/Dati/virt/qemu-v5.1.0/linux-headers/linux/kvm.h
>>
>> to this directory :
>>
>> /usr/include/linux
>>
>> the previous error is gone,but it still doesn't work :
>>
>> # virsh domcapabilities --machine virt --emulatorbin
>> /usr/local/bin/qemu-system-arm
>> error: failed to get emulator capabilities
>> error: KVM is not supported on this platform: Function not implemented
>>
>>
>> this time there isn't any specific error :(
>>
>> On Wed, Aug 30, 2023 at 11:11 AM Mario Marietto <marietto2...@gmail.com>
>> wrote:
>>
>>> Ok. thanks. Yes,I'm obliged to use a kernel minor than 5.7 and I've
>>> chosen 5.4. These are the places where I've found the kvm.h file that I
>>> need.
>>>
>>> /home/marietto/Desktop/Dati/virt/qemu-v5.1.0/include/sysemu/kvm.h
>>> /home/marietto/Desktop/Dati/virt/qemu-v5.1.0/linux-headers/asm-arm/kvm.h
>>> /home/marietto/Desktop/Dati/virt/qemu-v5.1.0/linux-headers/linux/kvm.h
>>>
>>> /home/marietto/Desktop/Dati/200/Si/linux-5.4.244/tools/include/uapi/linux/kvm.h
>>>
>>> /home/marietto/Desktop/Dati/200/Si/linux-5.4.244/tools/arch/arm/include/uapi/asm/kvm.h
>>>
>>> /home/marietto/Desktop/Dati/200/Si/linux-5.4.244/include/uapi/linux/kvm.h
>>>
>>> /home/marietto/Desktop/Dati/200/Si/linux-5.4.244/include/config/kvm.h
>>> /home/marietto/Desktop/Dati/200/Si/linux-5.4.244/include/trace/events/kvm.h
>>>
>>> /home/marietto/Desktop/Dati/200/Si/linux-5.4.244/arch/arm/include/uapi/asm/kvm.h
>>>
>>>
>>> Basically it seems that I can get it from the qemu 5.1 or from the
>>> kernel 5.4 source code files. Can you tell me what's the correct one ? You
>>> talked about linux-headers,so it might be this :
>>>
>>> /home/marietto/Desktop/Dati/virt/qemu-v5.1.0/linux-headers/linux/kvm.h
>>>
>>> ?
>>>
>>> where should I copy it ? to /usr/include/linux is the right place ?
>>>
>>> thanks.
>>>
>>>
>>>
>>> On Wed, Aug 30, 2023 at 9:46 AM Daniel P. Berrangé <berra...@redhat.com>
>>> wrote:
>>>
>>>> On Tue, Aug 29, 2023 at 09:22:35PM +0200, Mario Marietto wrote:
>>>> > Hello.
>>>> >
>>>> > I'm running Debian bookworm on my ARM Chromebook,model "xe303c12" and
>>>> > I've recompiled the kernel (5.4) to enable KVM,so now my system
>>>> sounds like
>>>> > this :
>>>>
>>>> That's surely not the default kernel that comes with Debian bookworm,
>>>> as that 5.4 version is many years old.
>>>>
>>>> IIUC the standard bookworm kernel will be 6.4
>>>>
>>>> > root@chromarietto:~#  virsh domcapabilities --machine virt
>>>> > --emulatorbin /usr/local/bin/qemu-system-arm
>>>> >
>>>> > 2023-08-29 10:17:59.110+0000: 1763: error :
>>>> virHostCPUGetKVMMaxVCPUs:1228 :
>>>> > KVM is not supported on this platform: Function not implemented ;
>>>> > error: failed to get emulator capabilities
>>>> > error: KVM is not supported on this platform: Function not implemented
>>>>
>>>> This shows libvirt was built against a kernel that lacks the
>>>> kvm.h header file.
>>>>
>>>> This is expected for armv7 as support for KVM on 32-bit arm was
>>>> deleted in the 5.7 kernel. I expect libvirt was built against
>>>> the kernel headers from Debian's default 6.4 kernel and thus
>>>> lacks KVM support.
>>>>
>>>> Your booting of the old 5.4 kernel doesn't solve this - you
>>>> would actually need to build libvirt (and QEMU) against this
>>>> outdated kernel too.
>>>>
>>>>
>>>> With regards,
>>>> Daniel
>>>> --
>>>> |: https://berrange.com      -o-
>>>> https://www.flickr.com/photos/dberrange :|
>>>> |: https://libvirt.org         -o-
>>>> https://fstop138.berrange.com :|
>>>> |: https://entangle-photo.org    -o-
>>>> https://www.instagram.com/dberrange :|
>>>>
>>>>
>>>
>>> --
>>> Mario.
>>>
>>
>>
>> --
>> Mario.
>>
>
>
> --
> Mario.
>


-- 
Mario.

Reply via email to