Skip to contentSkip to conversation

kvm-87 fails to compile under uClibc

DISCUSSION Cristi Magherusan 6 participants 18 messages Jul 7, 2009 – Jul 9, 2009 KVM

lore
Share & tools
lore
#0 lore raw

Hi there,

I'm trying to compile kvm using uClibc instead of glibc.

Besides the fact that kvm needs "--extra-ldflags=-lrt" (otherwise there are some missing symbols), there's an error caused by another missing symbol that I was unable to fix yet. It's about ioperm, and this is the error I get:

/home/cristi/devel/avatt/buildroot/build_i586/staging_dir/usr/bin/i586-linux-uclibc-gcc -lrt -g -Wl,--warn-common -m32 -o qemu-system-x86_64 vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o gdbstub.o gdbstub-xml.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o usb-ohci.o eepro100.o ne2000.o pcnet.o rtl8139.o e1000.o wdt_ib700.o wdt_i6300esb.o ide.o pckbd.o vga.o sb16.o es1370.o ac97.o dma.o fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o device-hotplug.o pci-hotplug.o smbios.o extboot.o i8254-kvm.o -Wl,--whole-archive ../libqemu_common.a libqemu.a ../libhw64/libqemuhw64.a -Wl,--no-whole-archive -lm -lz -lpthread -lutil -lcurses
libqemu.a(qemu-kvm-x86.o): In function `kvm_arch_do_ioperm':
/home/cristi/devel/avatt/buildroot/build_i586/kvm-87/qemu-kvm-x86.c:1538: undefined reference to `ioperm'
collect2: ld returned 1 exit status
make[3]: *** [qemu-system-x86_64] Error 1
make[3]: Leaving directory `/home/cristi/devel/avatt/buildroot/build_i586/kvm-87/x86_64-softmmu'

I'm using linux-2.6.26.8, uClibc-HEAD(linuxthreds, almost complete setup) and gcc 4.3.3.

Also, is this kernel version supposed to work with this kvm?

Thanks,
Cristi

Signature · 3 lines
Ing. Cristi Măgherușan, System/Network Engineer
Technical University of Cluj-Napoca, Romania
http://cc.utcluj.ro  +40264 401247

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

#1 lore raw
Quoted 2 lines · On Monday 06 July 2009 22:42:46 Cristi Magherusan wrote:

/home/cristi/devel/avatt/buildroot/build_i586/kvm-87/qemu-kvm-x86.c:1538:
undefined reference to `ioperm'

ioperm is enabled only if your kernel headers declare __NR_ioperm. if it isnt enabled in your C library, check your headers.
-mike

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

#2 lore raw
Quoted 6 lines · Mike Frysinger
Quoted 2 lines · On Monday 06 July 2009 22:42:46 Cristi Magherusan wrote:

/home/cristi/devel/avatt/buildroot/build_i586/kvm-87/qemu-kvm-x86.c:1538:
undefined reference to `ioperm'

ioperm is enabled only if your kernel headers declare __NR_ioperm. if it isnt enabled in your C library, check your headers.

and it's only enabled if UCLIBC_LINUX_SPECIFIC since it is that, in no standard but linux specific (_and_ you need an MMU for it).

#3 lore raw
Quoted 10 lines · Bernhard Reutner-Fischer
Quoted 6 lines · Mike Frysinger
Quoted 2 lines · On Monday 06 July 2009 22:42:46 Cristi Magherusan wrote:

/home/cristi/devel/avatt/buildroot/build_i586/kvm-87/qemu-kvm-x86.c:1538:
undefined reference to `ioperm'

ioperm is enabled only if your kernel headers declare __NR_ioperm. if it isnt enabled in your C library, check your headers.

and it's only enabled if UCLIBC_LINUX_SPECIFIC since it is that, in no standard but linux specific (_and_ you need an MMU for it).

I had UCLIBC_LINUX_SPECIFIC enabled. There must be anything else that I'm missing..

Signature · 3 lines
Ing. Cristi Măgherușan, System/Network Engineer
Technical University of Cluj-Napoca, Romania
http://cc.utcluj.ro  +40264 401247
#4 lore raw
In reply to Bernhard Reutner-Fischer
Quoted 10 lines · On Tuesday 07 July 2009 03:34:57 Bernhard Reutner-Fischer wrote:
Quoted 6 lines · Mike Frysinger
Quoted 2 lines · On Monday 06 July 2009 22:42:46 Cristi Magherusan wrote:

/home/cristi/devel/avatt/buildroot/build_i586/kvm-87/qemu-kvm-x86.c:1538 : undefined reference to `ioperm'

ioperm is enabled only if your kernel headers declare __NR_ioperm. if it isnt enabled in your C library, check your headers.

and it's only enabled if UCLIBC_LINUX_SPECIFIC since it is that, in no standard but linux specific (_and_ you need an MMU for it).

i missed that in the .c file. we should probably have stub handling for all these BSD/Linux/GNU/etc... options such that if you disable the feature and have STUBS support turned on, you get a link warning about it. -mike

#5 lore raw
In reply to Cristi Magherusan
Quoted 10 lines · Cristi Magherusan

Hi there,

I'm trying to compile kvm using uClibc instead of glibc.

Besides the fact that kvm needs "--extra-ldflags=-lrt" (otherwise there are some missing symbols), there's an error caused by another missing symbol that I was unable to fix yet. It's about ioperm, and this is the error I get:

Well, you need a C library that supports ioperm, or provide it yourself. If you don't use device assignment an empty function will suffice.

Quoted 5 lines

I'm using linux-2.6.26.8, uClibc-HEAD(linuxthreds, almost complete setup) and gcc 4.3.3.

Also, is this kernel version supposed to work with this kvm?

Yes.

Signature · 1 line
error compiling committee.c: too many arguments to function
#6 lore raw
Quoted 12 lines · Avi Kivity
Quoted 10 lines · Cristi Magherusan

Hi there,

I'm trying to compile kvm using uClibc instead of glibc.

Besides the fact that kvm needs "--extra-ldflags=-lrt" (otherwise there are some missing symbols), there's an error caused by another missing symbol that I was unable to fix yet. It's about ioperm, and this is the error I get:

Quoted 3 lines

Well, you need a C library that supports ioperm, or provide it yourself. If you don't use device assignment an empty function will suffice.

Thanks,

I'll try to get it compiled, and as a fallback I could make a stub if everything else fails.

Quoted 7 lines
Quoted 5 lines

I'm using linux-2.6.26.8, uClibc-HEAD(linuxthreds, almost complete setup) and gcc 4.3.3.

Also, is this kernel version supposed to work with this kvm?

Yes.

Actually only the headers are 2.6.26.8, the oldest vesion found in buildroot. (I wonder why are older ones being abandoned, since the new ones tend to get bigger and bigger.)

The kernel will be 2.6.24 because it's smaller. I know this mismatch may not be good, but I have to get to a compromise. The kernel needs to be as small as possible (everything should fit in a 4MB BIOS flash), and also to support both this version of KVM and OpenVZ at the same time. Older KVM versions have terrible buildsystem issues and I gave up trying to get them compile in buildroot. I think OpenVZ could work on 2.6.26 too, but I haven't tried yet.

Could this be a real problem at runtime?

Thanks,
Cristi.

Signature · 3 lines
Ing. Cristi Măgherușan, System/Network Engineer
Technical University of Cluj-Napoca, Romania
http://cc.utcluj.ro  +40264 401247
#7 lore raw
Quoted 10 lines · Cristi Magherusan

The kernel will be 2.6.24 because it's smaller. I know this mismatch may not be good, but I have to get to a compromise. The kernel needs to be as small as possible (everything should fit in a 4MB BIOS flash), and also to support both this version of KVM and OpenVZ at the same time. Older KVM versions have terrible buildsystem issues and I gave up trying to get them compile in buildroot. I think OpenVZ could work on 2.6.26 too, but I haven't tried yet.

Could this be a real problem at runtime?

I think 2.6.24 is too old for current qemu-kvm. Also it doesn't receive security fixes; if you don't trust your users you should use 2.6.27.y or 2.6.30.y (or a vendor kernel).

You can reduce qemu size by not compiling tcg; that'll save you a lot more than the kernel.

Signature · 1 line
error compiling committee.c: too many arguments to function
#8 lore raw
Quoted 10 lines · Avi Kivity
Quoted 4 lines · Cristi Magherusan

The kernel will be 2.6.24 because it's smaller. I know this mismatch may not be good, but I have to get to a compromise. The kernel needs to be as small as possible (everything should fit in a 4MB BIOS flash), and also to support both this version of KVM and OpenVZ at the same

time.

Quoted 4 lines

Older KVM versions have terrible buildsystem issues and I gave up trying to get them compile in buildroot. I think OpenVZ could work on 2.6.26 too, but I haven't tried yet.

Quoted 6 lines
Quoted 2 lines

Could this be a real problem at runtime?

I think 2.6.24 is too old for current qemu-kvm. Also it doesn't receive security fixes; if you don't trust your users you should use 2.6.27.y or 2.6.30.y (or a vendor kernel).

Hi Avi,
Thanks for this advice, I'll switch to 2.6, whch should be ok since it's also supported by OpenVZ.

Quoted 2 lines

You can reduce qemu size by not compiling tcg; that'll save you a lot more than the kernel.

How do I disable it? is it the --disable-cpu-emulation configure flag? Unfortunately that one breaks compilation, and I reproduced this both in my system and inside the buildroot toolchain that I'm using.

Signature · 3 lines
Ing. Cristi Măgherușan, System/Network Engineer
Technical University of Cluj-Napoca, Romania
http://cc.utcluj.ro  +40264 401247
#9 lore raw
Quoted 7 lines · Cristi Magherusan
Quoted 3 lines

You can reduce qemu size by not compiling tcg; that'll save you a lot more than the kernel.

How do I disable it? is it the --disable-cpu-emulation configure flag? Unfortunately that one breaks compilation, and I reproduced this both in my system and inside the buildroot toolchain that I'm using.

It doesn't work now but I certainly want it to. If you can come up with a simple patch I'll apply it.

$ size x86_64-softmmu/tcg/*.o x86_64-softmmu/fpu/*.o x86_64-softmmu/translate*.o x86_64-softmmu/helper.o
   text       data        bss        dec        hex    filename
  79296       2880         24      82200      14118    
x86_64-softmmu/tcg/tcg.o
    316          0          0        316        13c    
x86_64-softmmu/tcg/tcg-runtime.o
   3575          0          0       3575        df7    
x86_64-softmmu/fpu/softfloat-native.o
    723          0          8        731        2db    
x86_64-softmmu/translate-all.o
 367810          0         88     367898      59d1a    
x86_64-softmmu/translate.o
  15553       1232         16      16801       41a1    
x86_64-softmmu/helper.o

There's almost half a meg here.

Signature · 1 line
error compiling committee.c: too many arguments to function
#10 lore raw
Quoted 28 lines · Avi Kivity
Quoted 7 lines · Cristi Magherusan
Quoted 3 lines

You can reduce qemu size by not compiling tcg; that'll save you a lot more than the kernel.

How do I disable it? is it the --disable-cpu-emulation configure flag? Unfortunately that one breaks compilation, and I reproduced this both in my system and inside the buildroot toolchain that I'm using.

It doesn't work now but I certainly want it to. If you can come up with a simple patch I'll apply it.

$ size x86_64-softmmu/tcg/*.o x86_64-softmmu/fpu/*.o 
x86_64-softmmu/translate*.o x86_64-softmmu/helper.o
    text       data        bss        dec        hex    filename
   79296       2880         24      82200      14118    
x86_64-softmmu/tcg/tcg.o
     316          0          0        316        13c    
x86_64-softmmu/tcg/tcg-runtime.o
    3575          0          0       3575        df7    
x86_64-softmmu/fpu/softfloat-native.o
     723          0          8        731        2db    
x86_64-softmmu/translate-all.o
  367810          0         88     367898      59d1a    
x86_64-softmmu/translate.o
   15553       1232         16      16801       41a1    
x86_64-softmmu/helper.o
Quoted 2 lines

There's almost half a meg here.

Thanks, Actually I think that stripped and LZMA'd it should make a little less difference. If I get tight and willing to remove cruft I know where I can cut off, and then I'll try to patch it unless someone does it first. I'd appreciate more something that wouldn't compile the kernel modules at all :)

Also, what is extboot used for? Can I ommit it from my build?

Regards,
Cristi

Signature · 3 lines
Ing. Cristi Măgherușan, System/Network Engineer
Technical University of Cluj-Napoca, Romania
http://cc.utcluj.ro  +40264 401247
#11 lore raw
Quoted 1 line · Cristi Magherusan

Also, what is extboot used for?

Booting a guest from virtio and scsi.

Quoted 2 lines

Can I ommit it from my build?

If you like. It's only a handful of bytes though.

Signature · 1 line
error compiling committee.c: too many arguments to function
#12 lore raw
Quoted 9 lines · Avi Kivity
Quoted 1 line · Cristi Magherusan

Also, what is extboot used for?

Booting a guest from virtio and scsi.

Quoted 2 lines

Can I ommit it from my build?

If you like. It's only a handful of bytes though.

Hi Avi,

I asked because its buildsystem is also broken inside my toolchain, since it accesses the host ld directly. Also, compiling with -j>1 inside a toolchain(and not only this) exposes other weirdnesses in the buildsystem. If there's anyone who wishes to reproduce them, just ask for more info and I'll provide it happily, and if time allows I'll try to figure it out by myself at the end of my GSoC project.

Thanks,
Cristi

Signature · 3 lines
Ing. Cristi Măgherușan, System/Network Engineer
Technical University of Cluj-Napoca, Romania
http://cc.utcluj.ro  +40264 401247
#13 lore raw
In reply to Cristi Magherusan
Quoted 5 lines · On Tuesday 07 July 2009 07:31:30 Cristi Magherusan wrote:
Quoted 4 lines · Avi Kivity
Quoted 3 lines · Cristi Magherusan

I'm using linux-2.6.26.8, uClibc-HEAD(linuxthreds, almost complete setup) and gcc 4.3.3.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Also, is this kernel version supposed to work with this kvm?

Yes.

Actually only the headers are 2.6.26.8, the oldest vesion found in buildroot. (I wonder why are older ones being abandoned, since the new ones tend to get bigger and bigger.)

upgrade

Quoted 9 lines

The kernel will be 2.6.24 because it's smaller. I know this mismatch may not be good, but I have to get to a compromise. The kernel needs to be as small as possible (everything should fit in a 4MB BIOS flash), and also to support both this version of KVM and OpenVZ at the same time. Older KVM versions have terrible buildsystem issues and I gave up trying to get them compile in buildroot. I think OpenVZ could work on 2.6.26 too, but I haven't tried yet.

Could this be a real problem at runtime?

with uClibc, yes
-mike

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

#14 lore raw
In reply to Cristi Magherusan
Quoted 3 lines · Cristi Magherusan

The kernel will be 2.6.24 because it's smaller. I know this mismatch may not be good, but I have to get to a compromise. The kernel needs to be as small as possible (everything should fit in a 4MB BIOS flash)

i know it's a big change; but have you tried the new kernel compressions available in 2.6.30? they do make a difference.

Signature · 1 line
Javier
#15 lore raw
Quoted 9 lines · Javier Guerra
Quoted 3 lines · Cristi Magherusan

The kernel will be 2.6.24 because it's smaller. I know this mismatch may not be good, but I have to get to a compromise. The kernel needs to be as small as possible (everything should fit in a 4MB BIOS flash)

i know it's a big change; but have you tried the new kernel compressions available in 2.6.30? they do make a difference.

I know, I'm using plain initrd and plain kernel, then I compress the generated coreboot payload using LZMA. Compressing them twice wouldn't help me.

Cristi

Signature · 3 lines
Ing. Cristi Măgherușan, System/Network Engineer
Technical University of Cluj-Napoca, Romania
http://cc.utcluj.ro  +40264 401247

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

#16 lore raw
In reply to Cristi Magherusan
Quoted 3 lines · Cristi Magherusan

Hi there,

I'm trying to compile kvm using uClibc instead of glibc.

I upgraded to kvm-87 yesterday. It compiles, kvm is enabled, but guest hangs when trying to mount the boot iso. I'm not sure if that I run kvm in a vserver guest, or if its related to my hardened toolchain or something in uclibc (linuxthreads.new?)

You find my build script here:
http://git.alpinelinux.org/cgit/aports/tree/testing/kvm/APKBUILD

-nc

#17 lore raw
Quoted 9 lines · Natanael Copa
Quoted 3 lines · Cristi Magherusan

Hi there,

I'm trying to compile kvm using uClibc instead of glibc.

I upgraded to kvm-87 yesterday. It compiles, kvm is enabled, but guest hangs when trying to mount the boot iso. I'm not sure if that I run kvm in a vserver guest, or if its related to my hardened toolchain or something in uclibc (linuxthreads.new?)

Most likely it can be due to TLS. Could you try to debug it?

Quoted 3 lines

You find my build script here:
http://git.alpinelinux.org/cgit/aports/tree/testing/kvm/APKBUILD

Thanks,
Cristi

Signature · 3 lines
Ing. Cristi Măgherușan, System/Network Engineer
Technical University of Cluj-Napoca, Romania
http://cc.utcluj.ro  +40264 401247