Skip to content

Commit aac9475

Browse files
committed
fix: add comprehensive workaround for conda libc++ on macOS
The conda-provided libc++ on macOS has compatibility issues with ptrdiff_t and other standard library types due to _LIBCPP_USING_IF_EXISTS failing to resolve types from the global namespace. Changes: - Include stddef.h (C header) before C++ headers to ensure types are defined - Add _LIBCPP_DISABLE_AVAILABILITY flag on macOS to disable availability checks that can conflict with conda environments This resolves the 'reference to unresolved using declaration' error for ptrdiff_t in char_traits.h when building with conda on macOS. References: - conda/conda#11196 - llvm/llvm-project#54233
1 parent 643a30f commit aac9475

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/filepattern/cpp/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ if(JAVA_BINDING)
6060
add_compile_definitions(JAVA_BINDING)
6161
endif()
6262

63+
# Workaround for conda libc++ compatibility on macOS
64+
if(APPLE)
65+
add_compile_definitions(_LIBCPP_DISABLE_AVAILABILITY)
66+
endif()
67+
6368
#==== Source files
6469
set(SOURCE pattern.cpp
6570
interface/filepattern.cpp

src/filepattern/cpp/pattern.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
*/
1111

1212
#pragma once
13+
14+
// Workaround for conda libc++ on macOS: include C headers before C++ headers
15+
// to ensure ptrdiff_t and other types are properly defined
16+
#include <stddef.h>
17+
1318
#include <cstddef>
1419
#include <string>
1520
#include <iostream>

0 commit comments

Comments
 (0)