qmk / homebrew-qmk

QMK Homebrew Formulae
MIT License
12 stars 11 forks source link

[Bug] qmk 1.1.1_1 does not build on arm_ventura due to pillow failing #53

Closed mys721tx closed 1 year ago

mys721tx commented 1 year ago

Describe the Bug

qmk 1.1.1_1 does not build on arm_ventura since pip cannot build its dependency pillow.

System information and environment are enclosed in the build log for pillow.

Additional Context?

13.pip.log 13.pip.cc.log

fauxpark commented 1 year ago

Could you try adding the following to the formula:

on_arm do
  depends_on "pkg-config" => :build
end
mys721tx commented 1 year ago

I am getting the same error for pillow with the following stanza.

  depends_on "avrdude"
  depends_on "bootloadhid"
  depends_on "clang-format"
  depends_on "dfu-programmer"
  depends_on "dfu-util"
  depends_on "hidapi"
  depends_on "libusb"
  depends_on "make"
  depends_on "mdloader"
  depends_on "osx-cross/arm/arm-gcc-bin@8"
  depends_on "osx-cross/avr/avr-gcc@8"
  depends_on "pillow"
  depends_on "python"
  depends_on "teensy_loader_cli"

  on_arm do
    depends_on "pkg-config" => :build
  end
DorZvulun commented 1 year ago

having the same issue. following.

falsecognate commented 1 year ago

Following; I am on Monterey and having a similar issue. It suggests to upgrade pip to 23.0.1 (it runs 22.3.1 from the package) but I have already upgraded to 23.0.1.

13.pip.txt

fauxpark commented 1 year ago

You need to install Homebrew through Rosetta first, then install the qmk formula. It does not work (at least it has not been tested) on M1 Brew.

DorZvulun commented 1 year ago

This is weird. Something has changed. I've developed my keyboard with an M1 air for almost a year now and installed qmk without any problems back then. Now that I got a new M1Pro and tried to install qmk this problem happened and I cannot use qmk.

mattpus commented 1 year ago

I tried with with disabling rosseta on my terminal and it magically worked. Give it a try.

I use iterm. Go to applications in your Mac. Right click on iterm icon and disable rosseta. Reopen iterm and give it a go.

giacomoran commented 1 year ago

I was to work around the issue by:

brew install pkg-config
brew install qmk/qmk/qmk

Ref: https://www.reddit.com/r/ErgoMechKeyboards/comments/10aay3q/comment/j53pc5j/?utm_source=share&utm_medium=web2x&context=3

yngvedh commented 1 year ago
brew install pkg-config
brew install qmk/qmk/qmk

Fixed it for me. Thanks @GiacomoRandazzo for the tip!

jameswhqi commented 1 year ago
brew install pkg-config
brew install qmk/qmk/qmk

This doesn't work for me. I already have pkg-config installed and up-to-date, and reinstalling it doesn't help.

ufo22940268 commented 1 year ago

I solved by installing it from pip:

brew install avr-gcc arm-gcc-bin
pip install qmk

then start qmk with script https://github.com/qmk/qmk_cli/blob/master/qmk

jameswhqi commented 1 year ago

I looked at the installation log closely and found that the real error seems to be

src/_imagingft.c:25:10: fatal error: 'ft2build.h' file not found
#include <ft2build.h>
         ^~~~~~~~~~~~

when compiling _imagingft.c during the installation of Pillow. I replicated the exact steps of the installation process of Pillow:

python3 -m venv --system-site-packages /opt/homebrew/Cellar/qmk/1.1.1_1/libexec
/opt/homebrew/Cellar/qmk/1.1.1_1/libexec/bin/pip install -v --no-deps --no-binary :all: --use-feature=no-binary-enable-wheel-cache --ignore-installed ./Pillow-9.4.0

(here ./Pillow-9.4.0 was downloaded and extracted from https://files.pythonhosted.org/packages/bc/07/830784e061fb94d67649f3e438ff63cfb902dec6d48ac75aeaaac7c7c30e/Pillow-9.4.0.tar.gz), without error. The only difference between the two seems to be that they pass different include paths for freetype2 to clang; the homebrew installation passes -I/opt/X11/include/freetype2 while the standalone installation passes -I/opt/homebrew/Cellar/freetype/2.13.0_1/include/freetype2. I couldn't figure out why there was such a difference.

On the other hand, as far as I can tell, the resource "Pillow" stanza isn't necessary since the formula already depends_on "pillow". I tried removing the stanza and the installation completed without error, and qmk compile works as usual.

Installing with pip is definitely easier and faster since it can use pre-built wheels for the dependencies, while the homebrew installation (as I understand it) requires building them from scratch. I don't know why qmk recommends using homebrew instead of pip...

cskeeters commented 1 year ago

This worked for me. Rosetta was not enabled on /Applications/iTerm2.app

brew install pkg-config
brew install qmk/qmk/qmk
kyleabsten commented 1 year ago

My install is goes fine following: brew install pkg-config brew install qmk/qmk/qmk

However when I try to run this setup(for ZSA moonlander): qmk setup zsa/qmk_firmware -b firmware20

I am receiving this error: File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 1185, in addparser raise ArgumentError(self, ('conflicting subparser: %s') % name) argparse.ArgumentError: argument {config,clone,console,env,setup,c2json,chibios-confmigrate,clean,compile,config}: conflicting subparser: config

jimdoescode commented 1 year ago

Would it be worth opening a PR with @jameswhqi 's suggestion of removing the resource "Pillow"stanza from the formula? It seems odd to have that stanza and depends_on "pillow". I feel like we should just rely on brew to maintain that dependency instead of attempting to build it. Is there a reason for having both that I'm missing?

fauxpark commented 1 year ago

The resource stanza is required because the CLI is installed into a venv. It could be removed but will probably just get re-added when running brew update-python-resources.