Linuxbrew / brew

:beer::penguin: The Homebrew package manager for Linux
https://linuxbrew.sh
BSD 2-Clause "Simplified" License
2.66k stars 237 forks source link

uninitialized constant OS::Mac::CLT #874

Closed scpeters closed 6 years ago

scpeters commented 6 years ago

Please fill out the issue checklist below and provide all the requested information.

$ brew config
HOMEBREW_VERSION: 1.8.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: fdd8e9b7cf1e53322492e1e90f685c19bdfde506
Last commit: 4 days ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: 28a637313b565df784b2fb70ed7f372f8414ed72
Core tap last commit: 3 hours ago
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CACHE: /home/linuxbrew/.cache/Homebrew
CPU: octa-core 64-bit ivybridge
Homebrew Ruby: 2.3.7 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: N/A
Git: 2.19.1 => /usr/bin/git
Curl: 7.47.0 => /usr/bin/curl
Kernel: Linux 4.4.0-135-generic x86_64 GNU/Linux
OS: Ubuntu 16.04.5 LTS (xenial)
Host glibc: 2.23
/usr/bin/gcc: 5.4.0
glibc: N/A
gcc: N/A
xorg: N/A
$ brew doctor
Your system is ready to brew.

To help us debug your issue please explain:

I was trying to install python@2 and python because they are dependencies of other formulae that I wanted to test (dartsim for example).

They both failed with an error Error: uninitialized constant OS::Mac::CLT

$ brew install python
Error: uninitialized constant OS::Mac::CLT
Please report this bug:
  https://github.com/Linuxbrew/brew/wiki/troubleshooting
/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/python.rb:23:in `block (2 levels) in <class:Python>'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:99:in `pour_bottle?'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:469:in `expand_dependencies'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:381:in `compute_dependencies'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:142:in `verify_deps_exist'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:135:in `prelude'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:324:in `install_formula'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:256:in `block in install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:254:in `each'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:254:in `install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:89:in `<main>'
$ brew install python@2
Error: uninitialized constant OS::Mac::CLT
Please report this bug:
  https://github.com/Linuxbrew/brew/wiki/troubleshooting
/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/python@2.rb:25:in `block (2 levels) in <class:PythonAT2>'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:99:in `pour_bottle?'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:469:in `expand_dependencies'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:381:in `compute_dependencies'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:142:in `verify_deps_exist'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:135:in `prelude'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:324:in `install_formula'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:256:in `block in install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:254:in `each'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:254:in `install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:89:in `<main>'

I expected macOS settings to be ignored on linux.

$ docker run -it linuxbrew/brew bash
linuxbrew@31c9b78e5eb0:~$ brew install python
...
linuxbrew@31c9b78e5eb0:~$ brew install python@2
...
sjackman commented 6 years ago

On Linuxbrew/brew MacOS::CLT.installed? is set to true. https://github.com/Linuxbrew/brew/blob/8f5de98bcc40afe402969dff6794739979b00a09/Library/Homebrew/os/linux.rb#L22-L28

That's a hack though, and not one that I'd like to commit to Homebrew/brew. 44 formulae in Linuxbrew/core use if MacOS::CLT.installed?. I'd rather patch these formulae to instead use if !OS.mac? || MacOS::CLT.installed?.

sjackman commented 6 years ago

Here's a PR to fix this issue: https://github.com/Linuxbrew/homebrew-core/pull/10012

sjackman commented 6 years ago

I merged PR #10012, which should fix this issue!