nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

[BUG] Apps program name cannot include "-"

Open acassis opened this issue 4 months ago • 2 comments

Description / Steps to reproduce the issue

If we rename hello to hello-world: Image

the build will fail:

In file included from builtin_list.c:34:
builtin_proto.h:6:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘-’ token
    6 | int hello-world_main(int argc, char *argv[]);
      |          ^
In file included from builtin_list.c:50:
builtin_list.h:6:29: error: ‘hello’ undeclared here (not in a function)
    6 | { "hello-world", 100, 2048, hello-world_main },
      |                             ^~~~~
builtin_list.h:6:35: error: ‘world_main’ undeclared here (not in a function); did you mean ‘dd_main’?
    6 | { "hello-world", 100, 2048, hello-world_main },
      |                                   ^~~~~~~~~~
      |                                   dd_main
make[2]: *** [/home/alan/nuttxspace/apps/Application.mk:239: builtin_list.c.home.alan.nuttxspace.apps.builtin.o] Error 1
make[2]: *** Waiting for unfinished jobs....
<command-line>: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘-’ token
hello_main.c:38:5: note: in expansion of macro ‘main’
   38 | int main(int argc, FAR char *argv[])
      |     ^~~~

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Ubuntu 24.04

NuttX Version

mainline

Issue Architecture

[Arch: all]

Issue Area

[Area: Other]

Host information

No response

Verification

  • [x] I have verified before submitting the report.

acassis avatar Jul 15 '26 17:07 acassis

Hi, I'd like to work on this. I looked into the issue and it seems to come from Application.mk in apache/nuttx-apps. I'm testing a fix that replaces - with _ only when generating the C symbol, while keeping the original app name unchanged for the builtin registration and the NSH command. If this approach looks good, I will open a PR once I've verified the fix locally.

ML-dev-crypto avatar Jul 16 '26 10:07 ML-dev-crypto

@ML-dev-crypto thank you! @simbit18 does CMake also has this issue?

acassis avatar Jul 16 '26 11:07 acassis