From 1a52e9be02f0d9da576a92ad8edc61b159ddc77a Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sat, 15 Oct 2022 18:50:09 +0800 Subject: [PATCH] util: Turn -DWINDOWS_NO_FUTEX to be pre_args Turn -DWINDOWS_NO_FUTEX to be pre_args for not need add direct dependencies to dep_futex for libraries and executables. So only add dependencies to idep_mesautil is enough. And this will make sure all source code are either using Windows futex, or use mtx_t consistently across different sources, other than mixed usage of futex and mtx_t before this commit. If -DWINDOWS_NO_FUTEX is not globally available, that would cause /src/util/simple_mtx.h:116: undefined reference to `futex_wait' This error is raised when * compiled with -D min-windows-version=7 * moved futex_wait from futex.h to futex.c * used simple_mtx_t in more codes Or linkage error: src/compiler/libcompiler.a.p/glsl_types.cpp.obj: in function `futex_wake': /../../src/util/futex.h:154: undefined reference to `WaitOnAddress' When: * compiled with -D min-windows-version=7 * used simple_mtx_t in more codes Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7494 Fixes: c002bbeb2f7 ("util: Add a Win32 futex impl") Signed-off-by: Yonggang Luo Reviewed-by: Jesse Natalie Part-of: (cherry picked from commit 2b64ff92843339de4321d1c2f9da6931d0533912) --- .pick_status.json | 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 3d497719ef3..2faddc29670 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -220,7 +220,7 @@ "description": "util: Turn -DWINDOWS_NO_FUTEX to be pre_args", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "c002bbeb2f7a1bf2d5c020abdddcf25909c447b6" }, diff --git a/meson.build b/meson.build index 60b4078eb3b..1550bb208a9 100644 --- a/meson.build +++ b/meson.build @@ -1630,7 +1630,7 @@ endif dep_futex = null_dep if host_machine.system() == 'windows' if (get_option('min-windows-version') < 8) - dep_futex = declare_dependency(compile_args : ['-DWINDOWS_NO_FUTEX']) + pre_args += '-DWINDOWS_NO_FUTEX' else dep_futex = cc.find_library('synchronization', required : true) endif