Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbus: fix build of 1.15.8 with Visual Studio 2022 #22156

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions recipes/dbus/1.x.x/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ sources:
url: "https://dbus.freedesktop.org/releases/dbus/dbus-1.15.0.tar.xz"
sha256: "5073c8cb9ad20226647bb38f4965182b762a6e1f595ccdc8e59411014bfd640a"
patches:
"1.15.8":
- patch_file: "patches/0001-meson-Use-check_header-to-confirm-headers-work.patch"
patch_type: "portability"
patch_description: "Fix build with Visual Studio 2022"
patch_source: "https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/454"
"1.15.2":
- patch_file: "patches/0003-meson-monotonic-clock-check.patch"
patch_type: "portability"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From e52ccaf7c3abf9d0adccfd001c1417ce08a7f335 Mon Sep 17 00:00:00 2001
From: Thomas Sondergaard <[email protected]>
Date: Thu, 4 Jan 2024 17:45:46 +0100
Subject: [PATCH] meson: Use check_header to confirm headers work

instead of using has_header use check_header to confirm the header
works. This is necessary to get the meson build to work with Visual
Studio 2022. It has <stdatomic.h> but it does not actually work when
compiling a C program. A minimal C program that include <stdatomic.h>
fails with the following errors:

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(36): error C2061: syntax error: identifier 'atomic_bool'
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(36): error C2059: syntax error: ';'
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(37): error C2061: syntax error: identifier 'atomic_char'
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(37): error C2059: syntax error: ';'
...
...

check_header is consistent with CMake's

check_include_file(stdatomic.h HAVE_STDATOMIC_H)

which is why the CMake-based build of dbus works with Visual Studio
2022, while the meson build doesn't.

Fixes #494
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 17b2a837..19b41cd9 100644
--- a/meson.build
+++ b/meson.build
@@ -705,7 +705,7 @@ check_headers = [

foreach header : check_headers
macro = 'HAVE_' + header.underscorify().to_upper()
- config.set(macro, cc.has_header(header, args: compile_args_c) ? 1 : false)
+ config.set(macro, cc.check_header(header, args: compile_args_c) ? 1 : false)
endforeach

execinfo = cc.find_library('execinfo', required: false)
--
2.43.0.windows.1