toku-mac opened a new pull request, #19058:
URL: https://github.com/apache/nuttx/pull/19058

   ## Summary
   
   Enable building and running Rust applications on the NuttX simulator on 
Intel (x86_64) macOS.
   Previously only aarch64 macOS was supported for the Rust sim; x86_64 macOS 
hosts failed to select a usable Rust target.
   
   ## Testing
   
   I confirm that changes are verified on local setup and works as intended:
   * Build Host(s): OS (macOS 14.8), CPU(Intel Core i7), compiler(Apple clang 
version 16.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.
   * Related to pull requests on the apps side: apps/tools: Enable Rust sim 
builds on Intel Macs
   
   Configuration and Build:
   
   ### with make
   
   ```
   make distclean
   ./tools/configure.sh sim:nsh
   make menuconfig
   # Quit using the `Q` command.
   
   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
   ' >> .config
   
   make olddefconfig
   make
   
   ...
      Compiling hello v0.1.0 (/Users/toku/nuttxspace/apps/examples/rust/hello)
       Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 13s
   LN: platform/board to /Users/toku/nuttxspace/apps/platform/dummy
   Register: gpio
   Register: hello
   Register: hello_rust_cargo
   Register: dd
   Register: dumpstack
   Register: nsh
   Register: sh
   Register: ostest
   CP:  /Users/toku/nuttxspace/nuttx/include/nuttx/config.h
   CP:  /Users/toku/nuttxspace/nuttx/include/nuttx/fs/hostfs.h
   Building Rust code with cargo...
       Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.38s
   LD:  nuttx
   ld: warning: -ld_classic is deprecated and will be removed in a future 
release
   ld: warning: -ld_classic is deprecated and will be removed in a future 
release
   ```
   
   ### with CMake
   
   ```
   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
   cmake --build build-debug
   
   ...
      Compiling pin-project-lite v0.2.17
      Compiling memchr v2.8.1
      Compiling itoa v1.0.18
      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 51.20s
   [1225/1230] Linking C executable nuttx
   ld: warning: -ld_classic is deprecated and will be removed in a future 
release
   [1227/1230] Patching Mach-O init section type flags
   ```
   
   Execute:
   
   ```
   NuttShell (NSH) NuttX-12.13.0
   nsh> help
   help usage:  help [-v] [<cmd>]
   
       .           cmp         false       mkfifo      readlink    time
       [           dirname     fdinfo      mkrd        rm          true
       ?           date        free        mount       rmdir       truncate
       alias       df          help        mv          set         uname
       unalias     dmesg       hexdump     pidof       kill        umount
       basename    echo        losetup     poweroff    pkill       unset
       break       env         ln          quit        sleep       uptime
       cat         exec        ls          printf      usleep      watch
       cd          exit        mkdir       ps          source      xd
       cp          expr        mkfatfs     pwd         test        wait
   
   Builtin Apps:
       dd                  nsh                 ostest              hello
       dumpstack           sh                  gpio                
hello_rust_cargo
   nsh> uname -a
   NuttX 12.13.0 7ca5774b97 Jun  8 2026 13:16:51 sim sim
   nsh> hello_rust_cargo
   {"name":"John","age":30}
   {"name":"Jane","age":25}
   Deserialized: Alice is 28 years old
   Pretty JSON:
   {
     "name": "Alice",
     "age": 28
   }
   Hello world from tokio!
   ```
   
   ## 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]

Reply via email to