asdf-community / asdf-flutter

flutter plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
110 stars 31 forks source link

Not working on Mac M1 #16

Closed usern3 closed 3 years ago

usern3 commented 3 years ago

When trying to use the Flutter plugin I'm running into issues trying to find and install a version.

Here's some outputs. The plugin can be added to asdf, but it seems like doing anything else with it doesn't work. Is there something that can be done to get this working? Or is it broken for the M1 mac's at this time?

➜  ~ asdf list all flutter
/Users/nolan/.asdf/plugins/flutter/bin/jq: line 1: Not: command not found
➜  ~ asdf plugin-add flutter

Plugin named flutter already added
➜  ~ asdf install flutter 1.22.6
/Users/nolan/.asdf/plugins/flutter/bin/jq: line 1: Not: command not found
Cannot find the download url for the version: 1.22.6
➜  ~ asdf install flutter v-1.22.6
/Users/nolan/.asdf/plugins/flutter/bin/jq: line 1: Not: command not found
Cannot find the download url for the version: v-1.22.6
oae commented 3 years ago

Jq is actually downloaded automatically based on os. But I believe the macOS uname command now returns something else on m1 macs. Another thing is JQ does not have an arm build so I don't know if it even works. I don't have a MacBook anymore so I cannot try it. Related code is here. PR would be awesome.

usern3 commented 3 years ago

I was able to install JQ with Homebrew, but I'm still getting the error from the install commands. I've verified JQ is working at least in the terminal.

Just checked, uname returns Darwin from my terminal on M1. And uname -m returns arm64.

Is it looking for JQ somewhere else?

> which jq
/opt/homebrew/bin/jq
oae commented 3 years ago

I was able to install JQ with Homebrew, but I'm still getting the error from the install commands. I've verified JQ is working at least in the terminal.

Just checked, uname returns Darwin from my terminal on M1. And uname -m returns arm64.

Adding arm64 to https://github.com/oae/asdf-flutter/blob/c198e74931d2b8f146b3ddcd22da33feeb2afb36/bin/jq-downloader#L11 should fix it. But i couldn't see arm64 build on jq release. I don't know which binary brew is using.

Is it looking for JQ somewhere else?

> which jq
/opt/homebrew/bin/jq

Scripts are executing downloaded jq only. You can see it here. https://github.com/oae/asdf-flutter/blob/c198e74931d2b8f146b3ddcd22da33feeb2afb36/bin/list-all#L4

usern3 commented 3 years ago

should fix it. But i couldn't see arm64 build on jq release. I don't know which binary brew is using.

So, I did some looking into the Homebrew files and it's using an ARM version of 1.6 JQ. According to the Brewfile.lock this is where they're getting it:

url": "https://homebrew.bintray.com/bottles/jq-1.6.arm64_big_sur.bottle.1.tar.gz"

Not sure if we can use this somehow? Or point ARM64 users to the JQ in Homebrew? Because there doesn't seem to be an official ARM build of JQ in their releases and the last release and commit was 3 years ago so doubtful it's coming anytime soon.

mamoru0217 commented 3 years ago

I created PR to solve this issue. 👉 https://github.com/oae/asdf-flutter/pull/17 . Since Rosetta2 is used on Mac M1, I think it's okay to install the amd64 version of jq.