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 41224490b import/Make.defs: Link the math library of the export 
package.
41224490b is described below

commit 41224490be89fb7ef9a298017da0bf6d7c288f1c
Author: Marco Casaroli <[email protected]>
AuthorDate: Wed Nov 4 01:25:26 2026 +0100

    import/Make.defs: Link the math library of the export package.
    
    In a kernel build the import makefile adds -lm only when
    CONFIG_LIBM_NONE is set: the condition is inverted.
    
    With CONFIG_LIBM the export package has libm.a, but the makefile does
    not add it.  A program that calls a math function has undefined
    symbols: its link fails on rv-virt:knsh64, and exec() of it fails on
    qemu-armv8a:knsh.  With CONFIG_LIBM_NONE the export package has no
    libm.a, and the link of every program fails with "cannot find -lm".
    
    Add -lm when a math library other than the one of the toolchain is
    selected, as commit 877509762 ("Use libm from the export package when
    defined") meant to.
    
    The import build is a make build only [skip-cmake-parity].
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 import/Make.defs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/import/Make.defs b/import/Make.defs
index 7e1bdff50..8b65b8a85 100644
--- a/import/Make.defs
+++ b/import/Make.defs
@@ -86,7 +86,7 @@ ifneq ($(LIBM),".")
   LDLIBPATH += -L "${shell dirname $(LIBM)}"
   LDLIBS += -lm
 endif
-else ifneq ($(CONFIG_LIBM_NONE),)
+else ifeq ($(CONFIG_LIBM_NONE),)
   LDLIBS += -lm
 endif
 endif

Reply via email to