Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error - raspberrypi-pico-w:nsh #15966

Open
1 task done
phasianus opened this issue Mar 10, 2025 · 1 comment
Open
1 task done

Build error - raspberrypi-pico-w:nsh #15966

phasianus opened this issue Mar 10, 2025 · 1 comment
Labels
Arch: arm Issues related to ARM (32-bit) architecture Area: Build system OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working

Comments

@phasianus
Copy link

Description / Steps to reproduce the issue

Following steps: https://nuttx.apache.org/docs/latest/platforms/arm/rp2040/boards/raspberrypi-pico-w/index.html
Ends with error:

/home/pb/nuttxspace/nuttx/tools/mkdeps --obj-path bin --obj-suffix .o --dep-path assert --dep-path builtin --dep-path ctype --dep-path dirent --dep-path dlfcn --dep-path errno --dep-path fixedmath --dep-path grp --dep-path inttypes --dep-path libgen --dep-path machine/arm/armv6-m --dep-path machine/arm/gnu --dep-path machine/arm --dep-path machine --dep-path misc --dep-path net --dep-path obstack --dep-path pthread --dep-path pwd --dep-path queue --dep-path sched --dep-path search --dep-path semaphore --dep-path signal --dep-path spawn --dep-path stdio --dep-path stdlib --dep-path stream --dep-path string --dep-path symtab --dep-path syslog --dep-path termios --dep-path time --dep-path tls --dep-path uio --dep-path unistd --dep-path uuid --dep-path wchar --dep-path wctype "arm-none-eabi-gcc" -- -Wstrict-prototypes -Wno-attributes -Wno-unknown-pragmas -Wno-psabi -Os -fno-strict-aliasing -fomit-frame-pointer --param=min-pagesize=0 -fno-common -Wall -Wshadow -Wundef -ffunction-sections -fdata-sections "-g" -mlittle-endian  -mcpu=cortex-m0 -mthumb -mfloat-abi=soft -mthumb -Wa,-mthumb -Wa,-mimplicit-it=always -isystem /home/pb/nuttxspace/nuttx/include -D__NuttX__ -DNDEBUG -D__KERNEL__  -I /home/pb/nuttxspace/nuttx/libs/libc -- stdlib/lib_strtold.c > lib_strtold.ddc
./stdlib/lib_strtold.c:42:10: fatal error: math.h: No such file or directory
   42 | #include <math.h>
      |          ^~~~~~~~
compilation terminated.
ERROR: arm-none-eabi-gcc failed: 1
       command: arm-none-eabi-gcc -MT bin/lib_strtold.o  -M '-Wstrict-prototypes' '-Wno-attributes' '-Wno-unknown-pragmas' '-Wno-psabi' '-Os' '-fno-strict-aliasing' '-fomit-frame-pointer' '--param=min-pagesize=0' '-fno-common' '-Wall' '-Wshadow' '-Wundef' '-ffunction-sections' '-fdata-sections' '-g' '-mlittle-endian' '-mcpu=cortex-m0' '-mthumb' '-mfloat-abi=soft' '-mthumb' '-Wa,-mthumb' '-Wa,-mimplicit-it=always' '-isystem' '/home/pb/nuttxspace/nuttx/include' '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-I' '/home/pb/nuttxspace/nuttx/libs/libc' ./stdlib/lib_strtold.c
make[2]: *** [/home/pb/nuttxspace/nuttx/tools/Config.mk:232: lib_strtold.ddc] Error 1
make[2]: Leaving directory '/home/pb/nuttxspace/nuttx/libs/libc'
make[1]: *** [Makefile:202: .depend] Error 2
make[1]: Leaving directory '/home/pb/nuttxspace/nuttx/libs/libc'
make: *** [tools/Unix.mk:660: pass2dep] Error 2 

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Fedora 41

NuttX Version

commit fa5590d

Issue Architecture

[Arch: arm]

Issue Area

[Area: Build System]

Host information

No response

Verification

  • I have verified before submitting the report.
@phasianus phasianus added the Type: Bug Something isn't working label Mar 10, 2025
@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture Area: Build system OS: Linux Issues related to Linux (building system, etc) labels Mar 10, 2025
@ppisa
Copy link
Contributor

ppisa commented Mar 10, 2025

NuttX allows to select multiple option for math library (LIBM) and availability of thee options depends on the actual target and used toolchain. I expect that you have used ./tools/configure.sh raspberrypi-pico-w:nsh for configuration. This configuration does not specify exact LIBM and Kconfig default choice is LIBM_TOOLCHAIN , see libs/libm/Kconfig which is usually the best matching and the most performant library. You do not write which toolchain have you used. On Linux distribution, you usually need to install NewLib or its nano, pico variants separately. I ma not sure how it should be done in the specific case, I have usually my own toolchains setups and their customization.

The problem can be resolved for the most architectures to switch to NuttX provided LIBM, it can be suboptimal, but it is present directly in NuttX sources. Run make menuconfig or make qconfig and select

  • Math library from NuttX (LIBM)

in

"Library Routines" -> "Standard C Library Options"

The other options are

  • Math library from toolchain (LIBM_TOOLCHAIN)
  • Math library from Newlib (LIBM_NEWLIB)
  • No math library (LIBM_NONE)
  • Math library from openlibm (LIBM_OPENLIBM)

It would worth to add some suggestion about toolchain to use into given platform page in the manual.

May it be it should go into common RaspberryPi rp2040 install section and use of the internal LIBM shoudl be mentioned as workaround. It could be quite slow because RPi1 Cortex-M0+ processor is quite obscure and performance can be used by some integer math accelerator peripherals and if float and double support functions can be written with its existence in mind, may it be even in assembly, than it can be much faster in some SD specific library...

The corresponding document source (where some clarification can be added) is Documentation/platforms/arm/rp2040.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: arm Issues related to ARM (32-bit) architecture Area: Build system OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants