Skip to content
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

Fix build on Apple Silicon macs #7782

Merged
merged 2 commits into from
Feb 26, 2022
Merged

Conversation

Atemu
Copy link
Contributor

@Atemu Atemu commented Feb 3, 2022

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

Fixes the build on M1 macs.
For more information see this comment

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

Due diligence

Required for newer versions of some dependencies
@@ -101,7 +101,7 @@ ext {
checkstyleVersion = '9.2.1'

androidxLifecycleVersion = '2.3.1'
androidxRoomVersion = '2.3.0'
androidxRoomVersion = '2.4.1'
Copy link
Contributor

@triallax triallax Feb 3, 2022

Choose a reason for hiding this comment

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

Changelog: https://developer.android.com/jetpack/androidx/releases/room

Before merging, we should review the changelog carefully, and test these changes in the app.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll be running this patch backported to master in the coming days.

Copy link
Member

@litetex litetex left a comment

Choose a reason for hiding this comment

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

@Atemu
Thank you for the PR.

Fixes the build on M1 macs.

That's not enough.
Please describe how your changes fix the problem.

@litetex litetex added bug Issue is related to a bug device/software specific Issues that only happen on some devices or with some specific hardware/software labels Feb 3, 2022
This version of Room includes a fix for building dependant apps such as NewPipe
on Apple Silicon devices (aarch64-darwin)
@Atemu Atemu requested a review from litetex February 4, 2022 08:58
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 4, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@litetex litetex left a comment

Choose a reason for hiding this comment

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

Not sure why my review is requested but the situation since
#7782 (review)
hasn't changed...

@triallax
Copy link
Contributor

triallax commented Feb 7, 2022

@litetex it somewhat did, read the commit messages.

@litetex
Copy link
Member

litetex commented Feb 7, 2022

@litetex it somewhat did, read the commit messages.

Thanks for the hint, however 2 problems:

  1. A commit message != a comment here
  2. "compileSdk 31" is still open and waiting for explanation

@Atemu
Copy link
Contributor Author

Atemu commented Feb 7, 2022

@litetex ah, you meant the PR comment! I thought you meant the commit messages.

You did not mention anything regarding compileSdk 31 in your review though, I'm a bit confused.

@litetex
Copy link
Member

litetex commented Feb 8, 2022

You did not mention anything regarding compileSdk 31 in your review though, I'm a bit confused.

Well you updated the compileSdk to 31.
Why did you do that?

@triallax
Copy link
Contributor

triallax commented Feb 8, 2022

From the commit message:

Required for newer versions of some dependencies

So I guess it's needed for the dependency update in the other commit.

@Atemu
Copy link
Contributor Author

Atemu commented Feb 8, 2022

Should I be more specific about it or even put it in the same commit?

@litetex
Copy link
Member

litetex commented Feb 9, 2022

Simply answer my questions in a comment next time. The commit messages are great too but they are easily overlooked in a conversation here.

I also still don't know

  • what problem with the current build is present on Mac's. Our CI (which uses MacOS) works fine. Is this a problem with Android studio, the emulator, the build or something else?
  • how the above changes (updating a dependency) fixed the problem on Mac. I see no fixed bug regarding MacOS in the changelogs.

It would be great too have things like stacktraces, bug reports, links, etc which we can refer to?

@ktprograms
Copy link
Contributor

ktprograms commented Feb 10, 2022

@litetex It's a problem that earlier versions of Android Room can't be used on Arm64 (M1) Macs.

AFAIK, It can be fixed either by updating the Room dependency, or by adding

kapt "org.xerial:sqlite-jdbc:3.34.0"

to the dependencies.


If you don't want to update to room 2.4.0, then I recommend using the kapt line. I have been putting it in my app/build.gradle (around line 218, below the kapt for room-compiler) for several months now, and the built APKs don't seem to be broken in any way.

@ktprograms
Copy link
Contributor

@litetex Here's where it's mentioned in the Android Room Changelogs: https://developer.android.com/jetpack/androidx/releases/room#2.4.0-alpha03 (first bullet point under the Bug Fixes heading).

Fixed an issue with Room’s SQLite native library to support Apple’s M1 chips. (b/174695268

@Atemu
Copy link
Contributor Author

Atemu commented Feb 10, 2022

how the above changes (updating a dependency) fixed the problem on Mac. I see no fixed bug regarding MacOS in the changelogs.

Should I really include a link to commit/patchnotes? That seems a bit overkill for a simple dependency bump that includes a fix.

AFAIK, It can be fixed either by updating the Room dependency, or by adding

kapt "org.xerial:sqlite-jdbc:3.34.0"

to the dependencies.

Neat, didn't know that.

I'd still prefer upgrading room over injecting just the updated jdbc. We should update room at some point anyways and it's been working perfectly for me the past week (with the caveat that I backported it to master).

@litetex
Copy link
Member

litetex commented Feb 10, 2022

Thx @ktprograms for clarifying that.
Now I understand what is going on here 👍


Should I really include a link to commit/patchnotes?

👉

Simply answer my questions in a comment next time

Copy link
Member

@litetex litetex left a comment

Choose a reason for hiding this comment

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

LGTM

Did a quick test and couldn't find any problems

@Stypox
Copy link
Member

Stypox commented Feb 16, 2022

Warning: the bump to compileSdk should be tested carefully on Android 12 and non-12 (devices)/emulators. This this is so simple to revert, I'd merge this after 0.22.0 is released and then test on the dev branch if anything wrong happens when updating the compile sdk.

@Stypox Stypox mentioned this pull request Feb 18, 2022
1 task
Stypox added a commit to Stypox/NewPipe that referenced this pull request Feb 19, 2022
This will allow newer libraries to be used, see TeamNewPipe#7782 and TeamNewPipe#2335. This should have no changes on the app since the targetSdk stayed the same.
@Stypox Stypox mentioned this pull request Feb 19, 2022
5 tasks
@litetex litetex merged commit a4dee77 into TeamNewPipe:dev Feb 26, 2022
@Atemu Atemu deleted the apple-silicon branch February 26, 2022 19:24
@Atemu
Copy link
Contributor Author

Atemu commented Feb 26, 2022

Thanks!

@TacoTheDank TacoTheDank mentioned this pull request Feb 26, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug device/software specific Issues that only happen on some devices or with some specific hardware/software
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants