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

error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer #1066

Open
ryandesign opened this issue Nov 20, 2024 · 1 comment

Comments

@ryandesign
Copy link

openal-soft 1.24.0 doesn't build on macOS 10.12:

common/almalloc.h:78:46: error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer
   78 |         return static_cast<gsl::owner<T*>>(::operator new[](n*sizeof(T), AlignVal));
      |                                              ^
common/almalloc.h:78:46: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
common/almalloc.h:81:9: error: aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on macOS 10.13 or newer
   81 |     { ::operator delete[](gsl::owner<void*>{p}, AlignVal); }
      |         ^
common/almalloc.h:81:9: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic

Full build log: https://build.macports.org/builders/ports-10.12_x86_64-builder/builds/291362/steps/install-port/logs/stdio

It builds on macOS 12 and later.

This is a regression; 1.23.1 didn't have this problem.

@kcat
Copy link
Owner

kcat commented Nov 23, 2024

OpenAL Soft 1.24 relies on C++17. Even if those specific errors were fixed, various other structs rely on the over-alignment allocators being invoked when creating objects that have higher alignment needs. If they silently use the normal allocators without the necessary alignment, it can result in random crashes or other buggy behavior. I don't relish the idea of adding back the custom malloc functions and sprinkling in custom alignment new/delete methods, when it's been part of the standard for over 7 years.

You can try using a newer compiler and static-linking the C++ runtime to avoid relying on the system having a newer libc++, but C++17 is needed for compiling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants