SuperCollider doesn't build with AppleClang 15

After upgrading to Xcode 15, SuperCollider starting having build problems with boost. First up is this:

/Users/timwalters/git/supercollider/external_libraries/boost/boost/container_hash/hash.hpp:131:33: error: no template named
      'unary_function' in namespace 'std'; did you mean '__unary_function'?
        struct hash_base : std::unary_function<T, std::size_t> {};
                           ~~~~~^~~~~~~~~~~~~~
                                __unary_function

which can be fixed by setting _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION.

After that is fixed, I see this:

**/Users/timwalters/git/supercollider/external_libraries/boost/boost/mpl/aux_/integral_wrapper.hpp:73:31:** **error:** **integer value -1 is outside the valid range of values [0, 3] for this enumeration type [-Wenum-constexpr-conversion]**

This can be fixed by upgrading to latest boost, but unfortunately that causes lots of other breakage, I think due to boost changing its build system. Instead I added the compiler flag -Wno-enum-constexpr-conversion.

This diff allows SC to build. Whether it is the best fix I don’t know, but it is at least uninvasive.

**diff --git a/CMakeLists.txt b/CMakeLists.txt**
**index f9a44a6b84..e6c52fb635 100644**
**--- a/CMakeLists.txt**
**+++ b/CMakeLists.txt**
@@ -289,6 +289,13 @@ if(APPLE)
    option(SC_VERIFY_APP "Run verify_app on the app bundle" OFF)
endif()

+include(CheckCXXCompilerFlag)
+CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
+if(COMPILER_SUPPORTS_CXX17)
+    add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-enum-constexpr-conversion")
+endif()
+
#############################################
# some default libraries

Hi, there are already reports on building failure:

1 Like