KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
2.9k stars 815 forks source link

Usage of `std::filesystem::absolute` in `glslang/Include/InfoSink.h` removes support for macOS < 10.15 and iOS < 13.0 #3604

Closed akien-mga closed 1 month ago

akien-mga commented 1 month ago

3467 introduced uses of std::filesystem::absolute, but the feature is not supported on macOS < 10.15 and iOS < 13.0.

Builds targeting older min versions (in my case - Godot Engine - it's macOS 10.13 for x86_64 and iOS 12.0) fail with these errors:

In file included from thirdparty/glslang/glslang/GenericCodeGen/Link.cpp:40:
In file included from thirdparty/glslang/glslang/GenericCodeGen/../Include/ShHandle.h:48:
thirdparty/glslang/glslang/GenericCodeGen/../Include/InfoSink.h:104:37In file included from thirdparty/glslang/glslang/GenericCodeGen/CodeGen.cpp:36:
In file included from thirdparty/glslang/glslang/GenericCodeGen/../Include/ShHandle.h:48:
thirdparty/glslang/glslang/GenericCodeGen/../Include/InfoSink.h:104:37: error: 'absolute' is unavailable: introduced in macOS 10.15
            append(std::filesystem::absolute(shaderFileName).string());
                                    ^
: error: 'absolute' is unavailable: introduced in macOS 10.15
/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__filesystem/operations.h:65:35: note: 'absolute' has been explicitly marked unavailable here
inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p) { return __absolute(__p); }
                                  ^
In file included from thirdparty/glslang/glslang/GenericCodeGen/Link.cpp:40:
In file included from thirdparty/glslang/glslang/GenericCodeGen/../Include/ShHandle.h:48:
thirdparty/glslang/glslang/GenericCodeGen/../Include/InfoSink.h:104:37: error: 'absolute' is unavailable: introduced in iOS 13.0 [2]
             append(std::filesystem::absolute(shaderFileName).string());
                                     ^

I don't see discussion in the PR that dropping support for these older macOS and iOS versions was intentional, so this was probably an oversight?

arcady-lunarg commented 1 month ago

The decision was not made in the PR, but there was a decision made to require C++17, implemented in #3163. std::filesystem::absolute is a C++17 feature, and the addition of this followed that policy. The versions of macOS and iOS affected are also no longer supported by Apple and are over 4 years old by now.

arcady-lunarg commented 1 month ago

Also, given the discussion on the Godot Engine PR that indicates that the Vulkan backend doesn't work work with the older OS versions impacted by this issue, I am curious to hear about how you are using glslang with OpenGL, or whether you really need it in that case.

akien-mga commented 1 month ago

The decision was not made in the PR, but there was a decision made to require C++17, implemented in #3163. std::filesystem::absolute is a C++17 feature, and the addition of this followed that policy. The versions of macOS and iOS affected are also no longer supported by Apple and are over 4 years old by now.

That's fair. It's actually surprising that Apple doesn't support this API in iOS 12.0 and macOS 10.14, when those otherwise seem to support all C++17 features Godot has been using for years now. So in my experience that's the first C++17 feature I find unsupported there (but we don't use much of the STL templates).

For now I could easily hack the removal of these two std::filesystem::absolute calls to preserve compatibility, until we actually decide to drop support for the 2% tail end of the Apple market.

Also, given the discussion on the Godot Engine PR that indicates that the Vulkan backend doesn't work work with the older OS versions impacted by this issue, I am curious to hear about how you are using glslang with OpenGL, or whether you really need it in that case.

Godot also has an OpenGL backend, which doesn't use glslang, but both are compiled in the same binary. So we're still compiling glslang for older macOS and iOS releases that should run OpenGL games made with Godot successfully.

arcady-lunarg commented 1 month ago

I think keeping your hack downstream is probably the way to go if it's not too much trouble, given everything you've mentioned.