Bump MacOS deplyment target to fix compilation error#339
Bump MacOS deplyment target to fix compilation error#339k3a wants to merge 1 commit intoOpenBoardView:masterfrom
Conversation
This fixes filesystem:path errors on recent MacOS: platform.h:26:19: error: 'path' is unavailable: introduced in macOS 10.15
|
OpenBoardView/src/CMakeLists.txt Line 155 in 1134511 The check for AppleClang is commented out to force the The official macOS x86_64 release is built on Mac OS X 10.11 and runs fine there. |
|
Thanks for the helpful pointers! For reference, on my MacOS 26 Tahoe, the system Clang is: So for Nix builds, I tried to replace the mentioned CMakeLists.txt with the following patch (an explicit check for From 1d6cd42f9c920ba371ba4fd1fda1589280a7904e Mon Sep 17 00:00:00 2001
From: Mario Hros <[email protected]>
Date: Sat, 18 Oct 2025 17:24:19 +0200
Subject: [PATCH] Disable std::filesystem for APPLE platforms to keep
supporting MacOS 10.9 deployment target with non-apple Clang
---
src/CMakeLists.txt | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cdc6940ea71857a00e7b2bfb66b34a272114aeb8..8a8b4b36d5b792363a26f54b8529e8656f6d0b37 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -154,16 +154,16 @@ set(IMGUI_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/imgui ${CMAKE_CURRENT_SOURCE_
## filesystem ##
message(CHECK_START "Checking for std::filesystem")
-## GCC 9 and Clang 9 include filesystem in the standard library. Apple is of course messing with us and AppleClang 11.4 is Clang 9.0
-if(((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0))
- #OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 11.4))
+## GCC 9 and Clang 9 include filesystem in the standard library. disable for Apple due to CMAKE_OSX_DEPLOYMENT_TARGET < 10.15
+if(((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0)
+ AND !APPLE)
message(CHECK_PASS "available")
set(CMAKE_CXX_STANDARD 17)
set(FILESYSTEM_LIBRARIES)
add_definitions(-DWITH_STD_FILESYSTEM)
-# Clang 8 requires explicit linking with lc++fs. AppleClang 11.0 is Clang 8.0
-elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0))
- #OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 11.0))
+# Clang 8 requires explicit linking with lc++fs. disable for Apple due to CMAKE_OSX_DEPLOYMENT_TARGET < 10.15
+elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
+ AND !APPLE)
message(CHECK_PASS "available")
set(CMAKE_CXX_STANDARD 17)
set(FILESYSTEM_LIBRARIES lc++fs)It forced Here is a snippet of ...
#if _LIBCPP_STD_VER >= 20
_LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono {
// [time.clock.file], type file_clock
using file_clock = filesystem::_FilesystemClock;
template <class _Duration>
using file_time = time_point<file_clock, _Duration>;
} // namespace chrono
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER >= 20
...
So it seems that we will need to bump the deployment target for Nix builds only. I understand that you may want to keep the deployment target as low as possible and it may work for some time with the Apple Clang. Unless you have some more tips on what to try, this PR will have to be closed, it seems. |
|
IIRC this should have been fixed in 502d7ff. |
|
Pull request #340 replaces this |
This fixes filesystem:path errors on recent MacOS:
ref: NixOS/nixpkgs#452764