uber / prototool

Your Swiss Army Knife for Protocol Buffers
MIT License
5.05k stars 345 forks source link

Support Apple arm64 arch #574

Open zephyrpathsofglory opened 3 years ago

zephyrpathsofglory commented 3 years ago

when I run prototool generate in my Macbook pro M1 chip, it prints unsupported value for runtime.GOARCH: arm64, then I searched the repo and found this function in internal/protoc/downloader.go:

func getUnameSUnameMPaths(goos string, goarch string) (string, string, error) {
    var unameS string
    switch goos {
    case "darwin":
        unameS = "Darwin"
    case "linux":
        unameS = "Linux"
    default:
        return "", "", fmt.Errorf("unsupported value for runtime.GOOS: %v", goos)
    }
    var unameM string
    switch goarch {
    case "amd64":
        unameM = "x86_64"
    default:
        return "", "", fmt.Errorf("unsupported value for runtime.GOARCH: %v", goarch)
    }
    return unameS, unameM, nil
}

So I guess it is a bug of prototool and composed this issue to ask for some help.

jinsuojinsuo commented 3 years ago

The same problem

totmaxim commented 3 years ago

forgot about mac m1 users ?

mehuled commented 3 years ago

Facing the same issue, is there any workaround until this is fixed?

hanksudo commented 3 years ago

Facing the same issue, is there any workaround until this is fixed?

In my case, I just add arm64 to the switch. Works for me.

https://github.com/hanksudo/prototool/commit/3086a4b512489fd4bb77d4f0377a961047925bd7

ddiaz914 commented 2 years ago

Any updates on this one?

shettyh commented 2 years ago

Seems like protobuf is not publishing precompiled binaries for Apple ARM machines yet. More details here https://github.com/protocolbuffers/protobuf/issues/8428

freisenhauer commented 2 years ago

Seems like protobuf now supports apple arm. I'd really like to use the prototool docker image on apple silicon (though that would mean linux arm, not apple arm)! Currently, with rosetta2, it's not possible to use it. qemu throws a segfault.

qemu: uncaught target signal 11 (Segmentation fault) - core dumped
peterdemartini commented 2 years ago

I still get the same error

hsqds commented 2 years ago

I was looking for solution and found this https://hub.docker.com/r/decoder89/prototool-m1/tags Works for me