Native MacOS hello world#10309
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new PlatformIO environment to build and run the Portduino-native meshtasticd on macOS (Darwin), primarily for simulator (-s) workflows, with a set of compatibility tweaks to avoid Linux-only headers/APIs and Clang-specific compile issues.
Changes:
- Introduces a
native-macosPlatformIO env and refactors shared vs Linux-only Portduino build flags. - Gates Linux-only input/Bluetooth/GPIO codepaths and switches Portduino RNG to
arc4random_buf()on non-Linux hosts. - Makes small portability fixes (header includes, type aliases, enum sentinel handling) to compile under Apple Clang.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| variants/native/portduino/platformio.ini | Adds env:native-macos with macOS-specific build flags/src filters and lib ignores |
| variants/native/portduino.ini | Pins updated platform-native and splits build flags into common vs Linux-only |
| src/platform/portduino/USBHal.h | Portability include + namespace-qualified strncpy usage |
| src/platform/portduino/PortduinoGlue.cpp | Wraps Linux-only includes and MAC derivation via BlueZ with PORTDUINO_LINUX_HARDWARE guards |
| src/mqtt/MQTT.cpp | Switches IPAddress include form for compatibility |
| src/mesh/RadioLibInterface.h | Replaces ulong with unsigned long in receiveDetected signature |
| src/mesh/RadioLibInterface.cpp | Matches receiveDetected signature change |
| src/mesh/MeshRadio.h | Changes modem-preset sentinel to static const to avoid invalid constexpr on newer Clang |
| src/mesh/HardwareRNG.cpp | Uses getrandom() on Linux, arc4random_buf() on Darwin/BSD for Portduino RNG |
| src/input/LinuxInputImpl.h | Restricts evdev implementation to Linux Portduino builds |
| src/input/LinuxInput.h | Restricts evdev input to Linux Portduino builds and documents why |
| src/input/InputBroker.cpp | Only instantiates LinuxInputImpl on Linux hosts |
| src/RedirectablePrint.h | Adjusts Print.h include style for portability |
| src/Power.cpp | Only de-inits Linux input implementation on Linux during Portduino reboot |
| bin/build-native.sh | Names release artifact by OS + arch (e.g., meshtasticd_darwin_arm64) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jp-bennett
approved these changes
Apr 27, 2026
jp-bennett
left a comment
Collaborator
There was a problem hiding this comment.
Does not break Linux builds, so looks good to me!
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/e5647919-2255-48ad-bcaa-7a2c2fdbf212 Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
thebentern
added a commit
that referenced
this pull request
Apr 27, 2026
* Native MacOS hello world * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update variants/native/portduino/platformio.ini Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: ensure null-termination in getSerialString() and handle len==0 Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/e5647919-2255-48ad-bcaa-7a2c2fdbf212 Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --------- Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
mariotti
pushed a commit
to mariotti/firmware
that referenced
this pull request
May 6, 2026
* Native MacOS hello world * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update variants/native/portduino/platformio.ini Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: ensure null-termination in getSerialString() and handle len==0 Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/e5647919-2255-48ad-bcaa-7a2c2fdbf212 Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --------- Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Evil8it
pushed a commit
to Evil8it/ME4TACTNK
that referenced
this pull request
Jun 10, 2026
* Native MacOS hello world * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update variants/native/portduino/platformio.ini Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: ensure null-termination in getSerialString() and handle len==0 Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/e5647919-2255-48ad-bcaa-7a2c2fdbf212 Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --------- Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only in simulator mode for now, but it does compile and run