* Win32 and ACCEL macro/function
@ 2021-08-06 3:00 Eduardo Habkost
2021-08-06 9:11 ` Daniel P. Berrangé
0 siblings, 1 reply; 2+ messages in thread
From: Eduardo Habkost @ 2021-08-06 3:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Weil, Daniel P. Berrange, Paolo Bonzini
Hello,
I'm looking for help dealing with a naming conflict when building
QEMU for Windows hosts.
The summary is: I'm trying to replace the ACCEL() macro in
include/qemu/accel.h with an inline function, but the ACCEL name
conflicts with a symbol provided by winuser.h:
In file included from /builds/ehabkost/qemu/include/exec/memory.h:28,
from /builds/ehabkost/qemu/hw/ppc/mac.h:30,
from ../hw/pci-host/uninorth.c:27:
/builds/ehabkost/qemu/include/qemu/accel.h:63:45: error: 'ACCEL' redeclared as different kind of symbol
63 | OBJECT_DECLARE_TYPE(AccelState, AccelClass, ACCEL)
| ^~~~~
/builds/ehabkost/qemu/include/qom/object.h:178:5: note: in definition of macro 'DECLARE_INSTANCE_CHECKER'
178 | OBJ_NAME(const void *obj) \
| ^~~~~~~~
/builds/ehabkost/qemu/include/qom/object.h:240:5: note: in expansion of macro 'DECLARE_OBJ_CHECKERS'
240 | DECLARE_OBJ_CHECKERS(InstanceType, ClassType, \
| ^~~~~~~~~~~~~~~~~~~~
/builds/ehabkost/qemu/include/qemu/accel.h:63:1: note: in expansion of macro 'OBJECT_DECLARE_TYPE'
63 | OBJECT_DECLARE_TYPE(AccelState, AccelClass, ACCEL)
| ^~~~~~~~~~~~~~~~~~~
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/windows.h:72,
from /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
from /builds/ehabkost/qemu/include/sysemu/os-win32.h:29,
from /builds/ehabkost/qemu/include/qemu/osdep.h:135,
from ../hw/pci-host/uninorth.c:25:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/winuser.h:1757:5: note: previous declaration of 'ACCEL' was here
1757 | } ACCEL,*LPACCEL;
| ^~~~~
[338/4278] Compiling C object libqemuutil.a.p/meson-generated_.._trace_trace-scsi.c.obj
ninja: build stopped: subcommand failed.
make: *** [Makefile:156: run-ninja] Error 1
(Full log at https://gitlab.com/ehabkost/qemu/-/jobs/1481978645)
Does anybody more experienced with Win32 have a suggestion on how
to deal with this? Do we really need to include winsock2.h /
windows.h / winuser.h from qemu/osdep.h?
--
Eduardo
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Win32 and ACCEL macro/function
2021-08-06 3:00 Win32 and ACCEL macro/function Eduardo Habkost
@ 2021-08-06 9:11 ` Daniel P. Berrangé
0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2021-08-06 9:11 UTC (permalink / raw)
To: Eduardo Habkost; +Cc: Stefan Weil, qemu-devel, Paolo Bonzini
On Thu, Aug 05, 2021 at 11:00:24PM -0400, Eduardo Habkost wrote:
> Hello,
>
> I'm looking for help dealing with a naming conflict when building
> QEMU for Windows hosts.
>
> The summary is: I'm trying to replace the ACCEL() macro in
> include/qemu/accel.h with an inline function, but the ACCEL name
> conflicts with a symbol provided by winuser.h:
>
> In file included from /builds/ehabkost/qemu/include/exec/memory.h:28,
> from /builds/ehabkost/qemu/hw/ppc/mac.h:30,
> from ../hw/pci-host/uninorth.c:27:
> /builds/ehabkost/qemu/include/qemu/accel.h:63:45: error: 'ACCEL' redeclared as different kind of symbol
> 63 | OBJECT_DECLARE_TYPE(AccelState, AccelClass, ACCEL)
> | ^~~~~
> /builds/ehabkost/qemu/include/qom/object.h:178:5: note: in definition of macro 'DECLARE_INSTANCE_CHECKER'
> 178 | OBJ_NAME(const void *obj) \
> | ^~~~~~~~
> /builds/ehabkost/qemu/include/qom/object.h:240:5: note: in expansion of macro 'DECLARE_OBJ_CHECKERS'
> 240 | DECLARE_OBJ_CHECKERS(InstanceType, ClassType, \
> | ^~~~~~~~~~~~~~~~~~~~
> /builds/ehabkost/qemu/include/qemu/accel.h:63:1: note: in expansion of macro 'OBJECT_DECLARE_TYPE'
> 63 | OBJECT_DECLARE_TYPE(AccelState, AccelClass, ACCEL)
> | ^~~~~~~~~~~~~~~~~~~
> In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/windows.h:72,
> from /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
> from /builds/ehabkost/qemu/include/sysemu/os-win32.h:29,
> from /builds/ehabkost/qemu/include/qemu/osdep.h:135,
> from ../hw/pci-host/uninorth.c:25:
> /usr/x86_64-w64-mingw32/sys-root/mingw/include/winuser.h:1757:5: note: previous declaration of 'ACCEL' was here
> 1757 | } ACCEL,*LPACCEL;
> | ^~~~~
> [338/4278] Compiling C object libqemuutil.a.p/meson-generated_.._trace_trace-scsi.c.obj
> ninja: build stopped: subcommand failed.
> make: *** [Makefile:156: run-ninja] Error 1
>
> (Full log at https://gitlab.com/ehabkost/qemu/-/jobs/1481978645)
>
> Does anybody more experienced with Win32 have a suggestion on how
> to deal with this? Do we really need to include winsock2.h /
> windows.h / winuser.h from qemu/osdep.h?
Yep, they're the equivalent of the standard posix headers we would
need on non-Linux.
Windows header files are well known for having many annoyingly common
names used in macros/symbols, so you pretty much just have to rename
whatever is in your app that clashes.
I'd suggest we use CPUACCEL / CpuAccel or something like that in
QEMU.
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 :|
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-06 9:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 3:00 Win32 and ACCEL macro/function Eduardo Habkost
2021-08-06 9:11 ` Daniel P. Berrangé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.