Skip to content

Fixed broken homebrew formula for Linux.#107

Open
naelstrof wants to merge 3 commits into
rgerganov:masterfrom
naelstrof:master
Open

Fixed broken homebrew formula for Linux.#107
naelstrof wants to merge 3 commits into
rgerganov:masterfrom
naelstrof:master

Conversation

@naelstrof

Copy link
Copy Markdown

Context

Running Bazzite, an atomic read-only OS, requires me to use brew to easily access usb devices with an arbitrary unpackaged binary like footswitch.

Problem

Attempting to install with brew gives the following error:

==> make install PREFIX=/home/linuxbrew/.linuxbrew/Cellar/footswitch/HEAD-454e00b
Last 15 lines from /home/naelstrof/.cache/Homebrew/Logs/footswitch/02.make.log:
compilation terminated.
make[2]: *** [CMakeFiles/scythe.dir/build.make:107: CMakeFiles/scythe.dir/src/scythe.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/var/tmp/footswitch-20260711-2-xhxbsy/src/footswitch.c:28:10: fatal error: hidapi.h: No such file or directory
   28 | #include <hidapi.h>
      |          ^~~~~~~~~~

Analysis

I'm assuming dev packages like hidapi can arbitrarily place their include files depending on the platform. Using brew list hidapi I can see the include files are actually located within /home/linuxbrew/.linuxbrew/Cellar/hidapi/0.15.0/include/hidapi/ (2 files).

My understanding is that it's CMake's purpose to "find" the proper include location regardless of platform. So I tried updating the brew to simply run cmake before make. This didn't actually fix it though, it appears the CMakeLists.txt is misconfigured slightly. (notice the error is with scythe but not footswitch!)

Solution

I've edited the CMakeLists.txt so that it manually specifies target includes per exe, rather than relying on the global include.

Additionally I edited the brew to run cmake ./ before it tries to make install, and added cmake to the build dependencies.

I've also added some temp cmake files to the gitignore.

Tested locally it now works for my specific context.
image

I tried my best to keep the changes as small as possible as to be easy to review, I have no way to test if this also works for mac! Sorry!

Afterword

Thank you so much for making such an awesome tool! Was sweating thinking about booting up a windows VM and forwarding my ports to it just so I can change the key it presses. This is a wonderful and miraculous alternative that I wouldn't have a clue how to make from scratch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant