From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C89EDC433E1 for ; Thu, 27 Aug 2020 20:48:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7E45820737 for ; Thu, 27 Aug 2020 20:48:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KPpeJ2pD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E45820737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBOpF-00083Q-Pd for qemu-devel@archiver.kernel.org; Thu, 27 Aug 2020 16:48:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBOoX-00078Q-Kh for qemu-devel@nongnu.org; Thu, 27 Aug 2020 16:48:05 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:44787 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kBOoV-0002wt-Dw for qemu-devel@nongnu.org; Thu, 27 Aug 2020 16:48:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598561282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FUh78OMIoptE30OPqx8VtJua4F5uWytNM9rP589ULcw=; b=KPpeJ2pDitE8LGSehyiA2XqpQMlcgEhD2JdWQU6w8pxdm8SUnkPLuO9IREtMd5U7uo8T2M +RyoGjwDr2KokQZ+gHtW0GLpMyZtp7aYirFm6jf5RkzQPao3erPhuzTLe3TL02JBh6ns3o jnqfSK6hmTkd4KFOgA7zpaFW9OghvzY= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-333-o6XgD0WiP9-KxLCed5gT8A-1; Thu, 27 Aug 2020 16:47:59 -0400 X-MC-Unique: o6XgD0WiP9-KxLCed5gT8A-1 Received: by mail-ej1-f71.google.com with SMTP id g20so3137612ejd.8 for ; Thu, 27 Aug 2020 13:47:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FUh78OMIoptE30OPqx8VtJua4F5uWytNM9rP589ULcw=; b=efHJWLYGStwYQKr/+IBv5J1W2QMc7siWfYI26aq14OMPQw2SlQ3I6CnqdBt4TYatxP 5hSQfbuJZ7s5pBdFxTsu7GbeNa92oWXM0eK09qx+PuURsawVlN4677/Wy27fn9C1D0/v 0IcdacrBwu/ox1I3zkyM45T49RBnzu6h8CGBUjJas1xIDAynHDn5jQ+1Q7OEH5++n68w 0/CkX1oBW9Z3sIZi8nnVU4wXqa66vh6tnNU6KG10+KRJDpSKwreBkoKfqWqf/rYTqTMw iXtXYcWU0Q4IH+QP+KXbxu9zWr+Kpiaa957BzjE5dRE0fk5fgyOY7bWrBRFgW+DrIrYS mUIA== X-Gm-Message-State: AOAM530i0Wy5wO5OvbwJrrMaH9PEpomN2qAg7t71t4WiAj2k1JiH2IiO MYyt96gvRAVIEeKKEgOcYmTdOzfgV/CAtyNG0xirei+indaTo+9n3PNM0b2Ni94jMOMn4eXT/Ud hL4X8/NMKZgJvA2mfr7qepeOG/V69h0o= X-Received: by 2002:a17:906:328d:: with SMTP id 13mr23600875ejw.71.1598561278401; Thu, 27 Aug 2020 13:47:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw94xT7zGkZML7L7LbdmIdlqvkpnMqZO5fPhkKXxjLw4XS/sUFbBUAgj38iYM3byNFUO6kx3m1V2o5UVAY42cc= X-Received: by 2002:a17:906:328d:: with SMTP id 13mr23600865ejw.71.1598561278223; Thu, 27 Aug 2020 13:47:58 -0700 (PDT) MIME-Version: 1.0 References: <20200826190245.22810-1-pbonzini@redhat.com> In-Reply-To: From: Paolo Bonzini Date: Thu, 27 Aug 2020 22:47:47 +0200 Message-ID: Subject: Re: [PATCH v2] configure: add --ninja option To: Mark Cave-Ayland Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="00000000000023ef8d05ade20df3" Received-SPF: pass client-ip=207.211.31.120; envelope-from=pbonzini@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/27 02:56:52 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --00000000000023ef8d05ade20df3 Content-Type: text/plain; charset="UTF-8" Thanks, that might be worth fixing in Meson. Paolo Il gio 27 ago 2020, 17:57 Mark Cave-Ayland ha scritto: > On 26/08/2020 20:02, Paolo Bonzini wrote: > > > On Windows it is not possible to invoke a Python script as $NINJA. > > If ninja is present use it directly, while if it is not we can > > keep using ninjatool. > > > > Reported-by: Mark Cave-Ayland > > Signed-off-by: Paolo Bonzini > > --- > > configure | 16 +++++++++++++++- > > 1 file changed, 15 insertions(+), 1 deletion(-) > > > > diff --git a/configure b/configure > > index 9db9bb89b9..6ecaff429b 100755 > > --- a/configure > > +++ b/configure > > @@ -568,6 +568,7 @@ rng_none="no" > > secret_keyring="" > > libdaxctl="" > > meson="" > > +ninja="" > > skip_meson=no > > gettext="" > > > > @@ -1052,6 +1053,8 @@ for opt do > > ;; > > --meson=*) meson="$optarg" > > ;; > > + --ninja=*) ninja="$optarg" > > + ;; > > --smbd=*) smbd="$optarg" > > ;; > > --extra-cflags=*) > > @@ -1820,6 +1823,7 @@ Advanced options (experts only): > > --python=PYTHON use specified python [$python] > > --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] > > --meson=MESON use specified meson [$meson] > > + --ninja=NINJA use specified ninja [$ninja] > > --smbd=SMBD use specified smbd [$smbd] > > --with-git=GIT use specified git [$git] > > --static enable static build [$static] > > @@ -2058,6 +2062,16 @@ case "$meson" in > > *) meson=$(command -v meson) ;; > > esac > > > > +# Probe for ninja (used for compdb) > > + > > +if test -z "$ninja"; then > > + for c in ninja ninja-build samu; do > > + if has $c; then > > + ninja=$(command -v "$c") > > + break > > + fi > > + done > > +fi > > > > # Check that the C compiler works. Doing this here before testing > > # the host CPU ensures that we had a valid CC to autodetect the > > @@ -8197,7 +8211,7 @@ fi > > mv $cross config-meson.cross > > > > rm -rf meson-private meson-info meson-logs > > -NINJA=$PWD/ninjatool $meson setup \ > > +NINJA=${ninja:-$PWD/ninjatool} $meson setup \ > > --prefix "${pre_prefix}$prefix" \ > > --libdir "${pre_prefix}$libdir" \ > > --libexecdir "${pre_prefix}$libexecdir" \ > > I've just tested this, but it gives me a python stacktrace if I run it > without > passing a --ninja argument to configure. With a bit of extra debugging > added to see > what is being generated: > > ###XXX ['C:/msys64/mingw64/bin/ninja', '--version'] > Traceback (most recent call last): > File "C:/msys64/home/Mark/qemu/meson/mesonbuild/mesonmain.py", line 131, > in run > return options.run_func(options) > File "C:/msys64/home/Mark/qemu/meson/mesonbuild/msetup.py", line 245, in > run > app.generate() > File "C:/msys64/home/Mark/qemu/meson/mesonbuild/msetup.py", line 159, in > generate > self._generate(env) > File "C:/msys64/home/Mark/qemu/meson/mesonbuild/msetup.py", line 215, in > _generate > intr.backend.generate() > File > "C:/msys64/home/Mark/qemu/meson/mesonbuild/backend/ninjabackend.py", line > 483, > in generate > ninja = environment.detect_ninja_command_and_version(log=True) > File "C:/msys64/home/Mark/qemu/meson/mesonbuild/environment.py", line > 177, in > detect_ninja_command_and_version > name = os.path.basename(n) > File "C:/msys64/mingw64/lib/python3.8/ntpath.py", line 231, in basename > return split(p)[1] > File "C:/msys64/mingw64/lib/python3.8/ntpath.py", line 200, in split > p = os.fspath(p) > TypeError: expected str, bytes or os.PathLike object, not NoneType > > ERROR: meson setup failed > > It seems that it doesn't like parsing the discovered ninja path. I can > make configure > work by passing --ninja=ninja to configure which falls back to PATH and > appears to do > the right thing: > > ###XXX ['ninja', '--version'] > Found ninja.EXE-1.10.1 at C:\msys64\mingw64\bin/ninja.EXE > > I tried a few other things too: > > --ninja=C:/msys64/mingw64/bin/ninja - fails > --ninja=C:/msys64/mingw64/bin/ninja.exe - works > --ninja=ninja.exe - works > --ninja=/c/msys64/mingw64/bin/ninja - fails similar as above > --ninja=/c/msys64/mingw64/bin/ninja.exe - works > --ninja=C:\\msys64\\mingw64\\bin\\ninja - fails similar as above > --ninja=C:\\msys64\\mingw64\\bin\\ninja.exe - works > > From these tests it looks as if the .exe prefix is required when using a > full path to > the ninja executable. > > > ATB, > > Mark. > > --00000000000023ef8d05ade20df3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks, that might be worth fixing in Meson.

Paolo

Il gio 27 ago 2020, 17:57 Mark = Cave-Ayland <mark.cave-= ayland@ilande.co.uk> ha scritto:
On 26/08/2020 20:02, Paolo Bonzini wrote:

> On Windows it is not possible to invoke a Python script as $NINJA.
> If ninja is present use it directly, while if it is not we can
> keep using ninjatool.
>
> Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.c= o.uk>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>=C2=A0 configure | 16 +++++++++++++++-
>=C2=A0 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 9db9bb89b9..6ecaff429b 100755
> --- a/configure
> +++ b/configure
> @@ -568,6 +568,7 @@ rng_none=3D"no"
>=C2=A0 secret_keyring=3D""
>=C2=A0 libdaxctl=3D""
>=C2=A0 meson=3D""
> +ninja=3D""
>=C2=A0 skip_meson=3Dno
>=C2=A0 gettext=3D""
>=C2=A0
> @@ -1052,6 +1053,8 @@ for opt do
>=C2=A0 =C2=A0 ;;
>=C2=A0 =C2=A0 --meson=3D*) meson=3D"$optarg"
>=C2=A0 =C2=A0 ;;
> +=C2=A0 --ninja=3D*) ninja=3D"$optarg"
> +=C2=A0 ;;
>=C2=A0 =C2=A0 --smbd=3D*) smbd=3D"$optarg"
>=C2=A0 =C2=A0 ;;
>=C2=A0 =C2=A0 --extra-cflags=3D*)
> @@ -1820,6 +1823,7 @@ Advanced options (experts only):
>=C2=A0 =C2=A0 --python=3DPYTHON=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 use s= pecified python [$python]
>=C2=A0 =C2=A0 --sphinx-build=3DSPHINX=C2=A0 =C2=A0 use specified sphinx= -build [$sphinx_build]
>=C2=A0 =C2=A0 --meson=3DMESON=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = use specified meson [$meson]
> +=C2=A0 --ninja=3DNINJA=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 use s= pecified ninja [$ninja]
>=C2=A0 =C2=A0 --smbd=3DSMBD=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 use specified smbd [$smbd]
>=C2=A0 =C2=A0 --with-git=3DGIT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= use specified git [$git]
>=C2=A0 =C2=A0 --static=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0enable static build [$static]
> @@ -2058,6 +2062,16 @@ case "$meson" in
>=C2=A0 =C2=A0 =C2=A0 *) meson=3D$(command -v meson) ;;
>=C2=A0 esac
>=C2=A0
> +# Probe for ninja (used for compdb)
> +
> +if test -z "$ninja"; then
> +=C2=A0 =C2=A0 for c in ninja ninja-build samu; do
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if has $c; then
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ninja=3D$(command -v "= $c")
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 fi
> +=C2=A0 =C2=A0 done
> +fi
>=C2=A0
>=C2=A0 # Check that the C compiler works. Doing this here before testin= g
>=C2=A0 # the host CPU ensures that we had a valid CC to autodetect the<= br> > @@ -8197,7 +8211,7 @@ fi
>=C2=A0 mv $cross config-meson.cross
>=C2=A0
>=C2=A0 rm -rf meson-private meson-info meson-logs
> -NINJA=3D$PWD/ninjatool $meson setup \
> +NINJA=3D${ninja:-$PWD/ninjatool} $meson setup \
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 --prefix "${pre_prefix}$prefix&= quot; \
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 --libdir "${pre_prefix}$libdir&= quot; \
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 --libexecdir "${pre_prefix}$lib= execdir" \

I've just tested this, but it gives me a python stacktrace if I run it = without
passing a --ninja argument to configure. With a bit of extra debugging adde= d to see
what is being generated:

###XXX ['C:/msys64/mingw64/bin/ninja', '--version']
Traceback (most recent call last):
=C2=A0 File "C:/msys64/home/Mark/qemu/meson/mesonbuild/mesonmain.py&qu= ot;, line 131, in run
=C2=A0 =C2=A0 return options.run_func(options)
=C2=A0 File "C:/msys64/home/Mark/qemu/meson/mesonbuild/msetup.py"= , line 245, in run
=C2=A0 =C2=A0 app.generate()
=C2=A0 File "C:/msys64/home/Mark/qemu/meson/mesonbuild/msetup.py"= , line 159, in generate
=C2=A0 =C2=A0 self._generate(env)
=C2=A0 File "C:/msys64/home/Mark/qemu/meson/mesonbuild/msetup.py"= , line 215, in _generate
=C2=A0 =C2=A0 intr.backend.generate()
=C2=A0 File "C:/msys64/home/Mark/qemu/meson/mesonbuild/backend/ninjaba= ckend.py", line 483,
in generate
=C2=A0 =C2=A0 ninja =3D environment.detect_ninja_command_and_version(log=3D= True)
=C2=A0 File "C:/msys64/home/Mark/qemu/meson/mesonbuild/environment.py&= quot;, line 177, in
detect_ninja_command_and_version
=C2=A0 =C2=A0 name =3D os.path.basename(n)
=C2=A0 File "C:/msys64/mingw64/lib/python3.8/ntpath.py", line 231= , in basename
=C2=A0 =C2=A0 return split(p)[1]
=C2=A0 File "C:/msys64/mingw64/lib/python3.8/ntpath.py", line 200= , in split
=C2=A0 =C2=A0 p =3D os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

ERROR: meson setup failed

It seems that it doesn't like parsing the discovered ninja path. I can = make configure
work by passing --ninja=3Dninja to configure which falls back to PATH and a= ppears to do
the right thing:

###XXX ['ninja', '--version']
Found ninja.EXE-1.10.1 at C:\msys64\mingw64\bin/ninja.EXE

I tried a few other things too:

=C2=A0--ninja=3DC:/msys64/mingw64/bin/ninja - fails
=C2=A0--ninja=3DC:/msys64/mingw64/bin/ninja.exe - works
=C2=A0--ninja=3Dninja.exe - works
=C2=A0--ninja=3D/c/msys64/mingw64/bin/ninja - fails similar as above
=C2=A0--ninja=3D/c/msys64/mingw64/bin/ninja.exe - works
=C2=A0--ninja=3DC:\\msys64\\mingw64\\bin\\ninja - fails similar as above =C2=A0--ninja=3DC:\\msys64\\mingw64\\bin\\ninja.exe - works

>From these tests it looks as if the .exe prefix is required when using a fu= ll path to
the ninja executable.


ATB,

Mark.

--00000000000023ef8d05ade20df3--