Skip to content

Add PTHREAD_STACK_MIN fallback to macOS builds - #5

Merged
schikani merged 3 commits into
tinydesk-project:mainfrom
mendeni:tdsh_posix
Oct 13, 2026
Merged

schikani merged 3 commits into
tinydesk-project:mainfrom
mendeni:tdsh_posix

Conversation

@mendeni

@mendeni mendeni commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

PTHREAD_STACK_MIN is part of the POSIX threading standard, but is optional on macOS. Because this constant isn't defined, the compiler sees an undeclared identifier and throws an error.

This change adds a PTHREAD_STACK_MIN conditional to tdsh_posix.c so that macOS builds succeed.

@schikani

Copy link
Copy Markdown
Collaborator

Thanks for the fix, and welcome! It builds cleanly on Linux and all host tests pass.

One small request since you can test on macOS: POSIX defines PTHREAD_STACK_MIN in <limits.h>, which tdsh_posix.c never includes (on Linux it only arrives through <pthread.h>). Could you add #include <limits.h> with the other system headers and check whether macOS then defines it? If it does, it'll use the real value (16 KB on Apple Silicon, I believe), and your fallback can stay as a safety net for systems that still lack it.

I'll squash-merge once that's checked.

@mendeni

mendeni commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

@schikani I was able to build on macOS without fallback lines and only #include <limits.h>.

I left the fallback in place as a safety net as you described.

edit: fixed and typo

@schikani
schikani merged commit c9bfbe1 into tinydesk-project:main Oct 13, 2026
4 checks passed
@schikani

Copy link
Copy Markdown
Collaborator

Thanks for checking on macOS and for the quick update! Merged.

@mendeni
mendeni deleted the tdsh_posix branch October 13, 2026 18:13
schikani added a commit that referenced this pull request Oct 18, 2026
A script whose line table or line copies could not be allocated returned
with status 2 and printed nothing (#2). load_script() now prints
"uscript: <file>:<line>: not enough memory to load the script", and also
says so for more than 1024 lines and for a read error.
tests/test_script_oom.c refuses large reallocations so a 100-line script
cannot load, and fails without the messages.

Porting guide: a "File names" section, FatFs needs long names with the
UTF-8 interface (FF_LFN_UNICODE 2; the ESP32 projects set it), from
tinydesk #8. Changelog entries for these and for the macOS build fix (#5).
schikani added a commit that referenced this pull request Oct 18, 2026
VERSION, TDSH_VERSION, the changelog heading and the release notes:
nano with UTF-8 text (tinydesk #4), peek and poke on the ESP32 and
ESP32-C6 (#1), the script memory limits and the message when a script
runs out of memory while loading (#2, #4), the macOS build (#5).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants