* [PATCH] configure: Move preadv check to meson.build
@ 2021-01-26 15:58 Peter Maydell
2021-01-26 16:34 ` Paolo Bonzini
2021-01-27 21:49 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 4+ messages in thread
From: Peter Maydell @ 2021-01-26 15:58 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Alexander Graf, Joelle van Dyne
Move the preadv availability check to meson.build. This is what we
want to be doing for host-OS-feature-checks anyway, but it also fixes
a problem with building for macOS with the most recent XCode SDK on a
Catalina host.
On that configuration, 'preadv()' is provided as a weak symbol, so
that programs can be built with optional support for it and make a
runtime availability check to see whether the preadv() they have is a
working one or one which they must not call because it will
runtime-assert. QEMU's configure test passes (unless you're building
with --enable-werror) because the test program using preadv()
compiles, but then QEMU crashes at runtime when preadv() is called,
with errors like:
dyld: lazy symbol binding failed: Symbol not found: _preadv
Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replication
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _preadv
Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replication
Expected in: /usr/lib/libSystem.B.dylib
Meson's own function availability check has a special case for macOS
which adds '-Wl,-no_weak_imports' to the compiler flags, which forces
the test to require the real function, not the macOS-version-too-old
stub.
So this commit fixes the bug where macOS builds on Catalina currently
require --disable-werror.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
configure | 16 ----------------
meson.build | 4 +++-
2 files changed, 3 insertions(+), 17 deletions(-)
diff --git a/configure b/configure
index dcc5ea7d630..0e672c3e291 100755
--- a/configure
+++ b/configure
@@ -3525,19 +3525,6 @@ if compile_prog "" "" ; then
iovec=yes
fi
-##########################################
-# preadv probe
-cat > $TMPC <<EOF
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-int main(void) { return preadv(0, 0, 0, 0); }
-EOF
-preadv=no
-if compile_prog "" "" ; then
- preadv=yes
-fi
-
##########################################
# fdt probe
@@ -5742,9 +5729,6 @@ fi
if test "$iovec" = "yes" ; then
echo "CONFIG_IOVEC=y" >> $config_host_mak
fi
-if test "$preadv" = "yes" ; then
- echo "CONFIG_PREADV=y" >> $config_host_mak
-fi
if test "$membarrier" = "yes" ; then
echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
fi
diff --git a/meson.build b/meson.build
index 35a9eddf5cf..c4a66d87793 100644
--- a/meson.build
+++ b/meson.build
@@ -1128,6 +1128,8 @@ config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h'))
config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h'))
config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h'))
+config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>'))
+
ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target
arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
strings = ['HOST_DSOSUF', 'CONFIG_IASL']
@@ -2411,7 +2413,7 @@ summary_info += {'PIE': get_option('b_pie')}
summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
summary_info += {'malloc trim support': has_malloc_trim}
summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
-summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
+summary_info += {'preadv support': config_host_data.get('CONFIG_PREADV')}
summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] configure: Move preadv check to meson.build
2021-01-26 15:58 [PATCH] configure: Move preadv check to meson.build Peter Maydell
@ 2021-01-26 16:34 ` Paolo Bonzini
2021-01-27 21:49 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2021-01-26 16:34 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Alexander Graf, Joelle van Dyne
On 26/01/21 16:58, Peter Maydell wrote:
> Move the preadv availability check to meson.build. This is what we
> want to be doing for host-OS-feature-checks anyway, but it also fixes
> a problem with building for macOS with the most recent XCode SDK on a
> Catalina host.
>
> On that configuration, 'preadv()' is provided as a weak symbol, so
> that programs can be built with optional support for it and make a
> runtime availability check to see whether the preadv() they have is a
> working one or one which they must not call because it will
> runtime-assert. QEMU's configure test passes (unless you're building
> with --enable-werror) because the test program using preadv()
> compiles, but then QEMU crashes at runtime when preadv() is called,
> with errors like:
>
> dyld: lazy symbol binding failed: Symbol not found: _preadv
> Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replication
> Expected in: /usr/lib/libSystem.B.dylib
>
> dyld: Symbol not found: _preadv
> Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replication
> Expected in: /usr/lib/libSystem.B.dylib
>
> Meson's own function availability check has a special case for macOS
> which adds '-Wl,-no_weak_imports' to the compiler flags, which forces
> the test to require the real function, not the macOS-version-too-old
> stub.
>
> So this commit fixes the bug where macOS builds on Catalina currently
> require --disable-werror.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> configure | 16 ----------------
> meson.build | 4 +++-
> 2 files changed, 3 insertions(+), 17 deletions(-)
>
> diff --git a/configure b/configure
> index dcc5ea7d630..0e672c3e291 100755
> --- a/configure
> +++ b/configure
> @@ -3525,19 +3525,6 @@ if compile_prog "" "" ; then
> iovec=yes
> fi
>
> -##########################################
> -# preadv probe
> -cat > $TMPC <<EOF
> -#include <sys/types.h>
> -#include <sys/uio.h>
> -#include <unistd.h>
> -int main(void) { return preadv(0, 0, 0, 0); }
> -EOF
> -preadv=no
> -if compile_prog "" "" ; then
> - preadv=yes
> -fi
> -
> ##########################################
> # fdt probe
>
> @@ -5742,9 +5729,6 @@ fi
> if test "$iovec" = "yes" ; then
> echo "CONFIG_IOVEC=y" >> $config_host_mak
> fi
> -if test "$preadv" = "yes" ; then
> - echo "CONFIG_PREADV=y" >> $config_host_mak
> -fi
> if test "$membarrier" = "yes" ; then
> echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
> fi
> diff --git a/meson.build b/meson.build
> index 35a9eddf5cf..c4a66d87793 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1128,6 +1128,8 @@ config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h'))
> config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h'))
> config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h'))
>
> +config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>'))
> +
> ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target
> arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
> strings = ['HOST_DSOSUF', 'CONFIG_IASL']
> @@ -2411,7 +2413,7 @@ summary_info += {'PIE': get_option('b_pie')}
> summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
> summary_info += {'malloc trim support': has_malloc_trim}
> summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
> -summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
> +summary_info += {'preadv support': config_host_data.get('CONFIG_PREADV')}
> summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
> summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
> summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Thanks,
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] configure: Move preadv check to meson.build
2021-01-26 15:58 [PATCH] configure: Move preadv check to meson.build Peter Maydell
2021-01-26 16:34 ` Paolo Bonzini
@ 2021-01-27 21:49 ` Philippe Mathieu-Daudé
2021-01-28 12:15 ` Peter Maydell
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-27 21:49 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Paolo Bonzini, Alexander Graf, Joelle van Dyne
On 1/26/21 4:58 PM, Peter Maydell wrote:
> Move the preadv availability check to meson.build. This is what we
> want to be doing for host-OS-feature-checks anyway, but it also fixes
> a problem with building for macOS with the most recent XCode SDK on a
> Catalina host.
>
> On that configuration, 'preadv()' is provided as a weak symbol, so
> that programs can be built with optional support for it and make a
> runtime availability check to see whether the preadv() they have is a
> working one or one which they must not call because it will
> runtime-assert. QEMU's configure test passes (unless you're building
> with --enable-werror) because the test program using preadv()
> compiles, but then QEMU crashes at runtime when preadv() is called,
> with errors like:
>
> dyld: lazy symbol binding failed: Symbol not found: _preadv
> Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replication
> Expected in: /usr/lib/libSystem.B.dylib
>
> dyld: Symbol not found: _preadv
> Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replication
> Expected in: /usr/lib/libSystem.B.dylib
>
> Meson's own function availability check has a special case for macOS
> which adds '-Wl,-no_weak_imports' to the compiler flags, which forces
> the test to require the real function, not the macOS-version-too-old
> stub.
>
> So this commit fixes the bug where macOS builds on Catalina currently
> require --disable-werror.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> configure | 16 ----------------
> meson.build | 4 +++-
> 2 files changed, 3 insertions(+), 17 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] configure: Move preadv check to meson.build
2021-01-27 21:49 ` Philippe Mathieu-Daudé
@ 2021-01-28 12:15 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2021-01-28 12:15 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Paolo Bonzini, Alexander Graf, QEMU Developers, Joelle van Dyne
On Wed, 27 Jan 2021 at 21:49, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> On 1/26/21 4:58 PM, Peter Maydell wrote:
> > Move the preadv availability check to meson.build. This is what we
> > want to be doing for host-OS-feature-checks anyway, but it also fixes
> > a problem with building for macOS with the most recent XCode SDK on a
> > Catalina host.
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Thanks; I'll take this via target-arm.next just for convenience's sake.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-28 12:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 15:58 [PATCH] configure: Move preadv check to meson.build Peter Maydell
2021-01-26 16:34 ` Paolo Bonzini
2021-01-27 21:49 ` Philippe Mathieu-Daudé
2021-01-28 12:15 ` Peter Maydell
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.