[Toybox] [PATCH] Fix macOS build.

enh enh at google.com
Fri Apr 3 17:12:00 PDT 2020


On Thu, Apr 2, 2020 at 7:33 PM Rob Landley <rob at landley.net> wrote:
>
> On 4/2/20 12:50 PM, enh via Toybox wrote:
> > I'd put the rtc_wkalarm struct in the globals to get it zeroed for
> > free, but since there's no such type on macOS, that breaks the
> > build. Rather than define a bogus struct in portability.h, I've
> > gone for making it an explicitly-zeroed local. (And I've sorted the
> > locals largest-first.)
>
> You didn't turn the TT.alarm references into alarm in the function, so the
> result doesn't compile. I'll fix it up here...

yeah, sorry, didn't get any time for "real work" that day [or indeed
today], so i wrote that on a mac during a meeting ... where it
obviously worked fine because that file isn't compiled. d'oh!

> > Note that the use of struct rtc_time as if it was the same as struct
> > tm in this code follows the existing code in hwclock, but I worry
> > that we're going to have trouble with that because of the extra
> > tm_gmtoff and tm_zone fields in struct tm. But that's a worry for
> > another day...
>
> gcc at least produces really inefficient zeroing for = {} of structs. (Maybe
> it's been fixed in the past couple years? I turned it into a memset anyway.)

ah, i had wondered why you don't use that more. (it's one of my
favorite "new" features.)

looking at -S, clang seems optimal. gcc 9 looks okay for -O3, but,
yeah, not so good below that.

> > This patch also removes the CONFIG_CP_PRESERVE from the macos_miniconfig,
> > since that option was removed a while back.
>
> Ok.
>
> Speaking of which, I'm trying to cut a release in the next day or so, and long
> ago you said you would put bionic and macos binaries on an android web page
> somewhere? (I can build NDK binaries, but that's not quite the same build
> environment as AOSP, and I haven't got a mac build environment...)

yeah, "do something about the 'old toybox' problem" is still on my
to-do list, but these days i'm thinking less about ci.android.com and
more about just getting it into some kind of "developer tools"
mainline module. or maybe cramming stuff like this into the adb
mainline module (new in R).

fwiw, if you just want the latest toybox prebuilt that we're using,
https://android.googlesource.com/platform/prebuilts/build-tools/+/refs/heads/master/darwin-x86/bin/
and https://android.googlesource.com/platform/prebuilts/build-tools/+/refs/heads/master/linux-x86/bin/
contain those. there's a linux asan prebuilt too:
https://android.googlesource.com/platform/prebuilts/build-tools/+/refs/heads/master/linux-x86/asan/bin/

but, no, we don't currently have any _device_ prebuilts anywhere.

> I should dig up a freebsd build while I"m at it, that defconfig hasn't seen much
> attention lately either...
>
> Rob



More information about the Toybox mailing list