toku-mac opened a new pull request, #18957:
URL: https://github.com/apache/nuttx/pull/18957
## Summary
Set host-specific Kconfig values before the initial `olddefconfig` step in
the CMake build, and clarify the helper arguments used for that setup.
On macOS, `sim:nsh` needs `HOST_MACOS=y` to be present before the sim
toolchain choice is resolved. Without that, the first `olddefconfig` may select
the default GCC toolchain instead of the macOS-specific Clang default.
As a result, you encounter the error `ld: library not found for -lgcov`.
This PR updates the CMake initialization flow so `nuttx_sethost()` can apply
host settings to the temporary `.config.compressed` before the first
`olddefconfig`.
The helper functions were also refactored to use named arguments:
```cmake
nuttx_sethost(CONFIG_FILE ...)
nuttx_setconfig(CONFIG_FILE ... SETTINGS ...)
```
## Impact
`CONFIG_SIM_TOOLCHAIN_CLANG=y` is enabled, which resolves linker errors.
## Testing
I confirm that changes are verified on local setup and works as intended:
* Build Host(s): OS (macOS 26.5), CPU(Apple M1), compiler(Apple clang
version 21.0.0)
* Target(s): arch(sim)
* Ensure your PATH environment variable is properly configured to allow
execution of: menuconfig, olddefconfig, savedefconfig, and setconfig.
* Use the Rust toolchain version prior to nightly-2026-04-29 to avoid errors
related to
lib/rustlib/src/rust/library/std/src/sys/net/connection/socket/unix.rs.
Configuration:
```
rm -rf build-debug
make distclean
cmake -S . -B build-debug -DBOARD_CONFIG=sim:nsh -GNinja
printf "CONFIG_SYSTEM_TIME64=y
CONFIG_FS_LARGEFILE=y
CONFIG_TLS_NELEM=16
CONFIG_DEV_URANDOM=y
CONFIG_EXAMPLES_HELLO_RUST_CARGO=y
CONFIG_EXAMPLES_HELLO_RUST_CARGO_STACKSIZE=8192
" >> build-debug/.config
cmake --build build-debug -t olddefconfig
```
Testing logs before change:
```
...
Compiling proc_macro v0.0.0
(/Users/toku/.rustup/toolchains/nightly-2026-04-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/proc_macro)
Compiling itoa v1.0.18
Compiling pin-project-lite v0.2.17
Compiling memchr v2.8.0
Compiling tokio v1.52.3
Compiling hello v0.1.0 (/Users/toku/nuttxspace/apps/examples/rust/hello)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 21.46s
[1224/1229] Linking C executable nuttx
FAILED: [code=1] nuttx
: && /usr/bin/cc -arch arm64 -Wl,-search_paths_first
-Wl,-headerpad_max_install_names -Wl,-dead_strip
-Wl,-ld_classic,-no_fixup_chains @CMakeFiles/nuttx.rsp -o nuttx && :
ld: warning: -ld_classic is deprecated and will be removed in a future
release
ld: library not found for -lgcov
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
ninja: build stopped: subcommand failed.
```
Testing logs after change:
```
...
Compiling proc_macro v0.0.0
(/Users/toku/.rustup/toolchains/nightly-2026-04-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/proc_macro)
Compiling itoa v1.0.18
Compiling pin-project-lite v0.2.17
Compiling memchr v2.8.0
Compiling tokio v1.52.3
Compiling hello v0.1.0 (/Users/toku/nuttxspace/apps/examples/rust/hello)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 21.63s
[1222/1227] Linking C executable nuttx
ld: warning: -ld_classic is deprecated and will be removed in a future
release
[1224/1227] Generating System.map
```
## PR verification Self-Check
* [x] My PR adheres to Contributing
[Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md) and
[Documentation](https://nuttx.apache.org/docs/latest/contributing/index.html)
(git commit title and message, coding standard, etc).
* [x] My PR is ready for review and can be safely merged into a codebase.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]