Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

brew info llvm fails when using homebrew/brew #796

Closed
jonchang opened this issue Aug 14, 2018 · 7 comments
Closed

brew info llvm fails when using homebrew/brew #796

jonchang opened this issue Aug 14, 2018 · 7 comments

Comments

@jonchang
Copy link
Contributor

 $ brew config
HOMEBREW_VERSION: 1.7.1-224-ga985f0a
ORIGIN: https://github.com/homebrew/brew.git
HEAD: a985f0a5d0cd7e73ea6cafe842a08aba82cee4b5
Last commit: 33 hours ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: 97c75f4951594304ad99ae2bcdca6525cec05cfd
Core tap last commit: 6 hours ago
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew
HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_CACHE: /home/jonchang/.cache/Homebrew
HOMEBREW_AUTO_UPDATE_SECS: 43200
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_EMOJI: 1
HOMEBREW_VISUAL: /home/linuxbrew/.linuxbrew/bin/vim
CPU: 48-core 64-bit haswell
Homebrew Ruby: 2.3.7 => /home/linuxbrew/.linuxbrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: N/A
Git: 2.18.0 => /home/linuxbrew/.linuxbrew/bin/git
Curl: 7.29.0 => /usr/bin/curl
Java: N/A
Kernel: Linux 3.10.0-862.3.2.el7.x86_64 x86_64 GNU/Linux
OS: CentOS Linux release 7.5.1804 (Core) 
Host glibc: 2.17
/usr/bin/gcc: 4.8.5
glibc: 2.23
gcc: 5.5.0_4
xorg: 20170115_1

brew info llvm fails with:

Error: uninitialized constant OS::Mac::CLT
Please report this bug:
https://github.com/Linuxbrew/brew/wiki/troubleshooting
/home/linuxbrew/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/llvm.rb:259:in build_libcxx?' /home/linuxbrew/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/llvm.rb:409:in caveats'
/home/linuxbrew/.linuxbrew/Library/Homebrew/caveats.rb:17:in caveats' /home/linuxbrew/.linuxbrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/forwardable.rb:202:in empty?'
/home/linuxbrew/.linuxbrew/Library/Homebrew/cmd/info.rb:181:in info_formula' /home/linuxbrew/.linuxbrew/Library/Homebrew/cmd/info.rb:58:in block in print_info'
/home/linuxbrew/.linuxbrew/Library/Homebrew/cmd/info.rb:52:in each' /home/linuxbrew/.linuxbrew/Library/Homebrew/cmd/info.rb:52:in each_with_index'
/home/linuxbrew/.linuxbrew/Library/Homebrew/cmd/info.rb:52:in print_info' /home/linuxbrew/.linuxbrew/Library/Homebrew/cmd/info.rb:41:in info'
/home/linuxbrew/.linuxbrew/Library/Homebrew/brew.rb:87:in `

'

@sjackman
Copy link
Member

sjackman commented Aug 14, 2018

On Linuxbrew/brew, we stub out OS::Mac::CLT.installed? to return true on Linux.

module CLT
module_function
def installed?
true
end
end

We could try sending that patch upstream to Homebrew/brew. It seems dirty though. Better I think would be to patch the formulae to guard OS::Mac::CLT.installed? with if/unless OS.mac?. There are 29 such formulae that also have Linux bottles.

For example…

diff --git a/Formula/llvm.rb b/Formula/llvm.rb
index c7bdbedb2f..7f354713ff 100644
--- a/Formula/llvm.rb
+++ b/Formula/llvm.rb
@@ -256,7 +256,7 @@ class Llvm < Formula
   end
 
   def build_libcxx?
-    build.with?("libcxx") || !MacOS::CLT.installed?
+    build.with?("libcxx") || (OS.mac? && !MacOS::CLT.installed?)
   end
 
   # Clang cannot find system headers if Xcode CLT is not installed

@jonchang
Copy link
Contributor Author

I have a list of 77 formula that fail brew info for similar reasons. I'll open a pull request over at linuxbrew/core with that fix.

@jonchang
Copy link
Contributor Author

There's a lot of depends_on :xcode. It might make more sense to make depends_on :xcode to imply depends_on :macos.

@sjackman
Copy link
Member

There's a few formulae that have depends_on :xcode that do have depends_on :xcode but also have a bottle for x86_64_linux, such as libmxml.rb. I'm inclined to change depends_on :xcode to depends_on :xcode if OS.mac? where needed. 79 formulae have depends_on :xcode

@jonchang
Copy link
Contributor Author

I just did a blanket change with sed, see https://github.com/Linuxbrew/homebrew-core/pull/8862

@iMichka
Copy link
Member

iMichka commented Aug 14, 2018

I think depends on Xcode does not imply Xcode is needed on Linux. It just means that you need Xcode on Mac.

@maxim-belkin
Copy link
Contributor

Good job, everyone! 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants