qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 04/10] configure: create native file with contents of $host_cc
Date: Tue, 29 Aug 2023 18:14:28 +0100	[thread overview]
Message-ID: <ZO4ndKXdF5oQSHlU@redhat.com> (raw)
In-Reply-To: <20230829082931.67601-5-pbonzini@redhat.com>

On Tue, Aug 29, 2023 at 10:29:25AM +0200, Paolo Bonzini wrote:
> The argument of --host-cc is not obeyed when cross compiling.  To avoid
> this issue, place it in a configuration file and pass it to meson
> with --native-file.
> 
> While at it, clarify that --host-cc is not obeyed anyway when _not_
> cross compiling.

I presume that's refering to this piece of code

if test -z "${CC}${cross_prefix}"; then
  cc="$host_cc"
else
  cc="${CC-${cross_prefix}gcc}"
fi

which is using $host_cc *before* --host-cc is processed, thus
meaning it is always at its default value of 'cc'.

Perhaps the above code snippet should just be changed to

  if test -z "${CC}${cross_prefix}"; then
    cc="cc"
  else
    cc="${CC-${cross_prefix}gcc}"
  fi

to make it clear that we were not intending to honour the
--host-cc value for this code.

> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

None the less, this patch is correct, so with or without
that above change:

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

> 
> diff --git a/configure b/configure
> index 3423f008d5c..b2bc1ff5f7b 100755
> --- a/configure
> +++ b/configure
> @@ -922,7 +922,7 @@ Advanced options (experts only):
>    --cross-prefix=PREFIX    use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
>    --cc=CC                  use C compiler CC [$cc]
>    --host-cc=CC             use C compiler CC [$host_cc] for code run at
> -                           build time
> +                           build time when cross compiling
>    --cxx=CXX                use C++ compiler CXX [$cxx]
>    --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
>    --extra-cflags=CFLAGS    append extra C compiler flags CFLAGS
> @@ -1886,7 +1886,6 @@ if test "$skip_meson" = no; then
>    echo "windres = [$(meson_quote $windres)]" >> $cross
>    echo "windmc = [$(meson_quote $windmc)]" >> $cross
>    if test "$cross_compile" = "yes"; then
> -    cross_arg="--cross-file config-meson.cross"
>      echo "[host_machine]" >> $cross
>      echo "system = '$targetos'" >> $cross
>      case "$cpu" in
> @@ -1903,6 +1902,14 @@ if test "$skip_meson" = no; then
>      else
>          echo "endian = 'little'" >> $cross
>      fi
> +    cross_arg="--cross-file config-meson.cross"
> +
> +    native="config-meson.native.new"
> +    echo "# Automatically generated by configure - do not modify" > $native
> +    echo "[binaries]" >> $native
> +    echo "c = [$(meson_quote $host_cc)]" >> $native
> +    mv $native config-meson.native
> +    cross_arg="$cross_arg --native-file config-meson.native"
>    else
>      cross_arg="--native-file config-meson.cross"
>    fi
> -- 
> 2.41.0
> 
> 

With 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 :|



  parent reply	other threads:[~2023-08-29 17:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29  8:29 [PATCH 00/10] configure cleanups for QEMU 8.2 Paolo Bonzini
2023-08-29  8:29 ` [PATCH 01/10] meson: do not unnecessarily use cmake for dependencies Paolo Bonzini
2023-08-29 17:14   ` Daniel P. Berrangé
2023-08-29  8:29 ` [PATCH 02/10] meson: update unsupported host/CPU messages Paolo Bonzini
2023-08-29 10:34   ` Daniel P. Berrangé
2023-08-31  8:20     ` Paolo Bonzini
2023-08-31  8:51       ` Daniel P. Berrangé
2023-08-29  8:29 ` [PATCH 03/10] configure: remove HOST_CC Paolo Bonzini
2023-08-29 17:12   ` Daniel P. Berrangé
2023-08-29 18:40   ` Richard Henderson
2023-08-29  8:29 ` [PATCH 04/10] configure: create native file with contents of $host_cc Paolo Bonzini
2023-08-29 16:54   ` Peter Maydell
2023-08-29 17:14   ` Daniel P. Berrangé [this message]
2023-08-31  8:26     ` Paolo Bonzini
2023-08-29 18:45   ` Richard Henderson
2023-08-29  8:29 ` [PATCH 05/10] meson: compile bundled device trees Paolo Bonzini
2023-08-29 14:25   ` Philippe Mathieu-Daudé
2023-08-29 18:48     ` Richard Henderson
2023-08-29 18:47   ` Richard Henderson
2023-08-29  8:29 ` [PATCH 06/10] contrib/plugins: use an independent makefile Paolo Bonzini
2023-08-29 17:16   ` Daniel P. Berrangé
2023-08-29  8:29 ` [PATCH 07/10] meson: do not use config_host to pick tap implementations Paolo Bonzini
2023-08-29 14:26   ` Philippe Mathieu-Daudé
2023-08-29 17:05   ` Daniel P. Berrangé
2023-08-29  8:29 ` [PATCH 08/10] configure, meson: move simple OS definitions to meson Paolo Bonzini
2023-08-29 14:28   ` Philippe Mathieu-Daudé
2023-08-29  8:29 ` [PATCH 09/10] configure: remove $linux and $mingw32 variables Paolo Bonzini
2023-08-29 14:28   ` Philippe Mathieu-Daudé
2023-08-29 17:05   ` Daniel P. Berrangé
2023-08-29  8:29 ` [PATCH 10/10] configure: move --enable-debug-tcg to meson Paolo Bonzini
2023-08-29 16:57   ` Peter Maydell
2023-08-29 18:52   ` Richard Henderson
2023-08-31  8:17   ` Philippe Mathieu-Daudé

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=ZO4ndKXdF5oQSHlU@redhat.com \
    --to=berrange@redhat.com \
    --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).