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

Please add protobuf setting changes to get it build on Apple Silicon M1 #396

Closed
y60yu1ii opened this issue Oct 1, 2021 · 10 comments · Fixed by #419
Closed

Please add protobuf setting changes to get it build on Apple Silicon M1 #396

y60yu1ii opened this issue Oct 1, 2021 · 10 comments · Fixed by #419
Assignees
Labels
Android Android-specific ticket

Comments

@y60yu1ii
Copy link

y60yu1ii commented Oct 1, 2021

Describe the bug
There is an issue of protobuf that it does not get the correct artifact name, which cause the plugin does not build to Android on Apple silicon M1

To Reproduce

  1. Add package to the project.
  2. Build & Run on Android.
  3. You would see

* What went wrong:
Execution failed for task ':reactive_ble_mobile:generateDebugProto'.
> Could not resolve all files for configuration ':reactive_ble_mobile:protobufToolsLocator_protoc'.
   > Could not find protoc-3.13.0-osx-aarch_64.exe (com.google.protobuf:protoc:3.13.0).
     Searched in the following locations:
         https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.13.0/protoc-3.13.0-osx-aarch_64.exe

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s
Exception: Gradle task assembleDebug failed with exit code 1

Expected behavior
it builds

Smartphone / tablet

  • Device: Pixel2
  • OS: Android 10
  • Package version: 3.3.1+1, 4.0.0, 4.0.1

Peripheral device

Additional context
Please made the following changes to the gradle file.

protobuf {
    protoc {
        // a fix for m1
        if (osdetector.os == "osx") {
            artifact = 'com.google.protobuf:protoc:3.13.0:osx-x86_64'
        } else {
            artifact = 'com.google.protobuf:protoc:3.13.0'
        }
    }

    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java {
                    option "lite"
                }
            }
        }
    }
}

@y60yu1ii y60yu1ii changed the title Please add protobuf chages to get it build on Apple Silicon M1 Please add protobuf setting changes to get it build on Apple Silicon M1 Oct 1, 2021
@remonh87
Copy link
Contributor

remonh87 commented Oct 1, 2021

do you use rosetta emulation for your command terminal? I am able to build the app with ease on my Mac m1. I also do not know the side effects of integrating this for non m1 machines.

@y60yu1ii
Copy link
Author

y60yu1ii commented Oct 1, 2021

yes, I have tried using the rosetta the result is the same.

This issue is addressed here
grpc/grpc-java#7690

I previously forking the 3.3.1+1 project and applied the changes to make it build.
However, directly import the github repo to pubspec.yaml doesn't seem working after federated plugin structure.

Thank you for the information, it is good to konw that there is another m1 is able to run the project.
I will see what I missed on my set up.

@remonh87 remonh87 added the Android Android-specific ticket label Oct 11, 2021
@remonh87
Copy link
Contributor

I will have a look into this issue the coming time. I finally could reproduce it on my m1.

@y60yu1ii y60yu1ii reopened this Oct 13, 2021
@y60yu1ii
Copy link
Author

I found something new here.
protocolbuffers/protobuf#8062

The issue seems to be there is no file called such name.

@davormaricdev
Copy link

I can confirm that this also happens on mine Mac M1 too. I have Rosetta2 installed

@davormaricdev
Copy link

Bumping artifact to 3.18.1 might resolve the issue as that package contains an reference to protoc-xxx-osx-aarch_64.exe
Source: https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.18.1/

@remonh87 remonh87 self-assigned this Oct 20, 2021
@remonh87
Copy link
Contributor

thanks for the tip that indeed fixed it pull request is coming up

@djorgji
Copy link

djorgji commented Oct 22, 2021

When is the next release? I was hoping to get this fix. Thank you.

@remonh87
Copy link
Contributor

Version 5.0.1 is launched and available on pub.dev

@y60yu1ii
Copy link
Author

It works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Android-specific ticket
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants