blender/build_files/build_environment/patches/rubberband_missing_cstdlib.diff
Jonas Holzman 8ad8f215fa Deps: Fix rubberband failing to compile due missing cstdlib include
Currently, trying to build rubberband on macOS using the latest Xcode
toolchain (26.4) leads to the following error:

```
In file included from ../external_rubberband/src/common/mathmisc.cpp:24:
../external_rubberband/src/common/mathmisc.h:58:1: error: unknown type name 'size_t'; did you mean 'std::size_t'?
   58 | size_t roundUp(size_t value); // to nearest power of two
      | ^~~~~~
      | std::size_t
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.4.sdk/usr/include/c++/v1/__cstddef/size_t.h:20:7: note: 'std::size_t' declared here
   20 | using size_t = decltype(sizeof(int));
      |       ^
<more size_t related errors...>
```

The issue seems to be caused by changes in implicit include behavior in
the latest version of the LLVM standard library, with this PR[^1] opened
on the rubberbang Github mirror referring to libcxx 21, which also
matches the version Xcode was upgraded to in its latest 26.4 release[^2]

Fixed by explicitely including the `<cstdlib>` include in the affected
mathmisc.h file. While this issue was encountered on macOS, it most
probably affects all platforms buildling with LLVM 21+, and thus no
guards were applied for it to affect all platforms.

As this is just a simple standard include fix, this should induce nor
require any library rebuilds.

[^1]: https://github.com/breakfastquay/rubberband/pull/126
[^2]: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions

Pull Request: https://projects.blender.org/blender/blender/pulls/157467
2026-04-16 15:48:00 +02:00

13 lines
279 B
Diff

diff --git a/src/common/mathmisc.h b/src/common/mathmisc.h
index d8bcc14..66f3378 100644
--- a/src/common/mathmisc.h
+++ b/src/common/mathmisc.h
@@ -26,6 +26,8 @@
#include "sysutils.h"
+#include <cstdlib>
+
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif // M_PI