Skip to content

include/cxx/cmath: Use toolchain <cmath> with toolchain libm#18374

Merged
xiaoxiang781216 merged 1 commit intoapache:masterfrom
aviralgarg05:fix/issue-18232-cmath-toolchain-libm
Feb 26, 2026
Merged

include/cxx/cmath: Use toolchain <cmath> with toolchain libm#18374
xiaoxiang781216 merged 1 commit intoapache:masterfrom
aviralgarg05:fix/issue-18232-cmath-toolchain-libm

Conversation

@aviralgarg05
Copy link
Copy Markdown
Contributor

Summary

This addresses the unresolved case in issue #18232 after #18308 was merged.

When CONFIG_LIBM_TOOLCHAIN=y, include/cxx/cmath should not try to populate std::* from the NuttX shim path. In this mode, cmath now delegates to the toolchain C++ wrapper via:

#include_next <cmath>

This lets libstdc++/toolchain <cmath> pull in its matching C math.h (include_next <math.h>) and correctly provide std::abs, std::acos, etc.

For non-toolchain-libm configurations, existing NuttX behavior in include/cxx/cmath is unchanged.

Why this is needed

In the reported configuration:

  • CONFIG_LIBM_TOOLCHAIN=y
  • CONFIG_LIBCXXTOOLCHAIN=y
  • CONFIG_LIBSUPCXX_TOOLCHAIN=y

users still hit errors like:

  • 'abs' has not been declared in 'std'
  • 'acos' has not been declared in 'std'

(Reference: #18232 (comment))

Impact

  • Fixes toolchain-libm + toolchain-libstdc++ interoperability in <math.h>/<cmath> include flows.
  • Keeps non-CONFIG_LIBM_TOOLCHAIN behavior unchanged.
  • Changes only one file: include/cxx/cmath.

Testing

Host: macOS (Apple Silicon)

  1. Reproducer compile with g++-15 and CONFIG_LIBM_TOOLCHAIN stubs:
    • #include <math.h> with using namespace std; passed.
    • #include <cmath> with using namespace std; passed.
  2. Repeated the above reproducer 3 consecutive iterations: all passed.
  3. Cross-check with clang++ in the same include configuration: passed.
  4. Style checks:
    • tools/checkpatch.sh -f include/cxx/cmath passed.
    • git diff --check -- include/cxx/cmath passed.

Fixes #18232

When CONFIG_LIBM_TOOLCHAIN is enabled, include_next the toolchain\n<c\+\+>/cmath wrapper instead of importing symbols from the NuttX\ncmath shim. This avoids include-order recursion and lets libstdc\+\+\nresolve std::abs/std::acos/... against the matching toolchain C\nmath.h declarations.\n\nKeep the existing NuttX cmath namespace path unchanged for non-\ntoolchain libm configurations.

Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
@github-actions github-actions Bot added the Size: S The size of the change in this PR is small label Feb 9, 2026
@acassis
Copy link
Copy Markdown
Contributor

acassis commented Feb 9, 2026

@simbit18 any idea? :

End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of db46128e73cee26d6a6eb0482dcba544ee1ea9f5.zip or
db46128e73cee26d6a6eb0482dcba544ee1ea9f5.zip.zip, and cannot find db46128e73cee26d6a6eb0482dcba544ee1ea9f5.zip.ZIP, period.

@acassis acassis requested a review from linguini1 February 9, 2026 23:57
@simbit18
Copy link
Copy Markdown
Contributor

Hi @acassis, this time it doesn't seem to be our fault! :)
Anyway, GitHub had some problems yesterday, check the status.

https://www.githubstatus.com/history

@acassis
Copy link
Copy Markdown
Contributor

acassis commented Feb 10, 2026

Hi @acassis, this time it doesn't seem to be our fault! :) Anyway, GitHub had some problems yesterday, check the status.

https://www.githubstatus.com/history

Thank you @simbit18 !

@acassis
Copy link
Copy Markdown
Contributor

acassis commented Feb 12, 2026

@aviralgarg05
Copy link
Copy Markdown
Contributor Author

Please review this

Copy link
Copy Markdown
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please reproduce the original issue in #18232 and show that after the changes are applied, the issue no longer occurs? You can attach the build logs for this in the testing section.

Note: in the future, you don't need to mention the style checks passing in your testing description, that can be shown by the CI. Additionally, reproducing a build issue 3 times consecutively doesn't add any more credibility than just doing it once :)

