1

I keep getting compiling errors whenever I follow the Homebrew install guide for QMK.

==> Installing qmk from qmk/qmk
avr-gcc@8: The x86_64 architecture is required for this software.
Error: An unsatisfied requirement failed this build.

How can I get this to install correctly?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ryan Macdonald
  • 116
  • 3
  • 6
  • 3
    To anyone who finds this now before trying to install qmk: this error no longer occurs. You do not need to do anything differently on M1. gcc-avr@8 has been patched to run on M1: https://github.com/osx-cross/homebrew-avr/pull/249 – ipetrik Dec 17 '21 at 00:39

3 Answers3

2

Install Homebrew using Rosetta 2 to do the compilation for you:

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Then, install QMK with the x86_64 arch:

arch -x86_64 brew install qmk/qmk/qmk

Then follow the rest of the guide from the QMK website: https://beta.docs.qmk.fm/tutorial/newbs_getting_started#3-run-qmk-setup-id-set-up-qmk.

Ryan Macdonald
  • 116
  • 3
  • 6
  • 2
    Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)! To rerun under ARM use: arch -arm64 brew install ... To install under x86_64, install Homebrew into /usr/local. – Paint Laurent Jun 04 '21 at 14:08
  • Did you install homebrew first? – Ryan Macdonald Jul 08 '21 at 17:22
  • ```echo 'eval "$(/usr/local/bin/brew shellenv)"' >> $HOME/.zprofile && eval "$(/usr/local/bin/brew shellenv)"``` before ```brew install``` – minodisk Aug 09 '22 at 22:26
1

I use Docker (Podman actually, but both works) as the container can be amd64 with Rosetta and Podman (there is a solution for Docker too).

Then I build an image like that, and I run inside the container (I override the default keyboard layout with mine, so that I don't have to create a user).

When you run it, mount a volume from your machine as '/output' and copy the bin or do a podman/docker copy.

FROM docker.io/qmkfm/base_container:latest
RUN pip install qmk && \
    qmk setup -y -H /qmk_firmware
WORKDIR /qmk_firmware
COPY keymap/keymap.c /qmk_firmware/keyboards/novelkeys/nk65/keymaps/default/keymap.c
COPY config/qmk/qmk.ini /root/.config/qmk/qmk.ini

# Make Bash as the default command
CMD ["/bin/bash"]
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jean-Pascal J.
  • 146
  • 1
  • 8
0

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!

To rerun under ARM, use:

arch -arm64 brew install ...

To install under x86_64, install Homebrew into /usr/local.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Paint Laurent
  • 113
  • 1
  • 7