From 1f1ec1c6bcc2a32a3c1df8c2cc7a2f4e7139b7ec Mon Sep 17 00:00:00 2001 From: LingMan <18294-LingMan@users.noreply.gitlab.freedesktop.org> Date: Sat, 4 Nov 2023 12:51:51 +0100 Subject: [PATCH] rusticl: Show an error message if the version of bindgen can't be detected bindgen 0.69.0 broke the `--version` switch, resulting in misleading errors about requiring at least bindgen 0.62 or about unexpected arguments. Ideally the build system would fetch the correct bindgen version automatically like cargo does. Until then, provide a hopefully more helpful error message to the user. Reviewed-by: Karol Herbst Part-of: --- src/gallium/frontends/rusticl/meson.build | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build index bdcc0d15c44..f6c28da414e 100644 --- a/src/gallium/frontends/rusticl/meson.build +++ b/src/gallium/frontends/rusticl/meson.build @@ -115,11 +115,17 @@ rusticl_bindgen_args = [ '--anon-fields-prefix', 'anon_', ] -if find_program('bindgen').version().version_compare('< 0.62') +bindgen_version = find_program('bindgen').version() + +if bindgen_version == 'unknown' + error('Failed to detect bindgen version. If you are using bindgen 0.69.0, please either update to 0.69.1 or downgrade to 0.68.1. You can install the latest version for your user with `cargo install bindgen-cli`.') +endif + +if bindgen_version.version_compare('< 0.62') error('rusticl requires bindgen 0.62 or newer. If your distribution does not ship a recent enough version, you can install the latest version for your user with `cargo install bindgen-cli`.') endif -if find_program('bindgen').version().version_compare('< 0.65') +if bindgen_version.version_compare('< 0.65') rusticl_bindgen_args += [ '--size_t-is-usize', ]