Skip to content

Fix missing nproc on macOS #3577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2020
Merged

Fix missing nproc on macOS #3577

merged 1 commit into from
Oct 20, 2020

Conversation

cwalther
Copy link

#3541 (396979a) breaks building on macOS, which doesn’t have an nproc command. That seems to be a Linux thing. The equivalent would be sysctl -n hw.logicalcpu, but since I can’t find any existing platform distinctions in the makefiles, I chose to call Python for a cross-platform solution. (Credits to https://stackoverflow.com/questions/1715580.)

396979a breaks building on macOS: `nproc` is a Linux thing, use a cross-platform alternative.
Copy link

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! The lone build failure appears to be unrelated and I've added #3578 to hopefully address it. (not that it matters, as running Python is a perfectly good alternative, but is the alternative shell command getconf _NPROCESSORS_ONLN portable?)

@cwalther
Copy link
Author

I can’t say anything about general portability, but getconf _NPROCESSORS_ONLN works for me on macOS 10.14.6.

@jerryneedell
Copy link
Collaborator

I tried this PR on a Mac and on a Linux system -- built Pyportal -- works OK for both.

@tannewt tannewt merged commit 1092890 into adafruit:main Oct 20, 2020
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.

4 participants