tmedicci opened a new issue, #15721: URL: https://github.com/apache/nuttx/issues/15721
### Description / Steps to reproduce the issue ## The Error While trying to build Python with `system` function during the [`pass2dep`](https://github.com/apache/incubator-nuttx/blob/5e2fc181c2d7a577c3d056084b507e6e090f9d90/tools/Unix.mk#L659) phase, it triggers the following warning (that may be treated as an error): ``` /home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/apps/interpreters/python/Python/Modules/posixmodule.c:6026:14: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration] 6026 | result = system(bytes); ``` Although the source includes [`stdlib.h`](https://github.com/apache/incubator-nuttx/blob/32784b08981b854881254f0a10c03a8bafea385b/include/stdlib.h), it fails because `__KERNEL__` is defined and, thus, the `system` [prototype](https://github.com/apache/incubator-nuttx/blob/32784b08981b854881254f0a10c03a8bafea385b/include/stdlib.h#L186) is not defined. ## Why? There is a "trap" here: `__KERNEL__` (with `$(KDEFINE)`) is defined in the following snippet: ``` pass2dep: context tools/mkdeps$(HOSTEXEEXT) tools/cnvwindeps$(HOSTEXEEXT) $(Q) for dir in $(KERNDEPDIRS) ; do \ $(MAKE) -C $$dir EXTRAFLAGS="$(KDEFINE) $(EXTRAFLAGS)" depend || exit; \ done ``` `$(KERNDEPDIRS)` includes the `$(APPDIR)` folder [here](https://github.com/apache/incubator-nuttx/blob/e3917e2f09c9442d372591746fcb5d9389431b29/tools/Directories.mk#L52) for flat build: ``` ifeq ($(CONFIG_BUILD_PROTECTED),y) USERDEPDIRS += $(APPDIR) else ifneq ($(CONFIG_BUILD_KERNEL),y) KERNDEPDIRS += $(APPDIR) else CLEANDIRS += $(APPDIR) endif ``` ## Proposed Fixes We should either 1) remove `$(APPDIR)` from `$(KERNDEPDIRS)` (adding it to `$(USERDEPDIRS)` for both PROTECTED and FLAT BUILD or 2) define the prototype at `nuttx/include/stdlib.h` with the following if clause (which particularly I prefer): ``` #if !defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT) int system(FAR const char *cmd); #endif ``` Any thoughts about it? ### On which OS does this issue occur? [OS: Linux] ### What is the version of your OS? Manjaro ### NuttX Version master ### Issue Architecture [Arch: all] ### Issue Area [Area: Kernel] ### Host information _No response_ ### Verification - [x] I have verified before submitting the report. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org