Skip to contentSkip to conversation

Compilation fails when configure with -DDEBUG

Qemu-devel Protti, Duilio J 2 participants 2 messages May 29, 2008 – Jun 2, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

This minor error was found during compilation of kvm-65 and originally submitted to the kvm project:

https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1945129&gro
up_id=180599

KVM maintainers then point me out to this mailing list.

Configuring kvm-65 with

  # ./configure --prefix=/usr/devel --qemu-cflags=-DDEBUG

compilation fails with the following error:

gcc34 -I /root/linux/kvm-65/qemu/../libkvm -DDEBUG -DCONFIG_X86 -Wall -O2

-g -fno-strict-aliasing -m32 -I. -I/root/linux/kvm-65/qemu -MMD -MP

-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE

-I/root/linux/kvm-65/qemu/slirp -c -o smbus_eeprom.o

/root/linux/kvm-65/qemu/hw/smbus_eeprom.c

/root/linux/kvm-65/qemu/hw/smbus_eeprom.c: In function `eeprom_quick_cmd':

/root/linux/kvm-65/qemu/hw/smbus_eeprom.c:40: error: structure has no

member named `addr'

/root/linux/kvm-65/qemu/hw/smbus_eeprom.c: In function `eeprom_send_byte':

/root/linux/kvm-65/qemu/hw/smbus_eeprom.c:48: error: structure has no

member named `addr'

/root/linux/kvm-65/qemu/hw/smbus_eeprom.c: In function

`eeprom_receive_byte':

/root/linux/kvm-65/qemu/hw/smbus_eeprom.c:58: error: structure has no

member named `addr'

/root/linux/kvm-65/qemu/hw/smbus_eeprom.c: In function

`eeprom_write_data':

/root/linux/kvm-65/qemu/hw/smbus_eeprom.c:68: error: structure has no

member named `addr'

make[1]: *** [smbus_eeprom.o] Error 1

make[1]: Leaving directory `/root/linux/kvm-65/qemu'

make: *** [qemu] Error 2

The error comes because structure SMBusDevice does not have a field named

'addr' (probably name has changed since the debugging code was written).

Code conditionally compiled with a DEBUG macro appears in many places in

the Qemu code, but it is not driven by a central --debug option or similar,

so it seems that the configuration used (with -DDEBUG) is a little

odd and a not supported one, so this error will appear only in developer's

systems.

However, may be the code should be changed or else removed to avoid these

useless lines there.

Attached is a simple patch which resolves the issue.

Regards,

Duilio Protti.

qemu/hw/smbus_eeprom.c +4 -4
diff -Nru kvm-65.orig/qemu/hw/smbus_eeprom.c kvm-65/qemu/hw/smbus_eeprom.c
@@ -37,7 +37,7 @@
 static void eeprom_quick_cmd(SMBusDevice *dev, uint8_t read)
 {
 #ifdef DEBUG
-    printf("eeprom_quick_cmd: addr=0x%02x read=%d\n", dev->addr, read);
+    printf("eeprom_quick_cmd: addr=0x%02x read=%d\n", dev->data_buf, read);
 #endif
 }
 
@@ -45,7 +45,7 @@
 {
     SMBusEEPROMDevice *eeprom = (SMBusEEPROMDevice *) dev;
 #ifdef DEBUG
-    printf("eeprom_send_byte: addr=0x%02x val=0x%02x\n", dev->addr, val);
+    printf("eeprom_send_byte: addr=0x%02x val=0x%02x\n", dev->data_buf, val);
 #endif
     eeprom->offset = val;
 }
@@ -55,7 +55,7 @@
     SMBusEEPROMDevice *eeprom = (SMBusEEPROMDevice *) dev;
     uint8_t val = eeprom->data[eeprom->offset++];
 #ifdef DEBUG
-    printf("eeprom_receive_byte: addr=0x%02x val=0x%02x\n", dev->addr, val);
+    printf("eeprom_receive_byte: addr=0x%02x val=0x%02x\n", dev->data_buf, val);
 #endif
     return val;
 }
@@ -65,7 +65,7 @@
     SMBusEEPROMDevice *eeprom = (SMBusEEPROMDevice *) dev;
     int n;
 #ifdef DEBUG
-    printf("eeprom_write_byte: addr=0x%02x cmd=0x%02x val=0x%02x\n", dev->addr,
+    printf("eeprom_write_byte: addr=0x%02x cmd=0x%02x val=0x%02x\n", dev->data_buf,
            cmd, buf[0]);
 #endif
     /* An page write operation is not a valid SMBus command.
#1 lore raw
Quoted 2 lines · Duilio J

The error comes because structure SMBusDevice does not have a field named 'addr' (probably name has changed since the debugging code was written).

It's was replaced with i2c.address I believe. 'data_buf' has a different type.

Signature · 2 lines
Please do not print this email unless absolutely necessary. Spread
environmental awareness.