This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 292117d2d build: Find the compiler runtime of the module compiler.
292117d2d is described below

commit 292117d2d266b787c0eac90d47df511859c5bf6f
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Oct 19 13:58:16 2026 +0200

    build: Find the compiler runtime of the module compiler.
    
    FIND_COMPILER_RT_LIB asked $(CC) for the compiler runtime of a loadable
    module.  The module is built with $(MODULECC), which is not always the
    same compiler.  On macOS the simulator builds its modules with an ELF
    toolchain (x86_64-elf-gcc), but $(CC) is the host clang, which gives the
    Mach-O libclang_rt.osx.a.  x86_64-elf-ld cannot read it, so no module
    links: "libclang_rt.osx.a: file not recognized: file format not
    recognized".
    
    Ask $(MODULECC).  It is $(CC) unless the board sets it, so the other
    builds do not change.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 Make.defs | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/Make.defs b/Make.defs
index 4a2dcfa48..fd3d0e1ea 100644
--- a/Make.defs
+++ b/Make.defs
@@ -72,14 +72,16 @@ BINDIR_DEBUG ?= $(APPDIR)$(DELIM)bin_debug
 
 BUILD_SHARED_LIBRARY ?= $(APPDIR)$(DELIM)Library.mk
 
-# Locate the compiler runtime used by loadable modules.  GCC and Clang
-# support these queries; other compilers may need an equivalent lookup.
+# Locate the compiler runtime used by loadable modules.  Ask the compiler
+# that builds the modules: on macOS the simulator builds them with an ELF
+# toolchain, not with the host compiler.  GCC and Clang support these
+# queries; other compilers may need an equivalent lookup.
 
 define FIND_COMPILER_RT_LIB
-$(or $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) \
+$(or $(wildcard $(shell $(MODULECC) $(ARCHCPUFLAGS) \
        --print-libgcc-file-name)), \
-       $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name \
-       $(notdir $(shell $(CC) $(ARCHCPUFLAGS) \
+       $(wildcard $(shell $(MODULECC) $(ARCHCPUFLAGS) --print-file-name \
+       $(notdir $(shell $(MODULECC) $(ARCHCPUFLAGS) \
        --print-libgcc-file-name)))))
 endef
 

Reply via email to