Skip to content

Commit abe254b

Browse files
committed
Merge #119: cmake: avoid libatomic not found error on debian
296c380 cmake: avoid libatomic not found error on debian (Ryan Ofsky) Pull request description: Add workaround to prevent "libatomic not found" when building on debian against debian capnproto package which installs a buggy CapnProtoConfig.cmake file. The bug was introduced as part of debian's attempt to fix a different issue: capnproto/capnproto#1448 and their fix works for autoconf projects but not cmake projects like libmultiprocess. Fixes #68 Top commit has no ACKs. Tree-SHA512: 39ace69c069fd77188655cdebf6b40ec6ccf5bdd3ecbda993122e7bdd9facb0663a11e946eb7383ff8127b7c37aa0433df7917de435695a470b7bbf453b2a666
2 parents 245581d + 296c380 commit abe254b

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ project("Libmultiprocess" CXX)
88
set(CMAKE_CXX_STANDARD 17)
99
set(CMAKE_CXX_STANDARD_REQUIRED YES)
1010

11+
include("cmake/compat_find.cmake")
12+
1113
find_package(CapnProto REQUIRED)
1214
find_package(Threads REQUIRED)
1315

@@ -20,7 +22,7 @@ if(Libmultiprocess_ENABLE_CLANG_TIDY)
2022
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
2123
endif()
2224

23-
include("cmake/capnp_compat.cmake")
25+
include("cmake/compat_config.cmake")
2426
include("cmake/pthread_checks.cmake")
2527
include(GNUInstallDirs)
2628

cmake/capnp_compat.cmake renamed to cmake/compat_config.cmake

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Distributed under the MIT software license, see the accompanying
33
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5+
# compat_config.cmake -- compatibility workarounds meant to be included after
6+
# cmake find_package() calls are made, before configuring the ebuild
7+
58
# Define capnp_PREFIX if not defined to avoid issue on macos
69
# https://github.com/chaincodelabs/libmultiprocess/issues/26
710

cmake/compat_find.cmake

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2024 The Bitcoin Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
# compat_find.cmake -- compatibility workarounds meant to be included before
6+
# cmake find_package() calls are made
7+
8+
# Set FOUND_LIBATOMIC to work around bug in debian capnproto package that is
9+
# debian-specific and does not happpen upstream. Debian includes a patch
10+
# https://sources.debian.org/patches/capnproto/1.0.1-4/07_libatomic.patch/ which
11+
# uses check_library_exists(atomic __atomic_load_8 ...) and it fails because the
12+
# symbol name conflicts with a compiler instrinsic as described
13+
# https://github.com/chaincodelabs/libmultiprocess/issues/68#issuecomment-1135150171.
14+
# This could be fixed by improving the check_library_exists function as
15+
# described in the github comment, or by changing the debian patch to check for
16+
# the symbol a different way, but simplest thing to do is work around the
17+
# problem by setting FOUND_LIBATOMIC. This problem has probably not
18+
# been noticed upstream because it only affects CMake packages depending on
19+
# capnproto, not autoconf packages.
20+
set(FOUND_LIBATOMIC TRUE)

0 commit comments

Comments
 (0)