@aviralgarg05
Copy link
Copy Markdown
Contributor Author

@linguini1

I reproduced the same failure pattern from #18232 using the reported setup (CONFIG_LIBM_TOOLCHAIN=y, CONFIG_LIBCXXTOOLCHAIN=y,

I also captured a clear before/after with the exact same compile command:

g++-15 -std=gnu++17 \
  -isystem <stub-config-path> \
  -isystem <cxx-header-path> \
  -c repro.cpp -o repro.o

Before this patch (using the previous include/cxx/cmath), build fails with the same class of errors:

.../include/c++/15/math.h:39:12: error: 'acos' has not been declared in 'std'
.../include/c++/15/math.h:40:12: error: 'asin' has not been declared in 'std'
.../include/c++/15/math.h:41:12: error: 'atan' has not been declared in 'std'
.../include/c++/15/math.h:42:12: error: 'atan2' has not been declared in 'std'
.../include/c++/15/math.h:43:12: error: 'cos' has not been declared in 'std'
...

After this patch (current include/cxx/cmath), the same command succeeds:

(No output - build successful)

@linguini1
Copy link
Copy Markdown
Contributor

@linguini1

I reproduced the same failure pattern from #18232 using the reported setup (CONFIG_LIBM_TOOLCHAIN=y, CONFIG_LIBCXXTOOLCHAIN=y,

I also captured a clear before/after with the exact same compile command:

g++-15 -std=gnu++17 \
  -isystem <stub-config-path> \
  -isystem <cxx-header-path> \
  -c repro.cpp -o repro.o

Before this patch (using the previous include/cxx/cmath), build fails with the same class of errors:

.../include/c++/15/math.h:39:12: error: 'acos' has not been declared in 'std'
.../include/c++/15/math.h:40:12: error: 'asin' has not been declared in 'std'
.../include/c++/15/math.h:41:12: error: 'atan' has not been declared in 'std'
.../include/c++/15/math.h:42:12: error: 'atan2' has not been declared in 'std'
.../include/c++/15/math.h:43:12: error: 'cos' has not been declared in 'std'
...

After this patch (current include/cxx/cmath), the same command succeeds:

(No output - build successful)

Thanks, but could you show the build log generated from doing this through the NuttX build system as the user did? With the repro.c file as an app?

@aviralgarg05
Copy link
Copy Markdown
Contributor Author

aviralgarg05 commented Feb 25, 2026

@linguini1
I reran this through the NuttX app build flow (instead of a standalone compiler invocation) using a repro app source in apps/testing/cxx/cxxtest/cxxtest_main.cxx with the same include pattern from #18232 and these config flags enabled:

  • CONFIG_HAVE_CXX=y
  • CONFIG_HAVE_CXXINITIALIZE=y
  • CONFIG_LIBCXXTOOLCHAIN=y
  • CONFIG_LIBSUPCXX_TOOLCHAIN=y
  • CONFIG_LIBM_TOOLCHAIN=y
  • CONFIG_TESTING_CXXTEST=y

Build command used:

make V=1 APPDIR=/Users/aviralgarg/Everything/apps TOPDIR=/Users/aviralgarg/Everything/nuttx \
  CXX=g++-15 CC=gcc-15 LD=gcc-15

Before this patch

The build fails with the same issue reported:

.../include/c++/15/math.h:38:12: error: 'abs' has not been declared in 'std'
.../include/c++/15/math.h:39:12: error: 'acos' has not been declared in 'std'
.../include/c++/15/math.h:40:12: error: 'asin' has not been declared in 'std'
.../include/c++/15/math.h:41:12: error: 'atan' has not been declared in 'std'
.../include/c++/15/math.h:42:12: error: 'atan2' has not been declared in 'std'
...

After this patch:

Those std::abs/std::acos/... errors no longer occur in the app build log.

On my macOS simulator-host setup, the compile then stops later on separate host header conflicts (div_t, ldiv_t, putenv, dev_t, mode_t) caused by mixed Darwin and NuttX libc type declarations in this specific local environment.

So the remaining failure is a different host-side conflict.

@linguini1
Copy link
Copy Markdown
Contributor

Hi, please include the full build log.

@aviralgarg05
Copy link
Copy Markdown
Contributor Author

  • The originally reported failure (std::abs/std::acos/... not declared from <math.h>) is no longer present after this patch.
  • The build still stops later in my local macOS simulator-host setup due to a different, unrelated header/type conflict (div_t, ldiv_t, putenv, dev_t, mode_t) between Darwin and NuttX libc declarations.

Full log (before patch)

CXX:  cxxtest_main.cxx 
g++-15 -c "-g" -fomit-frame-pointer -fprofile-arcs -ftest-coverage -fno-inline -fno-common -fvisibility=hidden -ffunction-sections -fdata-sections -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas -std="gnu++17" -fno-exceptions -fcheck-new -fno-rtti -fno-pic -isystem /Users/aviralgarg/Everything/nuttx/include/cxx -isystem /Users/aviralgarg/Everything/nuttx/include -D__NuttX__ -DNDEBUG -U_AIX -U_WIN32 -U__APPLE__ -U__FreeBSD__ -U__NetBSD__ -U__linux__ -U__sun__ -U__unix__ -U__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__  -I "/Users/aviralgarg/Everything/apps/include"  -Dmain=cxxtest_main  cxxtest_main.cxx -o  cxxtest_main.cxx.Users.aviralgarg.Everything.apps.testing.cxx.cxxtest.o
In file included from cxxtest_main.cxx:11:
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:38:12: error: 'abs' has not been declared in 'std'
   38 | using std::abs;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:39:12: error: 'acos' has not been declared in 'std'
   39 | using std::acos;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:40:12: error: 'asin' has not been declared in 'std'
   40 | using std::asin;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:41:12: error: 'atan' has not been declared in 'std'
   41 | using std::atan;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:42:12: error: 'atan2' has not been declared in 'std'
   42 | using std::atan2;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:43:12: error: 'cos' has not been declared in 'std'
   43 | using std::cos;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:44:12: error: 'sin' has not been declared in 'std'
   44 | using std::sin;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:45:12: error: 'tan' has not been declared in 'std'
   45 | using std::tan;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:46:12: error: 'cosh' has not been declared in 'std'
   46 | using std::cosh;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:47:12: error: 'sinh' has not been declared in 'std'
   47 | using std::sinh;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:48:12: error: 'tanh' has not been declared in 'std'
   48 | using std::tanh;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:49:12: error: 'exp' has not been declared in 'std'
   49 | using std::exp;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:50:12: error: 'frexp' has not been declared in 'std'
   50 | using std::frexp;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:51:12: error: 'ldexp' has not been declared in 'std'
   51 | using std::ldexp;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:52:12: error: 'log' has not been declared in 'std'
   52 | using std::log;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:53:12: error: 'log10' has not been declared in 'std'
   53 | using std::log10;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:54:12: error: 'modf' has not been declared in 'std'
   54 | using std::modf;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:55:12: error: 'pow' has not been declared in 'std'
   55 | using std::pow;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:56:12: error: 'sqrt' has not been declared in 'std'
   56 | using std::sqrt;
      |            ^~~~
... (full log omitted here for brevity when pasted, but attach the raw file content)
make: *** [cxxtest_main.cxx.Users.aviralgarg.Everything.apps.testing.cxx.cxxtest.o] Error 1

Full log (after patch)

CXX:  cxxtest_main.cxx 
g++-15 -c "-g" -fomit-frame-pointer -fprofile-arcs -ftest-coverage -fno-inline -fno-common -fvisibility=hidden -ffunction-sections -fdata-sections -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas -std="gnu++17" -fno-exceptions -fcheck-new -fno-rtti -fno-pic -isystem /Users/aviralgarg/Everything/nuttx/include/cxx -isystem /Users/aviralgarg/Everything/nuttx/include -D__NuttX__ -DNDEBUG -U_AIX -U_WIN32 -U__APPLE__ -U__FreeBSD__ -U__NetBSD__ -U__linux__ -U__sun__ -U__unix__ -U__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__  -I "/Users/aviralgarg/Everything/apps/include"  -Dmain=cxxtest_main  cxxtest_main.cxx -o  cxxtest_main.cxx.Users.aviralgarg.Everything.apps.testing.cxx.cxxtest.o
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/stdlib.h:58,
                 from /opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/bits/std_abs.h:44,
                 from /opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/cmath:59,
                 from /Users/aviralgarg/Everything/nuttx/include/cxx/cmath:38,
                 from /opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:36,
                 from cxxtest_main.cxx:11:
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/_stdlib.h:105:3: error: conflicting declaration 'typedef struct div_t div_t'
  105 | } div_t;
      |   ^~~~~
... (remaining Darwin/NuttX type conflicts)
make: *** [cxxtest_main.cxx.Users.aviralgarg.Everything.apps.testing.cxx.cxxtest.o] Error 1

@linguini1
Copy link
Copy Markdown
Contributor

@aviralgarg05 these are still not the full logs.

@aviralgarg05
Copy link
Copy Markdown
Contributor Author

aviralgarg05 commented Feb 25, 2026

Full build log

CXX:  cxxtest_main.cxx 
g++-15 -c "-g" -fomit-frame-pointer -fprofile-arcs -ftest-coverage -fno-inline -fno-common -fvisibility=hidden -ffunction-sections -fdata-sections -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas -std="gnu++17" -fno-exceptions -fcheck-new -fno-rtti -fno-pic -isystem /Users/aviralgarg/Everything/nuttx/include/cxx -isystem /Users/aviralgarg/Everything/nuttx/include -D__NuttX__ -DNDEBUG -U_AIX -U_WIN32 -U__APPLE__ -U__FreeBSD__ -U__NetBSD__ -U__linux__ -U__sun__ -U__unix__ -U__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__  -I "/Users/aviralgarg/Everything/apps/include"  -Dmain=cxxtest_main  cxxtest_main.cxx -o  cxxtest_main.cxx.Users.aviralgarg.Everything.apps.testing.cxx.cxxtest.o
In file included from cxxtest_main.cxx:11:
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:38:12: error: 'abs' has not been declared in 'std'
   38 | using std::abs;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:39:12: error: 'acos' has not been declared in 'std'
   39 | using std::acos;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:40:12: error: 'asin' has not been declared in 'std'
   40 | using std::asin;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:41:12: error: 'atan' has not been declared in 'std'
   41 | using std::atan;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:42:12: error: 'atan2' has not been declared in 'std'
   42 | using std::atan2;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:43:12: error: 'cos' has not been declared in 'std'
   43 | using std::cos;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:44:12: error: 'sin' has not been declared in 'std'
   44 | using std::sin;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:45:12: error: 'tan' has not been declared in 'std'
   45 | using std::tan;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:46:12: error: 'cosh' has not been declared in 'std'
   46 | using std::cosh;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:47:12: error: 'sinh' has not been declared in 'std'
   47 | using std::sinh;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:48:12: error: 'tanh' has not been declared in 'std'
   48 | using std::tanh;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:49:12: error: 'exp' has not been declared in 'std'
   49 | using std::exp;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:50:12: error: 'frexp' has not been declared in 'std'
   50 | using std::frexp;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:51:12: error: 'ldexp' has not been declared in 'std'
   51 | using std::ldexp;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:52:12: error: 'log' has not been declared in 'std'
   52 | using std::log;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:53:12: error: 'log10' has not been declared in 'std'
   53 | using std::log10;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:54:12: error: 'modf' has not been declared in 'std'
   54 | using std::modf;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:55:12: error: 'pow' has not been declared in 'std'
   55 | using std::pow;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:56:12: error: 'sqrt' has not been declared in 'std'
   56 | using std::sqrt;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:57:12: error: 'ceil' has not been declared in 'std'
   57 | using std::ceil;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:58:12: error: 'fabs' has not been declared in 'std'
   58 | using std::fabs;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:59:12: error: 'floor' has not been declared in 'std'
   59 | using std::floor;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:60:12: error: 'fmod' has not been declared in 'std'
   60 | using std::fmod;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:63:12: error: 'fpclassify' has not been declared in 'std'
   63 | using std::fpclassify;
      |            ^~~~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:64:12: error: 'isfinite' has not been declared in 'std'
   64 | using std::isfinite;
      |            ^~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:65:12: error: 'isinf' has not been declared in 'std'
   65 | using std::isinf;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:66:12: error: 'isnan' has not been declared in 'std'
   66 | using std::isnan;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:67:12: error: 'isnormal' has not been declared in 'std'
   67 | using std::isnormal;
      |            ^~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:68:12: error: 'signbit' has not been declared in 'std'
   68 | using std::signbit;
      |            ^~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:69:12: error: 'isgreater' has not been declared in 'std'
   69 | using std::isgreater;
      |            ^~~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:70:12: error: 'isgreaterequal' has not been declared in 'std'
   70 | using std::isgreaterequal;
      |            ^~~~~~~~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:71:12: error: 'isless' has not been declared in 'std'
   71 | using std::isless;
      |            ^~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:72:12: error: 'islessequal' has not been declared in 'std'
   72 | using std::islessequal;
      |            ^~~~~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:73:12: error: 'islessgreater' has not been declared in 'std'
   73 | using std::islessgreater;
      |            ^~~~~~~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:74:12: error: 'isunordered' has not been declared in 'std'
   74 | using std::isunordered;
      |            ^~~~~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:78:12: error: 'acosh' has not been declared in 'std'
   78 | using std::acosh;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:79:12: error: 'asinh' has not been declared in 'std'
   79 | using std::asinh;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:80:12: error: 'atanh' has not been declared in 'std'
   80 | using std::atanh;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:81:12: error: 'cbrt' has not been declared in 'std'
   81 | using std::cbrt;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:82:12: error: 'copysign' has not been declared in 'std'
   82 | using std::copysign;
      |            ^~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:83:12: error: 'erf' has not been declared in 'std'
   83 | using std::erf;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:84:12: error: 'erfc' has not been declared in 'std'
   84 | using std::erfc;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:85:12: error: 'exp2' has not been declared in 'std'
   85 | using std::exp2;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:86:12: error: 'expm1' has not been declared in 'std'
   86 | using std::expm1;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:87:12: error: 'fdim' has not been declared in 'std'
   87 | using std::fdim;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:88:12: error: 'fma' has not been declared in 'std'
   88 | using std::fma;
      |            ^~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:89:12: error: 'fmax' has not been declared in 'std'
   89 | using std::fmax;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:90:12: error: 'fmin' has not been declared in 'std'
   90 | using std::fmin;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:91:12: error: 'hypot' has not been declared in 'std'
   91 | using std::hypot;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:92:12: error: 'ilogb' has not been declared in 'std'
   92 | using std::ilogb;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:93:12: error: 'lgamma' has not been declared in 'std'
   93 | using std::lgamma;
      |            ^~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:94:12: error: 'llrint' has not been declared in 'std'
   94 | using std::llrint;
      |            ^~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:95:12: error: 'llround' has not been declared in 'std'
   95 | using std::llround;
      |            ^~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:96:12: error: 'log1p' has not been declared in 'std'
   96 | using std::log1p;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:97:12: error: 'log2' has not been declared in 'std'
   97 | using std::log2;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:98:12: error: 'logb' has not been declared in 'std'
   98 | using std::logb;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:99:12: error: 'lrint' has not been declared in 'std'
   99 | using std::lrint;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:100:12: error: 'lround' has not been declared in 'std'
  100 | using std::lround;
      |            ^~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:101:12: error: 'nearbyint' has not been declared in 'std'
  101 | using std::nearbyint;
      |            ^~~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:102:12: error: 'nextafter' has not been declared in 'std'
  102 | using std::nextafter;
      |            ^~~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:103:12: error: 'nexttoward' has not been declared in 'std'
  103 | using std::nexttoward;
      |            ^~~~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:104:12: error: 'remainder' has not been declared in 'std'
  104 | using std::remainder;
      |            ^~~~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:105:12: error: 'remquo' has not been declared in 'std'
  105 | using std::remquo;
      |            ^~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:106:12: error: 'rint' has not been declared in 'std'
  106 | using std::rint;
      |            ^~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:107:12: error: 'round' has not been declared in 'std'
  107 | using std::round;
      |            ^~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:108:12: error: 'scalbln' has not been declared in 'std'
  108 | using std::scalbln;
      |            ^~~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:109:12: error: 'scalbn' has not been declared in 'std'
  109 | using std::scalbn;
      |            ^~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:110:12: error: 'tgamma' has not been declared in 'std'
  110 | using std::tgamma;
      |            ^~~~~~
/opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:111:12: error: 'trunc' has not been declared in 'std'
  111 | using std::trunc;
      |            ^~~~~
make: *** [cxxtest_main.cxx.Users.aviralgarg.Everything.apps.testing.cxx.cxxtest.o] Error 1

Full build log

CXX:  cxxtest_main.cxx 
g++-15 -c "-g" -fomit-frame-pointer -fprofile-arcs -ftest-coverage -fno-inline -fno-common -fvisibility=hidden -ffunction-sections -fdata-sections -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas -std="gnu++17" -fno-exceptions -fcheck-new -fno-rtti -fno-pic -isystem /Users/aviralgarg/Everything/nuttx/include/cxx -isystem /Users/aviralgarg/Everything/nuttx/include -D__NuttX__ -DNDEBUG -U_AIX -U_WIN32 -U__APPLE__ -U__FreeBSD__ -U__NetBSD__ -U__linux__ -U__sun__ -U__unix__ -U__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__  -I "/Users/aviralgarg/Everything/apps/include"  -Dmain=cxxtest_main  cxxtest_main.cxx -o  cxxtest_main.cxx.Users.aviralgarg.Everything.apps.testing.cxx.cxxtest.o
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/stdlib.h:58,
                 from /opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/bits/std_abs.h:44,
                 from /opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/cmath:59,
                 from /Users/aviralgarg/Everything/nuttx/include/cxx/cmath:38,
                 from /opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/math.h:36,
                 from cxxtest_main.cxx:11:
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/_stdlib.h:105:3: error: conflicting declaration 'typedef struct div_t div_t'
  105 | } div_t;
      |   ^~~~~
