diff --git a/.github/workflows/core-release.yml b/.github/workflows/core-release.yml index 150e8fef5..902fde4f5 100644 --- a/.github/workflows/core-release.yml +++ b/.github/workflows/core-release.yml @@ -50,7 +50,7 @@ jobs: with: submodules: recursive - - run: brew install webp libuv + - run: brew install webp libuv llvm - uses: taiki-e/install-action@ba47c86ac325773530516bb756137ac718732518 # v2.86.5 with: diff --git a/platform/macos/macos.cmake b/platform/macos/macos.cmake index 5341a94e6..cd65c7050 100644 --- a/platform/macos/macos.cmake +++ b/platform/macos/macos.cmake @@ -144,12 +144,23 @@ add_test( WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) find_program(ARMERGE NAMES armerge) +find_program( + LLVM_OBJCOPY + NAMES llvm-objcopy + HINTS + /opt/homebrew/opt/llvm/bin + /usr/local/opt/llvm/bin +) if(MLN_CREATE_AMALGAMATION) if(NOT ARMERGE) message(FATAL_ERROR "armerge required when MLN_CREATE_AMALGAMATION=ON") endif() + if(NOT LLVM_OBJCOPY) + message(FATAL_ERROR "llvm-objcopy required when MLN_CREATE_AMALGAMATION=ON") + endif() message(STATUS "Found armerge: ${ARMERGE}") + message(STATUS "Found llvm-objcopy: ${LLVM_OBJCOPY}") include(${PROJECT_SOURCE_DIR}/cmake/find_static_library.cmake) set(STATIC_LIBS "") @@ -170,6 +181,12 @@ if(MLN_CREATE_AMALGAMATION) $ $ ${STATIC_LIBS} + # In Mach-O/Itanium ABI names, ZTI/ZTS/ZTV identify typeinfo, + # type names, and vtables, while St denotes std::. + # Keep them global so C++ exception matching works in downstream code. + COMMAND ${LLVM_OBJCOPY} --wildcard + "--globalize-symbol=__ZT[ISV]St*" + libmbgl-core-amalgam.a ) endif()