[Solved] Build failing on MacOSX error: 'value' is unavailable : introduced in macOS 10.14

between the 5 and 6 May building master started failing for me.
building blender-v3.2-release branch works fine.

% sw_vers            
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H1715

terminal output

Current branch master is up to date.
dup@iMacdemnteiller blender-git % make

Configuring Blender in "/Users/dup/blender-source/build_darwin" ...
-- Detected OS X 11.1 and Command Line Tools 12.4 at /Library/Developer/CommandLineTools
-- SDKs Directory: /Library/Developer/CommandLineTools/SDKs
-- Detected OSX_SYSROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
-- JACK not found, disabling WITH_JACK
...
-- Using /Users/dup/blender-source/blender-git/../lib/darwin/openmp for OpenMP
-- SSE2 SIMD instructions enabled
-- Unsupported CXXFLAG: -Wc++20-designator
-- Unsupported CXXFLAG: -Wno-suggest-override
-- Unsupported CFLAG: -Wno-unused-but-set-variable
-- Metal version too old, must be SDK 12.0 or newer, disabling WITH_CYCLES_DEVICE_METAL
-- Tests: Using Python executable: /Users/dup/blender-source/blender-git/../lib/darwin/python/bin/python3.10
CMake Warning at tests/python/CMakeLists.txt:632 (MESSAGE):
  Disabling render tests because tests folder does not exist at
  /Users/dup/blender-source/blender-git/../lib/tests

-- Directory named /Users/dup/blender-source/blender-git/../lib/tests/modeling/geometry_nodes
...
-- Directory named /Users/dup/blender-source/blender-git/../lib/tests/modeling/geometry_nodes/mesh/subdivision_tests/ Not Found, disabling test.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/dup/blender-source/build_darwin

Building Blender ...
make -s -C "/Users/dup/blender-source/build_darwin" -j 8 install
...
[ 46%] Building C object source/blender/imbuf/CMakeFiles/bf_imbuf.dir/intern/iris.c.o
/Users/dup/blender-source/blender-git/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc:576:64: warning: loop variable 'texture_map' is
      always a copy because the range of type 'blender::Map<const blender::io::obj::eMTLSyntaxElement, blender::io::obj::tex_map_XX, 0,
      blender::PythonProbingStrategy<1, false>, blender::DefaultHash<const blender::io::obj::eMTLSyntaxElement>, blender::DefaultEquality,
      blender::SimpleMapSlot<const blender::io::obj::eMTLSyntaxElement, blender::io::obj::tex_map_XX>, blender::GuardedAllocator>::ItemIterator' does not
      return a reference [-Wrange-loop-analysis]
    for (const Map<const eMTLSyntaxElement, tex_map_XX>::Item &texture_map :
                                                               ^
/Users/dup/blender-source/blender-git/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc:576:10: note: use non-reference type
      'Map<const eMTLSyntaxElement, tex_map_XX>::Item'
    for (const Map<const eMTLSyntaxElement, tex_map_XX>::Item &texture_map :
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 46%] Building C object source/blender/bmesh/CMakeFiles/bf_bmesh.dir
[ 46%] Building C object source/blender/bmesh/CMakeFiles/bf_bmesh.dir/operators/bmo_subdivide.c.o
...
[ 54%] Building CXX object source/blender/io/usd/CMakeFiles/bf_usd.dir/intern/usd_reader_light.cc.o
[ 54%] Building CXX object source/blender/io/alembic/CMakeFiles/bf_alembic.dir/exporter/abc_writer_camera.cc.o
/Users/dup/blender-source/blender-git/source/blender/io/usd/intern/usd_writer_volume.cc:56:86: error: 'value' is unavailable: introduced in macOS 10.14
    if (auto relative_vdb_file_path = construct_vdb_relative_file_path(vdb_file_path.value())) {
                                                                                     ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/optional:953:27: note: 'value' has been explicitly marked unavailable here
    constexpr value_type& value() &
                          ^
/Users/dup/blender-source/blender-git/source/blender/io/usd/intern/usd_writer_volume.cc:78:68: error: 'value' is unavailable: introduced in macOS 10.14
    usd_grid.GetFilePathAttr().Set(pxr::SdfAssetPath(vdb_file_path.value()), timecode);
                                                                   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/optional:953:27: note: 'value' has been explicitly marked unavailable here
    constexpr value_type& value() &
                          ^
/Users/dup/blender-source/blender-git/source/blender/io/usd/intern/usd_writer_volume.cc:110:23: error: 'value' is unavailable: introduced in macOS 10.14
    if (vdb_file_path.value().empty()) {
                      ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/optional:953:27: note: 'value' has been explicitly marked unavailable here
    constexpr value_type& value() &
                          ^
[ 54%] Building CXX object source/blender/io/collada/CMakeFiles/bf_collada.dir/ImageExporter.cpp.o
3 errors generated.
make[3]: *** [source/blender/io/usd/CMakeFiles/bf_usd.dir/intern/usd_writer_volume.cc.o] Error 1
make[3]: *** Waiting for unfinished jobs....
Consolidate compiler generated dependencies of target bf_intern_opensubdiv
[ 54%] Built target bf_intern_opensubdiv
...
[ 55%] Linking CXX static library ../../../../lib/libbf_collada.a
[ 55%] Built target bf_collada
make[1]: *** [all] Error 2
make: *** [all] Error 2

1 Like

I created ⚙ D14883 Fix std::optional value() build error on older macOS SDK to fix it for me.

1 Like