In file included from /Users/aviralgarg/Everything/nuttx/include/nuttx/kmalloc.h:34,
                 from /Users/aviralgarg/Everything/nuttx/include/nuttx/lib/lib.h:32,
                 from /Users/aviralgarg/Everything/nuttx/include/stdio.h:37,
                 from cxxtest_main.cxx:3:
/Users/aviralgarg/Everything/nuttx/include/stdlib.h:98:22: note: previous declaration as 'typedef struct div_s div_t'
   98 | typedef struct div_s div_t;
      |                      ^~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/_stdlib.h:110:3: error: conflicting declaration 'typedef struct ldiv_t ldiv_t'
  110 | } ldiv_t;
      |   ^~~~~~
/Users/aviralgarg/Everything/nuttx/include/stdlib.h:108:23: note: previous declaration as 'typedef struct ldiv_s ldiv_t'
  108 | typedef struct ldiv_s ldiv_t;
      |                       ^~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/_stdlib.h:116:3: error: conflicting declaration 'typedef struct lldiv_t lldiv_t'
  116 | } lldiv_t;
      |   ^~~~~~~
/Users/aviralgarg/Everything/nuttx/include/stdlib.h:118:24: note: previous declaration as 'typedef struct lldiv_s lldiv_t'
  118 | typedef struct lldiv_s lldiv_t;
      |                        ^~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/_stdlib.h:249:10: error: conflicting declaration of C function 'int putenv(char*)'
  249 | int      putenv(char *_LIBC_CSTR) __DARWIN_ALIAS(putenv);
      |          ^~~~~~
/Users/aviralgarg/Everything/nuttx/include/stdlib.h:162:11: note: previous declaration 'int putenv(const char*)'
  162 | int       putenv(FAR const char *string);
      |           ^~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/_stdlib.h:282:
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/sys/_types/_dev_t.h:31:31: error: conflicting declaration 'typedef __darwin_dev_t dev_t'
   31 | typedef __darwin_dev_t        dev_t;    /* device number */
      |                               ^~~~~
In file included from /Users/aviralgarg/Everything/nuttx/include/stddef.h:30,
                 from cxxtest_main.cxx:2:
/Users/aviralgarg/Everything/nuttx/include/sys/types.h:150:22: note: previous declaration as 'typedef uint32_t dev_t'
  150 | typedef uint32_t     dev_t;
      |                      ^~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/_stdlib.h:283:
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/sys/_types/_mode_t.h:31:33: error: conflicting declaration 'typedef __darwin_mode_t mode_t'
   31 | typedef __darwin_mode_t         mode_t;
      |                                 ^~~~~~
/Users/aviralgarg/Everything/nuttx/include/sys/types.h:110:22: note: previous declaration as 'typedef unsigned int mode_t'
  110 | typedef unsigned int mode_t;
      |                      ^~~~~~
make: *** [cxxtest_main.cxx.Users.aviralgarg.Everything.apps.testing.cxx.cxxtest.o] Error 1

@linguini1 linguini1 dismissed their stale review February 25, 2026 17:44

Full logs provided.

@xiaoxiang781216 xiaoxiang781216 merged commit 2820444 into apache:master Feb 26, 2026
52 of 77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] cmath incompatible with external toolchain libraries

5 participants