Skip to content

MacOS fixes - #148

Merged
WouterJansen merged 7 commits into
mainfrom
5.8
Aug 7, 2026
Merged

MacOS fixes#148
WouterJansen merged 7 commits into
mainfrom
5.8

Conversation

@WouterJansen

Copy link
Copy Markdown
Contributor

Fixed multiple build issues for MacOS. #143, #144, and #145 by v3g42.

v3g42 and others added 7 commits August 7, 2026 01:42
This test is undefined behaviour, and not only on macOS.

`std::tm t;` is uninitialised, and "2018-February-22 15:24:00" is parsed with
to_time_t's default format "%Y-%m-%d %H:%M:%S". `%m` expects a number and cannot
read "February", so get_time sets failbit and leaves the struct as whatever was
on the stack. mktime is then called on that garbage:

    parse failed? YES
    tm_year=118 tm_mon=0 tm_mday=1 tm_hour=-117784575
    mktime  = -1

The sun's position is computed for time_t -1 -- 1969 -- so the altitude assert
fails, and the whole suite aborts before SettingsTest and SimpleFlightTest run.

Whether it passes is a property of the stack, not of the code, which is why it
survives on some toolchains and aborts on others. Passing "%Y-%B-%d %H:%M:%S"
parses correctly (mktime = 1519341840) and the test passes.

Not a macOS fix: it is a real bug everywhere that merely happens to be latent.
`brew install llvm@8` fails on any current Homebrew -- the oldest formula
available is llvm@14, so setup.sh cannot complete on macOS at all.

The line's own comment already says "Update below line for newer versions", and
build.sh does not want a pinned version either: its macOS branch resolves the
compiler as $(brew --prefix)/opt/llvm/bin/clang with the comment "now pick up
whatever setup.sh installs", having commented out the old llvm@8 path years ago.
Plain `llvm` is what the rest of the build already expects.

Verified on macOS 15.7.7 / Apple M1 Pro: setup.sh completes, and build.sh then
produces native arm64 libAirLib.a, librpc.a and libMavLinkCom.a in 1m43s.
CelestialTests: parse the month name the test itself passes (uninitialised std::tm)
setup.sh: install llvm, not the llvm@8 Homebrew removed
…fixes the macOS plugin build)

manually done #145 by v3g42
Documented multiple build fixes for MacOS in the changelog.
@WouterJansen
WouterJansen merged commit 2b8385f into main Aug 7, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants