mvp / uhubctl

uhubctl - USB hub per-port power control
Other
2.23k stars 232 forks source link

Includes Directory too Deep on libusb When Running brew install? #459

Closed JSimoni42 closed 2 years ago

JSimoni42 commented 2 years ago

I encountered an issue while running brew install on OSX:

❯ brew install uhubctl
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).

You have 51 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.

==> Downloading https://github.com/mvp/uhubctl/archive/v2.4.0.tar.gz
Already downloaded: /Users/johnsimoni/Library/Caches/Homebrew/downloads/37a1195afcf996cce0e7f0b7ebe543669f539f201f40bbc76432527131b610db--uhubctl-2.4.0.tar.gz
==> Installing uhubctl from mvp/uhubctl
==> make
Last 15 lines from /Users/johnsimoni/Library/Logs/Homebrew/uhubctl/01.make:
2022-10-06 18:38:52 +0000

make

fatal: not a git repository (or any of the parent directories): .git
clang  -g -O0 -Wall -Wextra -std=c99 -pedantic -DPROGRAM_VERSION=\"2.4.0\" -I/usr/local/Cellar/libusb/1.0.26/include/libusb-1.0 uhubctl.c -o uhubctl -L/usr/local/Cellar/libusb/1.0.26/lib -lusb-1.0
uhubctl.c:35:10: fatal error: cannot open file '/usr/local/Cellar/libusb/1.0.26/include/libusb-1.0/libusb-1.0/libusb.h': Too many levels of symbolic links
#include <libusb-1.0/libusb.h>
         ^
1 error generated.
make: *** [uhubctl] Error 1

Do not report this issue to Homebrew/brew or Homebrew/core!

/usr/local/Homebrew/Library/Homebrew/utils/github/api.rb:305:in `raise_error': Validation Failed: [{"message"=>"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.", "resource"=>"Search", "field"=>"q", "code"=>"invalid"}] (GitHub::API::ValidationFailedError)
    from /usr/local/Homebrew/Library/Homebrew/utils/github/api.rb:233:in `open_rest'
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:179:in `search'
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:40:in `search_issues'
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:73:in `issues_for_formula'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:498:in `fetch_issues'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:493:in `issues'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:549:in `dump'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:151:in `rescue in <main>'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:139:in `<main>'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2493:in `block in system': Failed executing: make (BuildError)
    from /usr/local/Homebrew/Library/Homebrew/formula.rb:2429:in `open'
    from /usr/local/Homebrew/Library/Homebrew/formula.rb:2429:in `system'
    from /usr/local/Homebrew/Library/Taps/mvp/homebrew-uhubctl/Formula/uhubctl.rb:17:in `install'
    from /usr/local/Homebrew/Library/Homebrew/build.rb:177:in `block (3 levels) in install'
    from /usr/local/Homebrew/Library/Homebrew/utils.rb:605:in `with_env'
    from /usr/local/Homebrew/Library/Homebrew/build.rb:139:in `block (2 levels) in install'
    from /usr/local/Homebrew/Library/Homebrew/formula.rb:1315:in `block in brew'
    from /usr/local/Homebrew/Library/Homebrew/formula.rb:2659:in `block (2 levels) in stage'
    from /usr/local/Homebrew/Library/Homebrew/utils.rb:605:in `with_env'
    from /usr/local/Homebrew/Library/Homebrew/formula.rb:2658:in `block in stage'
    from /usr/local/Homebrew/Library/Homebrew/resource.rb:158:in `block (2 levels) in unpack'
    from /usr/local/Homebrew/Library/Homebrew/download_strategy.rb:115:in `chdir'
    from /usr/local/Homebrew/Library/Homebrew/download_strategy.rb:115:in `chdir'
    from /usr/local/Homebrew/Library/Homebrew/download_strategy.rb:102:in `stage'
    from /usr/local/Homebrew/Library/Homebrew/resource.rb:154:in `block in unpack'
    from /usr/local/Homebrew/Library/Homebrew/mktemp.rb:77:in `block in run'
    from /usr/local/Homebrew/Library/Homebrew/mktemp.rb:77:in `chdir'
    from /usr/local/Homebrew/Library/Homebrew/mktemp.rb:77:in `run'
    from /usr/local/Homebrew/Library/Homebrew/resource.rb:266:in `stage_resource'
    from /usr/local/Homebrew/Library/Homebrew/resource.rb:153:in `unpack'
    from /usr/local/Homebrew/Library/Homebrew/resource.rb:127:in `stage'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8_1/lib/ruby/2.6.0/forwardable.rb:230:in `stage'
    from /usr/local/Homebrew/Library/Homebrew/formula.rb:2638:in `stage'
    from /usr/local/Homebrew/Library/Homebrew/formula.rb:1308:in `brew'
    from /usr/local/Homebrew/Library/Homebrew/build.rb:133:in `block in install'
    from /usr/local/Homebrew/Library/Homebrew/utils.rb:605:in `with_env'
    from /usr/local/Homebrew/Library/Homebrew/build.rb:128:in `install'
    from /usr/local/Homebrew/Library/Homebrew/build.rb:229:in `<main>'

