thunderbird-patches icon indicating copy to clipboard operation
thunderbird-patches copied to clipboard

Homebrew and Apple Silicone (M1)

Open rafo opened this issue 2 years ago • 21 comments

Nice Project!

I finished a Homebrew Cask for Betterbird but didn't push it to the Homebrew repo since there is no Apple Silicone version of BB. Are there any plans or options for a M1 build?

rafo avatar Oct 01 '22 19:10 rafo

Not really, unless someone funds it. We're doing the Intel build on a loaned Mac book which can disappear any minute. That was initially termed "experimental", and it's not notarised either. Apparently you can get Mac M1 in the cloud. https://aws.amazon.com/ec2/instance-types/mac/.

Betterbird avatar Oct 01 '22 19:10 Betterbird

Thanx for the quick reply. It would be a shame if this project for the Apple and Homebrew community failed because of this. Maybe I could help or compile it myself?  

rafo avatar Oct 01 '22 20:10 rafo

What help did you have in mind? At a guess, we should compile the binaries we distribute yourselves. You have an M1/2 machine? Did you compile there successfully?

Betterbird avatar Oct 01 '22 20:10 Betterbird

I could compile it myself on a M1, but didn't try it right now. I skimmed through your build.sh and https://firefox-source-docs.mozilla.org/setup/macos_build.html, and it didn't seem too complicated, but maybe that's just naïve.

rafo avatar Oct 01 '22 21:10 rafo

With no updates for 7+ months - just wondering if anyone has been able to successfully build a version with native Apple Silicon support? (if so, could you post a link? 😅)

seanbperiod avatar May 10 '23 02:05 seanbperiod

We don't have the hardware, and BTW, the Intel Mac we use to compile is only on loan and can be withdrawn any day. Other than that, compiling shouldn't be a problem. It could even be done in the cloud via AWS: https://aws.amazon.com/ec2/instance-types/mac/ If we read the linked pricing page https://aws.amazon.com/ec2/dedicated-hosts/pricing/ correctly, a Mac2 service is necessary (Mac1 being Intel based). As a dedicated host that costs $0.716 per hour with a 24 hour minimum, so $17 per build. Getting a beefy Linux machine in the cloud for an hour is around 50 Eurocent in comparison.

Last we checked, only 2% of users were on Mac, unclear how many of those were on M1/M2.

Betterbird avatar May 10 '23 07:05 Betterbird

Last we checked, only 2% of users were on Mac, unclear how many of those were on M1/M2.

This is sometimes a chicken-and-egg problem. 🐔 But I understand your point of view.

rafo avatar May 10 '23 14:05 rafo

We will use GitHub actions soon (https://github.com/Betterbird/thunderbird-patches/pull/173). According to https://github.com/Betterbird/thunderbird-patches/pull/173#issuecomment-1634845016 this will be supported from Q3 2023.

Betterbird avatar Jul 14 '23 19:07 Betterbird

Seems like Github Actions can be used with m1 runners now

https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/

Arecsu avatar Oct 25 '23 02:10 Arecsu

Thanks for letting us know. Sadly, building on Mac only works for the "full build from repo", not the "reduced build from source tarball" which we prefer, see Issue #175.

Upstream report here: https://bugzilla.mozilla.org/show_bug.cgi?id=1847288#c1

They did answer here: https://bugzilla.mozilla.org/show_bug.cgi?id=1847288#c2 Thanks for the info. Maby you can try disabling sccache on mac?

@sagudev could you look into it again?

Betterbird avatar Oct 25 '23 08:10 Betterbird

Just here to throw my hat in, would love to see apple silicon builds

wrapper avatar Dec 15 '23 12:12 wrapper

Sure, see the comment before yours.

Betterbird avatar Dec 15 '23 12:12 Betterbird

So I tried compiling on an M2 mac. In mozconfig-Mac I changed/added: ac_add_options --target=aarch64-apple-darwin #changed ac_add_options --host=aarch64-apple-darwin #added, not sure this is needed

Building fails with: 0:06.81 DEBUG: Executing: /Users/<>/.mozbuild/sccache/sccache /usr/bin/clang -isysroot /Users/<>/.mozbuild/MacOSX13.3.sdk -mmacosx-version-min=11.0 -std=gnu99 --target=arm64-apple-darwin -Wl,--version 0:06.81 ERROR: Failed to find an adequate linker

Any idea what can be done? ld does not support --version on mac

shaul-pollak avatar Jan 26 '24 09:01 shaul-pollak

We got same thing in mozjs, one solution is to set default linker to lld-classic or to clang's lld or apply this patch: https://github.com/servo/mozjs/blob/main/mozjs-sys/etc/patches/0029-fix-ld64-detection.patch

sagudev avatar Jan 26 '24 09:01 sagudev

changed to clangd's lld. works. Thanks @sagudev

shaul-pollak avatar Jan 26 '24 10:01 shaul-pollak

We got same thing in mozjs, one solution is to set default linker to lld-classic or to clang's lld or apply this patch:

Has that been reported upstream at Mozilla. They build FF/TB for M1/M2, so why don't they have the issue? Or are they doing only cross-compiles for Mac on Linux?

Betterbird avatar Jan 26 '24 11:01 Betterbird

Mozilla is using their own toolchains (clang) using mach. I planned to upstream https://github.com/servo/mozjs/blob/main/mozjs-sys/etc/patches/0029-fix-ld64-detection.patch but I forgot. I will open bug and fix later today.

sagudev avatar Jan 26 '24 11:01 sagudev

Found relevant bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1871153

sagudev avatar Jan 26 '24 18:01 sagudev

Thanks. Maybe we should just add the patch to the project, I guess it won't break the other builds :wink:

Betterbird avatar Jan 26 '24 22:01 Betterbird

We did a cross-compile enabling the respective lines after this commit: https://github.com/Betterbird/thunderbird-patches/commit/be2ea886eeb8c982c59db1f271141eef5968535a

One user on Reddit claims that it works, two other users report a broken app:

Working:

arm1 arm2

Not working:

image image

Betterbird avatar Jun 16 '24 10:06 Betterbird

It can be made to work:

To "fix" the gatekeeper: spctl --add /Applications/Betterbird.app. Source: https://osxdaily.com/2015/07/15/add-remove-gatekeeper-app-command-line-mac-os-x/

To fix the "Betterbird is damaged": xattr -cr /Applications/Betterbird.app. Source: https://www.youtube.com/watch?app=desktop&v=6fqzb4qpgcs

Betterbird avatar Jun 16 '24 18:06 Betterbird