From 5443e6619080b5a28144a33e53bc7a519f1a6066 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: (cherry picked from commit 1f1ec1c6bcc2a32a3c1df8c2cc7a2f4e7139b7ec) --- .pick_status.json | 2 +- src/gallium/frontends/rusticl/meson.build | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 3b3fef34b7b..fc588e1257d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4,7 +4,7 @@ "description": "rusticl: Show an error message if the version of bindgen can't be detected", "nominated": false, "nomination_type": 3, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build index 6cff319f780..92b23f548ff 100644 --- a/src/gallium/frontends/rusticl/meson.build +++ b/src/gallium/frontends/rusticl/meson.build @@ -114,11 +114,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', ]