qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: Claudio Fontana <cfontana@suse.de>
Cc: "Bonzini, Paolo" <pbonzini@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [PATCH] build-sys: fix win32 compilation with --target-list=''
Date: Thu, 17 Dec 2020 15:41:50 +0400	[thread overview]
Message-ID: <CAMxuvazEL7f6oXKse0qQWoZvS_n31JEKX5_HLRQ+9LHyMOh6yA@mail.gmail.com> (raw)
In-Reply-To: <5c6d244b-1ed3-f065-88b6-7a007a224cc4@suse.de>

[-- Attachment #1: Type: text/plain, Size: 4057 bytes --]

Hi

On Thu, Dec 17, 2020 at 3:33 PM Claudio Fontana <cfontana@suse.de> wrote:

> On 12/17/20 11:44 AM, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Fixes linking:
> > x86_64-w64-mingw32-gcc  -o tests/test-qapi-util.exe version.rc_version.o
> tests/test-qapi-util.exe.p/test-qapi-util.c.obj -Wl,--allow-shlib-undefined
> -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase -Wl,--warn-common -m64
> -fstack-protector-strong -Wl,--start-group libqemuutil.a -pthread
> -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -lgnutls -lwinmm -lm
> -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -lgthread-2.0 -lglib-2.0
> -lintl -lws2_32 -mconsole -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32
> -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -Wl,--end-group
> >
> /usr/lib/gcc/x86_64-w64-mingw32/10.2.1/../../../../x86_64-w64-mingw32/bin/ld:
> libqemuutil.a(util_oslib-win32.c.obj): in function `qemu_try_set_nonblock':
> > /home/elmarco/src/qemu/buildw/../util/oslib-win32.c:224: undefined
> reference to `qemu_fd_register'
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  util/main-loop-stub.c | 26 ++++++++++++++++++++++++++
> >  util/meson.build      |  2 ++
> >  2 files changed, 28 insertions(+)
> >  create mode 100644 util/main-loop-stub.c
> >
> > diff --git a/util/main-loop-stub.c b/util/main-loop-stub.c
> > new file mode 100644
> > index 0000000000..b3e175ade5
> > --- /dev/null
> > +++ b/util/main-loop-stub.c
> > @@ -0,0 +1,26 @@
> > +/*
> > + * QEMU main loop stub impl
> > + *
> > + * Copyright (c) 2020 Red Hat, Inc.
> > + *
> > + * This library is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU Lesser General Public
> > + * License as published by the Free Software Foundation; either
> > + * version 2.1 of the License, or (at your option) any later version.
> > + *
> > + * This library is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * Lesser General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU Lesser General Public
> > + * License along with this library; if not, see <
> http://www.gnu.org/licenses/>.
> > + *
> > + */
> > +
> > +#include "qemu/osdep.h"
> > +#include "qemu/main-loop.h"
> > +
> > +void qemu_fd_register(int fd)
> > +{
> > +}
> > diff --git a/util/meson.build b/util/meson.build
> > index f359af0d46..462b79a61a 100644
> > --- a/util/meson.build
> > +++ b/util/meson.build
> > @@ -79,4 +79,6 @@ if have_block
> >    util_ss.add(when: 'CONFIG_INOTIFY1', if_true:
> files('filemonitor-inotify.c'),
> >                                          if_false:
> files('filemonitor-stub.c'))
> >    util_ss.add(when: 'CONFIG_LINUX', if_true: files('vfio-helpers.c'))
> > +else
> > +  util_ss.add(files('main-loop-stub.c'))
> >  endif
> >
>
> Is the root cause elsewhere though?
>
> I don't like stubs very much, because often they are introduced as the
> easy way out of a problem instead of doing the necessary refactoring,
> and they end up confusing the hell out of someone trying to understand
> what is actually used where, never mind trying to debug the linker errors.
>
> There is already an bunch of #ifndef _WIN32, #else , ... in
> util/main-loop.c (quite a bunch of them really),
> is that what actually needs reworking, and putting the pieces together in
> the build system in a way that makes sense?
>
>
I am not sure we can improve it so much.

qemu_fd_register() is called from qemu_set_nonblock() and net/slirp.c.

It is necessary for win32 util/main-loop.c.

Eventually, we could move qemu_fd_register() in its own unit, but then we
will probably need more stubs or configure knobs for the main-loop symbols.
I don't think it's worth, but maybe I am missing something and I should try
it.

[-- Attachment #2: Type: text/html, Size: 5133 bytes --]

  reply	other threads:[~2020-12-17 11:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 10:44 [PATCH] build-sys: fix win32 compilation with --target-list='' marcandre.lureau
2020-12-17 11:32 ` Claudio Fontana
2020-12-17 11:41   ` Marc-André Lureau [this message]
2020-12-17 11:46   ` Paolo Bonzini
2020-12-18 13:01     ` Marc-André Lureau
2020-12-18 13:21       ` Paolo Bonzini
2020-12-18 13:33         ` Marc-André Lureau
2020-12-18 13:23       ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMxuvazEL7f6oXKse0qQWoZvS_n31JEKX5_HLRQ+9LHyMOh6yA@mail.gmail.com \
    --to=marcandre.lureau@redhat.com \
    --cc=cfontana@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).