fix(sim): fix cmake build on macOS

macOS /usr/bin/ar does not understand the @rsp syntax used in CMake.
Using LLVM binutils instead.

Signed-off-by: bijunda <bijunda@bytedance.com>
This commit is contained in:
bijunda
2026-05-13 10:01:26 -03:00
committed by Alan C. Assis
parent d9f6216f30
commit d701340cb6
2 changed files with 15 additions and 2 deletions
+14 -2
View File
@@ -21,8 +21,20 @@
# ##############################################################################
if(APPLE AND CONFIG_SIM_TOOLCHAIN_GCC)
find_program(CMAKE_C_ELF_COMPILER x86_64-elf-gcc)
find_program(CMAKE_CXX_ELF_COMPILER x86_64-elf-g++)
if(CONFIG_HOST_ARM64)
find_program(CMAKE_C_ELF_COMPILER aarch64-elf-gcc)
find_program(CMAKE_CXX_ELF_COMPILER aarch64-elf-g++)
else()
find_program(CMAKE_C_ELF_COMPILER x86_64-elf-gcc)
find_program(CMAKE_CXX_ELF_COMPILER x86_64-elf-g++)
endif()
endif()
# Ninja archives large object lists through response files. Use LLVM binutils
# because macOS /usr/bin/ar does not understand the @rsp syntax.
if(APPLE)
find_program(CMAKE_AR NAMES llvm-ar REQUIRED)
find_program(CMAKE_RANLIB NAMES llvm-ranlib REQUIRED)
endif()
if(WIN32)
+1
View File
@@ -156,6 +156,7 @@ list(
if(CONFIG_HOST_MACOS)
if(CONFIG_HAVE_CXXINITIALIZE)
list(APPEND HOSTSRCS sim_macho_init.c)
target_link_options(nuttx PRIVATE -Wl,-ld_classic,-no_fixup_chains)
endif()
endif()