Build fixes for macOS#133
Open
nGoline wants to merge 4 commits into
Open
Conversation
Apple clang does not accept -Wshadow=local, so `make` fails immediately on macOS. Probe the compiler and add the flag only when it is accepted, keeping the warning on GCC/newer clang.
On macOS 14+ MINSIGSTKSZ expands to a runtime value, not a compile-time constant, so it cannot be used in BUILD_ASSERT. Fall back to a runtime check on Apple platforms while keeping the compile-time assertion elsewhere.
macOS ships BSD getopt, which lacks the --long option this script relies on. Prefer a Homebrew gnu-getopt if present, otherwise detect GNU getopt via its --test exit code and fail with a helpful message if unavailable.
macOS/clang emits .dSYM debug-symbol bundles next to built binaries.
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.
Four independent fixes so ccan builds on macOS with Apple clang. Each is a separate commit.
-Wshadow=local— Apple clang rejects this flag, somakefails immediately. Add it only when the compiler accepts it (kept on GCC/newer clang).MINSIGSTKSZon macOS 14+ — on macOS 14+MINSIGSTKSZexpands to a runtime value, not a compile-time constant, so it can't be used inBUILD_ASSERT. Use a runtime check on Apple platforms; keep the compile-time assertion elsewhere.--long. Prefer a Homebrewgnu-getoptif present, else detect GNU getopt via its--testexit code and fail with a helpful message.*.dSYM— macOS/clang emits.dSYMdebug-symbol bundles next to built binaries.No functional change on Linux.