`brew upgrade <package>`: "<package> cannot be built with any available compilers" - ruby-on-rails

For example, I tried to run brew upgrade ruby-build.
That failed with error:
CompilerSelectionError: ruby-build cannot be built with any available compilers.
Install GNU's GCC
brew install gcc
When I ran brew install gcc , I got:
Warning: Building gcc from source:
The bottle needs the Xcode CLT to be installed.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: An exception occurred within a child process:
CompilerSelectionError: gcc cannot be built with any available compilers.
Install GNU's GCC
brew install gcc
How can I upgrade ruby-build via brew?

I ran this command and it now works:
xcode-select --install

I had to reset xcode to the default command line tools path with
sudo xcode-select -r
for this to work

Related

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)

I tried to upgrade with Brew
$ brew upgrade stripe/stripe-cli/stripe
I got:
Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.
AS suggested, I tried
$ arch -arm64 brew install
But got:
Error: Invalid usage: This command requires at least 1 formula or cask argument.
I tried installing Rosetta 2 according to this tutorial
$ /usr/sbin/softwareupdate --install-rosetta --agree-to-license
But I got:
Installing Rosetta 2 on this system is not supported.
Seems homebrew has to be used like this from now on:
arch -arm64 brew upgrade
I added the original argument to arch -arm64 brew upgrade and it worked
$ arch -arm64 brew upgrade stripe/stripe-cli/stripe
Well, all other answers seemed like a workaround for me, I would recommend to do this
cd /opt
sudo mkdir homebrew
sudo chown $(whoami):admin homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
Then just reload terminal and your brew install xxx should work just fine.

K framework installation repeatedly fails on MacBookPro 19 OS X Mojave 10.14.6

I am trying to install Kframework without success. I installed all the dependencies following instructions at https://github.com/kframework/k/tree/master#prerequisite-install-guide and updated the environment variables as suggested.
I have export PATH="~/z3-4.8.7-x64-osx-10.14.6/bin:$PATH" .
I am running:
brew uninstall kframework
brew uninstall z3, and uninstall the version installed outside of brew
brew clean && brew update && brew upgrade
brew install z3 kframework
Brew install kframework produces the following warning about Command Line Tools:
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
and eventually ends with
<<< ERROR!
143 org.kframework.utils.errorsystem.KEMException: [Error] Critical: Could not start z3 pr ocess (IOException: Cannot run program "z3": error=2, No such file or directory)(Even though my CLT are up to date and installed in the right place ).
My CommanLineTools seem legit. I have Xcode Version 11.3.1 (11C505),
and have installed CommanLineTools from a binary I downloaded from apple development site Command_Line_Tools_for_Xcode_11.3.1.dmg
Typing "xcode-select -p" gives
/Library/Developer/CommandLineTools
my z3 is : z3 -version
Z3 version 4.8.7 - 64 bit (binary downloaded from z3 website) .
I tried this also with Z3 version 4.8.12
Any advice appreciated.

Can't install cocoapods on macOS Big Sur

I am using MacOS Big Sur 11.0 Beta.
I tried to install cocoapods but I can't.
First, I tried with;
sudo gem install cocoapods
It says
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
Then, I tried with;
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew cleanup -d -v
brew install cocoapods --build-from-source (also tried with "brew install cocoapods")
It says
Error: pkg-config: no bottle available!
You can try to install from source with:
brew install --build-from-source pkg-config
So, I tried brew install --build-from-source pkg-config, and it says Error: macOS '10.16' is invalid.
Anybody can help me?

Trouble with brew install devil

RGBDSLAM install is asking for devil
$ rosdep install rgbdslam
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
rgbdslam: No definition of [libdevil-dev] for OS [osx]
But when I try to install devil I'm getting this:
$ brew install devil
Error: devil cannot be built with any available compilers.
To install this formula, you may need to:
brew install gcc
$ brew install gcc
Warning: gcc-5.3.0 already installed
How can I get around this?
Note: I have xcode installed accompanied with the command line tools.
** EDIT libdevIL installed **
for some reason gcc 5 doesn't register when devIL is looking for gcc so I had to downgrade to 4.9.
$ brew rm gcc // removes 5
$ brew install gcc49 // installs 4.9
$ brew install devil // works
$ brew install gcc // two gcc installed? this might be interesting
rgbdslam still isn't detecting libdevIL though, not sure what the deal is.
Here's some helpful notes from answers.ros.org
I set siftgpu_disable_devil = 0 in SiftGPU/makefile and
set(ENV{SIFT_GPU_MODE} 0) in CMakeLists.txt with no avail. I'm
still seeing rgbdslam: No definition of [libdevil-dev] for OS [osx]
Commenting devIL out in package.xml put me a little further but
into some seemingly OSX specific issues, trying to resolve those via
github. Will respond here once I have a solution. Thanks for your
assistance.

Installing bcrypt gem failed

gem install bcrypt
Building native extensions. This could take a while...
ERROR: Error installing bcrypt:
ERROR: Failed to build gem native extension.
/Users/mohit/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb
creating Makefile
make clean
make
compiling bcrypt_ext.c
make: /usr/local/opt/gcc46/bin/gcc-4.6: No such file or directory
make: *** [bcrypt_ext.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/mohit/.rvm/gems/ruby-1.9.3-p547/gems/bcrypt-3.1.9 for inspection.
Results logged to /Users/mohit/.rvm/gems/ruby-1.9.3-p547/extensions/x86_64-darwin-13/1.9.1/bcrypt-3.1.9/gem_make.out
Edit with additional info from the OP:
$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
$ brew doctor
Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be
undone should you later need to do so for some reason.
cd /usr/local/Library && git stash && git clean -d -f
$ brew info gcc
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require':
cannot load such file -- global (LoadError) from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:
in require' from /usr/local/Library/brew.rb:16:in `<main>'
$ gcc -v
Configured with:
--prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0 Thread model: posix
$ ls -ladg /usr/local/opt/gcc*
No such file or directory
OSX help
Try installing XCode, which tends to be a huge download:
$ xcode-select --install
If the result is anything like this message below, that's ok for now.
command line tools are already installed,
use "Software Update" to install update
Update OSX to ensure it's ok and current:
Apple Menu -> About This Mac -> Software Update
Verify you have a current system, 10.10 as of this writing:
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10
BuildVersion: 14A389
Brew help
If you use the homebrew package manager, what version? (Please post output)
$ brew --version
Verify brew is healthy:
$ brew doctor
If the doctor finds any errors, fix these. For example, doctor may say to do this, so do it:
cd /usr/local/Library && git stash && git clean -d -f –
When doctor says everything is fine, then bring brew current:
$ brew update
$ brew upgrade
Is homebrew adding GCC? (Please post output)
$ brew info gcc
GCC help
Is GCC available?
$ command -v gcc
/usr/bin/gcc
See if your CC compiler variable is blank or set. (Please post the output)
$ echo $CC
What GCC version are you running? (Please post the output)
$ gcc -v
...
Apple LLVM version 6.0 (clang-600.0.34.4) (based on LLVM 3.5svn)
...
Do you have any GCC installed where Ruby is looking? (Please post the output)
$ ls -ladg /usr/local/opt/gcc*
lrwxr-xr-x 1 admin 21 Dec 18 16:41 /usr/local/opt/gcc -> ../Cellar/gcc/4.9.2_1
Root gem help
Does the gem install if you're root?
$ sudo su -
$ gem install bcrypt
The root problem here is that ruby itself comes with bcrypt version 3.1.5 which is having bugs with the newer updates. However when you install or uninstall the bcrypt you are leving behind bcrypt-ruby which it always asks for first and hence all what you are doing won't go through so what to do ? 1- uninstall bcrypt and bcrypt-ruby by running these two commands:
$ gem uninstall bcrypt
and
$ gem uninstall bcrypt-ruby
2- Install it again with
gem install bcrypt --platform=ruby
In your Gemfile write gem 'bcrypt','~>3.1.11'
NOW as i write these lines the latest version is 3.1.11 but whatever version is updated just add it from their gem page. Run bundle install and it should work just fine.
I hope you fully understand the solution and the mechanism of it hence you would know that bundle install might cause the same issue so you have to repeat this process and it'll work again.
Stuck working on an old project I was able to get the gem installed by using the following steps (check you own paths - don't just copy paste):
1) Install the specific version of gcc required (check the version) :
brew install gcc46
2) Symlink the installed gcc directory :
ln -s /usr/local/Cellar/gcc\#4.6/4.6.4_2 /usr/local/Cellar/gcc46/4.6.4
3) Install the gem reporting the error (check your gem name)
gem install bcrypt-ruby -v '3.0.1'

Resources