~ took 12s

I noticed this -I flag value: /usr/local/Cellar/libusb/1.0.26/include/libusb-1.0. When I entered that directory, it contained the header file from the error message, libusb.h.

I was able to get brew install to pass by creating another directory in libusb-1.0 called libusb-1.0 and copying libusb.h to that directory.

I'm unfamiliar with this project's build system but this seemed to indicate to me that there is an issue with the logic that constructs that -I flag on some systems. I figured that you might want to be aware of this & provide a log for anyone else with a similar issue. Happy to provide any additional information about my system.

mvp commented 2 years ago

This is really weird. I cannot reproduce it on my Mac. Is it possible that your brew install is too old? Running it on clean Mac with fresh brew but without libusb or uhubctl installed:

$ sw_vers
ProductName:    macOS
ProductVersion: 12.6
BuildVersion:   21G115

$ brew tap mvp/uhubctl https://github.com/mvp/uhubctl

$ brew install uhubctl
==> Downloading https://ghcr.io/v2/homebrew/core/libusb/manifests/1.0.26
Already downloaded: ${HOME}/Library/Caches/Homebrew/downloads/ce7ffd7c94deb7060c2cac56f1d68a97b9d4bdc039f9548c3df327bee3d20ae4--libusb-1.0.26.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/libusb/blobs/sha256:e79be7d4c611f0017567172771761b1df62d140e79ffa6d2538577eb24a48e44
Already downloaded: ${HOME}/Library/Caches/Homebrew/downloads/7a7654072d8f5bf5cbe65bdb5dba42ddc19077d0bcecb14017a709ff35a68541--libusb--1.0.26.monterey.bottle.tar.gz
==> Downloading https://github.com/mvp/uhubctl/archive/v2.4.0.tar.gz
Already downloaded: ${HOME}/Library/Caches/Homebrew/downloads/37a1195afcf996cce0e7f0b7ebe543669f539f201f40bbc76432527131b610db--uhubctl-2.4.0.tar.gz
==> Installing uhubctl from mvp/uhubctl
==> Installing dependencies for mvp/uhubctl/uhubctl: libusb
==> Installing mvp/uhubctl/uhubctl dependency: libusb
==> Pouring libusb--1.0.26.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/libusb/1.0.26: 22 files, 531.7KB
==> Installing mvp/uhubctl/uhubctl
==> make
🍺  /usr/local/Cellar/uhubctl/2.4.0: 6 files, 93.8KB, built in 4 seconds
==> Running `brew cleanup uhubctl`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

$ uhubctl -v
2.4.0
JSimoni42 commented 2 years ago

I don't think so, brew --version looks pretty new. I wonder if it was an issue with my libusb installation though. I'm still not seeing anything obvious. Regardless, verifying that this doesn't reproduce on a system without libusb or uhubctl installed makes it seem like this isn't a widely applicable issue. I'll close it out as such.

~
❯ sw_vers
ProductName:    macOS
ProductVersion: 12.6
BuildVersion:   21G115

~
❯ brew --version
Homebrew 3.6.4
Homebrew/homebrew-core (git revision 462700d880f; last commit 2022-10-06)
Homebrew/homebrew-cask (git revision 7147fb5098; last commit 2022-10-06)