Skip to content

Commit 8fcd3f7

Browse files
committed
Fix SWIGWORDSIZE64 incorrectly set on macOS, breaking arm64 builds
On macOS (including Apple Silicon arm64), the system defines uint64_t as `unsigned long long` in <cstdint>. However, SWIG's stdint.i maps uint64_t to `unsigned long` when SWIGWORDSIZE64 is defined. The previous condition `UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8` evaluates to true on macOS because macOS is a POSIX-compliant 64-bit OS. This causes SWIG to define uint64_t as `unsigned long`, while the compiler sees it as `unsigned long long`, producing type mismatch errors in the generated fastddsPYTHON_wrap.cxx: error: cannot initialize return object of type 'std::vector<unsigned long> *' with an rvalue of type 'std::vector<unsigned long long> *' The fix excludes Apple platforms from setting SWIGWORDSIZE64. On Linux x86_64 and aarch64, uint64_t is `unsigned long`, so SWIGWORDSIZE64 remains correct there. On macOS, SWIG's fallback (unsigned long long) matches the system definition. Tested on macOS 15 (Sequoia) with Apple Silicon (arm64), SWIG 4.4.1, Clang 17, FastDDS 3.4.0.
1 parent f35b320 commit 8fcd3f7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fastdds_python/src/swig/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ swig_add_library(${PROJECT_NAME}
5252
${${PROJECT_NAME}_FILE}
5353
)
5454

55-
if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
55+
if(UNIX AND NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8)
5656
set_property(TARGET ${PROJECT_NAME} PROPERTY
5757
SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64
5858
)

0 commit comments

Comments
 (0)