apache / apache/nuttx

[BUG] error in building add_subdirectory for nuttx

Open
#19,697 6 comments 0 reactions 0 assignees View on GitHub
Arch: simulator Area: Build system OS: Linux Type: Bug
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

### Description / Steps to reproduce the issue

For the convenience of project expansion, I placed nuttx in a third-party library and set it in the following directory `~/dev/proj/third_party/nuttx`. When I imported nuttx into the main project's CMakeLists.txt through `add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/third_party/nuttx")` to build, I found an error. The command is `cd ~/dev/proj && cmake -B build -DBOARD_CONFIG=/home/ubuntu/dev/proj/third_party/nuttx/boards/sim/sim/sim/configs/nsh`. It may be a problem with your path handling, such as fixed writing, etc. For example, your build directory is `~/dev/proj/build`, and the 375th line of your CMakeLists.txt is written as `set(ENV{KCONFIG_CONFIG} ${CMAKE_BINARY_DIR}/.config)`, which should be `CMAKE_CURRENT_BINARY_DIR`. Most projects can be built through `add_subdirectory`, I hope you can fix it. Thank you.

### On which OS does this issue occur?

[OS: Linux]

### What is the version of your OS?

24.04.1-Ubuntu

### NuttX Version

7fc26f

### Issue Architecture

[Arch: simulator]

### Issue Area

[Area: Build System]

### Host information

_No response_

### Verification

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

Contributor guide

Open the contributing guide

Research direction

Start with the top-level CMakeLists.txt, especially the reported line 375 setting KCONFIG_CONFIG, and reproduce the issue with the provided cmake -B build command and BOARD_CONFIG path. Trace how binary directories are selected when NuttX is added with add_subdirectory. Done means the nested build completes with the simulator configuration and does not place generated configuration files in the parent build directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.