freakishness opened a new pull request, #22595:
URL: https://github.com/apache/nuttx/pull/22595

   ## Summary
   
     * An MSYS2 MinGW/UCRT shell is reported by CMake as a Windows host, so
       it was treated as a native cmd.exe build.  Detect it through the
       MSYSTEM environment variable and select the MSYS host path in
       `nuttx_sethost.cmake`, `tools/CMakeLists.txt` and `menuconfig.cmake`.
     * The host tools (`incdir`, `mkpasswd`) link the Windows C library,
       which lacks `uname()`, `getrandom()` and `/dev/urandom`.  Take the
       Windows path when `__MINGW32__` is defined, not only when
       `CONFIG_WINDOWS_NATIVE` is set; `mkpasswd` fills the salt with
       `rand_s()` (`_CRT_RAND_S`).
     * On Windows the build copied directories instead of linking them, so
       editing a copied file (for example `board.h`) did not reach the build
       until the next configure.  `nuttx_create_symlink` now tries a symbolic
       link on every host and copies only when it cannot be created, and a
       one-shot probe warns a Windows user to enable Developer Mode.
     * No related NuttX or NuttX Apps issue/PR.
   
   ## Impact
   
     * Is new feature added? NO: bug fix for the CMake build on MSYS2.
     * Impact on user (will user need to adapt to change)? NO.
     * Impact on build (will build process change)? YES: on MSYS2 hosts the
       CMake build now identifies `WINDOWS_MSYS`, uses `menuconfig` instead of
       `guiconfig`, and links the build tree instead of copying it.  On a
       Windows host without symbolic-link support the build still copies and
       now prints a warning.
     * Impact on hardware (will arch(s) / board(s) / driver(s) change)? NO.
     * Impact on documentation (is update required / provided)? NO.  The
       `sethost.sh` page describes the Make flow, which this does not touch.
     * Impact on security (any sort of implications)? NO.
     * Impact on compatibility (backward/forward/interoperability)? NO.
     * Anything else to consider or add? The `incdir`/`mkpasswd` change also
       helps a Make build under MSYS2, since it keys off `__MINGW32__`.
   
   ## Testing
   
     I confirm that changes are verified on local setup and works as intended:
   
     * Build Host(s): Windows 11 (build 26300), x64, MSYS2 UCRT64, GCC
       16.2.0 (host `cc` and `arm-none-eabi-gcc`), CMake 4.5.1, Ninja 1.13.2.
     * Target(s): host tools subproject (`bin_host`) and
       `n32h765zil7_stb:nsh` (ARM Cortex-M7).
   
     Testing logs before change:
   
   <img width="742" height="885" alt="图片" 
src="https://github.com/user-attachments/assets/de00a71f-eea5-430e-9d23-ecedc66e0412";
 />
   
     Testing logs after change:
   
     Configuration, MSYS2 shell (host selection and symlink probe):
   
     ```
       Select HOST_WINDOWS=y
       Select WINDOWS_MSYS=y
     ...
        HOST = WINDOWS MSYS
     ```
   <img width="743" height="893" alt="图片" 
src="https://github.com/user-attachments/assets/f7c7dfd8-62d6-4631-9d16-42957d7bc51e";
 />
   
     Build tree links instead of copies (real symbolic link):
   
   <img width="1180" height="602" alt="图片" 
src="https://github.com/user-attachments/assets/98a765cc-b33b-4b1c-a27b-51c396a46d80";
 />
   
     Not tested:
     * The full `nuttx` image does not link on this branch: an earlier
       unrelated commit in the branch leaves merge-conflict markers in
       `arch/arm/src/n32h7/CMakeLists.txt:86`, so CMake parsing stops there.
       This change does not touch that file; the host tools built and the
       configuration above completed.
     * A Windows host without symbolic-link support (the warning path was not
       exercised); only the link-available path was run.
     * Make-based build under MSYS2.
   
   ## PR verification Self-Check
   
     * [ ] This PR introduces only one functional change.
     * [x] I have updated all required description fields above.
     * [x] My PR adheres to Contributing Guidelines and Documentation (git
           commit title and message, coding standard, etc).
     * [ ] My PR is still work in progress (not ready for review).
     * [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]

Reply via email to