mirror of
https://github.com/void-linux/void-packages.git
synced 2025-07-29 08:52:56 +02:00
boost: fix aligned_alloc brokenness for real
The previous patch does not work; I could reproduce that libtorrent was still using the wrong stuff on my system and segfaulting. Even if it did work, it would be fragile, since there is no guarantee features.h will define _XOPEN_SOURCE (e.g. defining _BSD_SOURCE or _DEFAULT_SOURCE will disable the lines that define it). Therefore, stop trying to be clever and simply make POSIX the fallback behavior. It would be okay to drop all the system specific logic too, since our boost build is for a single target, but those are harmless and would just make for an unnecessarily bigger patch.
This commit is contained in:
parent
baf697f22b
commit
5b1be772c7
3 changed files with 28 additions and 33 deletions
27
srcpkgs/boost/patches/aligned_alloc.patch
Normal file
27
srcpkgs/boost/patches/aligned_alloc.patch
Normal file
|
@ -0,0 +1,27 @@
|
|||
commit 98ca73bfe3f574ba72232013919885bdae679e09
|
||||
Author: Daniel Kolesa <daniel@octaforge.org>
|
||||
Date: Fri Sep 23 03:55:45 2022 +0200
|
||||
|
||||
use posix as a fallback for aligned_alloc
|
||||
|
||||
Testing for feature test macros is a broken antipattern, and
|
||||
fucks up in ugly ways under musl. Since we don't really care
|
||||
for having a non-POSIX fallback, always use the POSIX code
|
||||
unless forced.
|
||||
|
||||
diff --git a/boost/align/aligned_alloc.hpp b/boost/align/aligned_alloc.hpp
|
||||
index 1d81a13..f2b5137 100644
|
||||
--- a/boost/align/aligned_alloc.hpp
|
||||
+++ b/boost/align/aligned_alloc.hpp
|
||||
@@ -38,10 +38,8 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
#include <boost/align/detail/aligned_alloc_posix.hpp>
|
||||
#elif defined(sun) || defined(__sun)
|
||||
#include <boost/align/detail/aligned_alloc_sunos.hpp>
|
||||
-#elif (_POSIX_C_SOURCE >= 200112L) || (_XOPEN_SOURCE >= 600)
|
||||
-#include <boost/align/detail/aligned_alloc_posix.hpp>
|
||||
#else
|
||||
-#include <boost/align/detail/aligned_alloc.hpp>
|
||||
+#include <boost/align/detail/aligned_alloc_posix.hpp>
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,32 +0,0 @@
|
|||
boost/align/aligned_alloc.hpp is wrong, it uses feature test macros to
|
||||
determine whether something is available;
|
||||
FTMs shouldn't be in user code outside of top level #define's.
|
||||
|
||||
This lead to an issue on musl where libtorrent-rasterbar was including this
|
||||
header (via boost asio) from two different places, and segfaulting due to
|
||||
mismatched implementations -- one's the posix one using posix_memalign, the
|
||||
other one's the generic one that stores a pointer to itself.
|
||||
|
||||
posix_memalign is always available on the libcs we support and should always be
|
||||
used, so we force that. We still leave applications with the option of forcing
|
||||
boost specific behavior, if they really want it.
|
||||
|
||||
Instead of patching only boost/align/aligned_alloc.hpp, which fix the
|
||||
bug if boost::asio is used, but may keep other boost's code use feature tests
|
||||
macro, now or later, let's patch boost/config.hpp to always define
|
||||
_XOPEN_SOURCE instead.
|
||||
|
||||
--- a/boost/config.hpp
|
||||
+++ b/boost/config.hpp
|
||||
@@ -17,6 +17,11 @@
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#define BOOST_CONFIG_HPP
|
||||
|
||||
+#ifdef __linux__
|
||||
+/* for _XOPEN_SOURCE and/or _POSIX_C_SOURCE */
|
||||
+#include <features.h>
|
||||
+#endif
|
||||
+
|
||||
// if we don't have a user config, then use the default location:
|
||||
#if !defined(BOOST_USER_CONFIG) && !defined(BOOST_NO_USER_CONFIG)
|
||||
# define BOOST_USER_CONFIG <boost/config/user.hpp>
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'boost'
|
||||
pkgname=boost
|
||||
version=1.80.0
|
||||
revision=2
|
||||
revision=3
|
||||
wrksrc="${pkgname}_${version//\./_}"
|
||||
hostmakedepends="which bzip2-devel icu-devel python3-devel pkg-config"
|
||||
makedepends="zlib-devel bzip2-devel icu-devel python3-devel liblzma-devel
|
||||
|
|
Loading…
Add table
Reference in a new issue