qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/2] qga-win: add logging to Windows event log


From: Andrey Drobyshev
Subject: Re: [PATCH v2 1/2] qga-win: add logging to Windows event log
Date: Thu, 26 Jan 2023 19:50:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

On 1/23/23 22:52, Stefan Weil wrote:
> Am 23.01.23 um 20:38 schrieb Andrey Drobyshev:
> 
>> Hi Stefan,
>>
>> On 1/23/23 19:28, Stefan Weil wrote:
>>> Hi,
>>>
>>> cross builds fail with this code. Please see details below.
>>>
>>> Am 29.11.22 um 18:38 schrieb Andrey Drobyshev via:
>>>> This commit allows QGA to write to Windows event log using Win32 API's
>>>> ReportEvent() [1], much like syslog() under *nix guests.
>>>>
>>>> In order to generate log message definitions we use a very basic
>>>> message
>>>> text file [2], so that every QGA's message gets ID 1.  The tools
>>>> "windmc" and "windres" respectively are used to generate ".rc" file and
>>>> COFF object file, and then the COFF file is linked into qemu-ga.exe.
>>>>
>>>> [1]
>>>> https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-reporteventa
>>>> [2]
>>>> https://learn.microsoft.com/en-us/windows/win32/eventlog/message-text-files
>>>>
>>>> Originally-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
>>>> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
>>>> ---
>>>>    configure                 |  3 +++
>>>>    qga/installer/qemu-ga.wxs |  5 +++++
>>>>    qga/main.c                | 16 +++++++++++++---
>>>>    qga/meson.build           | 19 ++++++++++++++++++-
>>>>    qga/messages-win32.mc     |  9 +++++++++
>>>>    5 files changed, 48 insertions(+), 4 deletions(-)
>>>>    create mode 100644 qga/messages-win32.mc
>>>>
>>>> diff --git a/configure b/configure
>>>> index 26c7bc5154..789a4f6cc9 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -372,6 +372,7 @@ smbd="$SMBD"
>>>>    strip="${STRIP-${cross_prefix}strip}"
>>>>    widl="${WIDL-${cross_prefix}widl}"
>>>>    windres="${WINDRES-${cross_prefix}windres}"
>>>> +windmc="${WINDMC-${cross_prefix}windmc}"
>>> Here the needed cross prefix is added ...
>>>
>>>>    pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
>>>>    query_pkg_config() {
>>>>        "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
>>> [...]
>>>> diff --git a/qga/meson.build b/qga/meson.build
>>>> index 3cfb9166e5..1ff159edc1 100644
>>>> --- a/qga/meson.build
>>>> +++ b/qga/meson.build
>>>> @@ -98,7 +98,24 @@ if targetos == 'windows'
>>>>      endif
>>>>    endif
>>>>    -qga = executable('qemu-ga', qga_ss.sources(),
>>>> +qga_objs = []
>>>> +if targetos == 'windows'
>>>> +  windmc = find_program('windmc', required: true)
>>> ... but here the cross prefix is missing and the cross build aborts
>>> because windmc does not exist.
>> There's no need for the cross prefix here.  After you've run ./configure
>> with --cross-prefix, argument, you'll see the following in
>> build/config-meson.cross file:
>>
>> [binaries]
>> ....
>> widl = ['x86_64-w64-mingw32-widl']
>> windres = ['x86_64-w64-mingw32-windres']
>> windmc = ['x86_64-w64-mingw32-windmc']
>>
>> And these are the actual values meson's find_program() is going to be
>> looking for.  So it doesn't seem like there's anything broken here, it's
>> a matter of build requirements.
> 
> 
> My configure terminates with an error because of the missing windmc
> before it has written config-meson.cross. I have run an incremental build:
> 
> Program windmc found: NO
> 
> ../../../qga/meson.build:103:2: ERROR: Program 'windmc' not found or not
> executable
> 
> A full log can be found at
> /qemu/bin/debug/x86_64-w64-mingw32/meson-logs/meson-log.txt
> ninja: error: rebuilding 'build.ninja': subcommand failed
> FAILED: build.ninja
> /usr/bin/python3 /qemu/meson/meson.py --internal regenerate /qemu
> /home/stefan/src/gitlab/qemu-project/qemu/bin/debug/x86_64-w64-mingw32
> --backend ninja
> make: *** [Makefile:165: run-ninja] Fehler 1
> make: Verzeichnis „/qemu/bin/debug/x86_64-w64-mingw32“ wird verlassen
> 
> A clean fresh build works indeed fine.
> 

I don't think the issue is caused by this particular patch.
Here's what's happening:

Makefile:72
> # force a rerun of configure if config-host.mak is too old or corrupted       
>   
> ifeq ($(MESON),)                                                              
>   
> .PHONY: config-host.mak                                                       
>   
> x := $(shell rm -rf meson-private meson-info meson-logs)                      
>                                                                               
>    
> endif


Makefile:92
> # 1. ensure config-host.mak is up-to-date                                     
>                                                                               
>    
> config-host.mak: $(SRC_PATH)/configure 
> $(SRC_PATH)/scripts/meson-buildoptions.sh $(SRC_PATH)/VERSION
>     @echo config-host.mak is out-of-date, running configure                   
>   
>     @if test -f meson-private/coredata.dat; then \                            
>   
>       ./config.status --skip-meson; \                                         
>   
>     else \                                                                    
>   
>       ./config.status && touch build.ninja.stamp; \                           
>   
>     fi

configure:2529
> if test "$skip_meson" = no; then
> ...
>   echo "widl = [$(meson_quote $widl)]" >> $cross                              
>   
>   echo "windres = [$(meson_quote $windres)]" >> $cross                        
>   
>   echo "windmc = [$(meson_quote $windmc)]" >> $cross

Now if you checkout a revision which doesn't have this patch, perform a
build, then checkout to a revision which has this patch and try to
perform a build again, ./configure will be called with --skip-meson and
config-meson.cross won't be regenerated.

I'm not sure how we could detect a necessity to regenerate
config-meson.cross in this case.  Your suggestions are welcome, if any.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]