Brew Install Ruby-Build fails with: cannot run C compiled programs - ruby

i'm trying to install ruby using Homebrew, but every time i try I get this:
==> Installing dependencies for ruby-build: pkg-config, makedepend, opens
==> Installing ruby-build dependency: pkg-config
==> Downloading http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz
Already downloaded: /Library/Caches/Homebrew/pkg-config-0.28.tar.gz
==> ./configure --prefix=/usr/local/Cellar/pkg-config/0.28 --disable-host-tool -
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/private/tmp/pkg-config20150616-3766-1f5xqh9/pkg-config-0.28':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
What should I do?

if you install xcode-beta,you should run commond like this:
sudo xcode-select -switch /Applications/Xcode-beta.app/Contents/Developer

Try running this command : xcode-select --install. it works for me

Related

brew install gcc49 on OS X 10.10 (Unable to find a usable ISL)

When I try to install gcc49, I receive an error
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-versions/master/gcc49.rb
######################################################################## 100.0%
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-4.9.3/gcc-4.9.3.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gcc49-4.9.3.tar.bz2
==> ../configure --build=x86_64-apple-darwin14.5.0 --prefix=/usr/local/Cellar/gcc49/4.9.3 --libdir=/usr/local/Cellar/gcc49/4.9.3/lib/gcc/4.9 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9 --w
checking for version 0.10 of ISL... no
checking for version 0.11 of ISL... no
checking for version 0.12 of ISL... no
checking for version 0.14 of ISL... no
configure: error: Unable to find a usable ISL. See config.log for details.
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
READ THIS: https://git.io/brew-troubleshooting
However, I do have ISL:
$ brew info isl
isl: stable 0.14.1 (bottled), HEAD
Integer Set Library for the polyhedral model
http://freecode.com/projects/isl
/usr/local/Cellar/isl/0.14.1 (68 files, 3.2M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/isl.rb
==> Dependencies
Build: xz ✔
Required: gmp ✔
I do not know where is the config.log located.
The correct way to install GCC 4.9 is to use
$ brew install homebrew/versions/gcc49
This way Homebrew will correctly resolve the missing dependencies and install them for you. You can find this version of gcc (or any other) using
$ brew search gcc49
homebrew/versions/gcc49
or
$ brew search gcc
gcc homebrew/versions/gcc47
homebrew/dupes/apple-gcc42 homebrew/versions/gcc48
homebrew/versions/gcc43 homebrew/versions/gcc49
homebrew/versions/gcc44 homebrew/versions/gcc5
homebrew/versions/gcc45 homebrew/versions/llvm-gcc28
homebrew/versions/gcc46
However, the dependency you are missing is not isl but isl011. You can install it with
$ brew install isl011
We can see that this is a dependency of gcc49 with
$ brew info gcc49
==> Dependencies
Required: gmp4 ✔, libmpc08 ✔, mpfr2 ✔, cloog018 ✔, isl011 ✔
The problem is caused by updated Xcode. Need run : "$ xcode-select --install"

How do I install DevIL with homebrew on mac?

I entered this:
brew install devil
and got this:
Error: devil cannot be built with any available compilers.
To install this formula, you may need to:
brew install gcc
So I reinstalled gcc and got this:
Toms-MBP:~ tom$ brew install gcc
==> Downloading https://homebrew.bintray.com/bottles/gcc-5.2.0.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring gcc-5.2.0.yosemite.bottle.1.tar.gz
==> Caveats
GCC has been built with multilib support. Notably, OpenMP may not work:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
If you need OpenMP support you may want to
brew reinstall gcc --without-multilib
==> Summary
🍺 /usr/local/Cellar/gcc/5.2.0: 1353 files, 248M
But I keep getting the same error when I try to install DevIL

brew install gcc46 fails with Clang/xcrun error

I'm trying to use RVM to install ruby 1.9.2 and 1.9.3. It fails because one of the dependencies seems to be gcc46, and rvm uses brew to install it.
rbanerjee:~ $ sudo brew install gcc46
==> Installing dependencies for gcc46: gmp4, mpfr2, libmpc08, ppl011, cloog-ppl015
==> Installing gcc46 dependency: gmp4
==> Downloading ftp://ftp.gmplib.org/pub/gmp-4.3.2/gmp-4.3.2.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gmp4-4.3.2.tar.bz2
==> Patching
==> ./configure --prefix=/usr/local/Cellar/gmp4/4.3.2 --enable-cxx --build=x86_64-apple-darwin
checking ABI=64
checking compiler clang ... no
checking ABI=32
checking compiler clang ... no
configure: error: could not find a working compiler, see config.log for details
but clang is there and working:
rbanerjee:~ $ which clang
/usr/bin/clang
rbanerjee:~ $ clang -v
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
Weird that the version is 4.2, since I have Xcode 4.6.3 and command line tools 4.6.3 installed. xcrun seems to be a problem too. Digging through the gcc46 logs leads to a failure to install gmp4:
in ~/Library/Logs/Homebrew/gmp4/config.log
/usr/local/Library/ENV/4.3/clang:338:in `exec': No such file or directory - xcrun (Errno::ENOENT)
from /usr/local/Library/ENV/4.3/clang:338
Any ideas? Thanks in advance. OSX Lion. Here's all my system info:
https://gist.github.com/anonymous/9e2cdb6c0d0ca0b29eba

How to link to a new gcc version with brew?

I just got a new gcc version by running brew update and brew upgrade. brew complained that brew link did not complete successfully:
~
✓ brew upgrade
==> Upgrading 1 outdated package, with result:
gcc 4.8.2_1
==> Upgrading gcc
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gcc-4.8.2_1
######################################################################## 100,0%
==> Pouring gcc-4.8.2_1.mavericks.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using:
brew link gcc
Possible conflicting files are:
/usr/local/bin/gfortran -> /usr/local/Cellar/gfortran/4.8.2/bin/gfortran
/usr/local/share/man/man1/gfortran.1 -> /usr/local/Cellar/gfortran/4.8.2/share/man/man1/gfortran.1
So I ran brew link gcc manually:
~
✓ brew link gcc
Linking /usr/local/Cellar/gcc/4.8.2... 25 symlinks created
Now when I tell brew to clean up I get the following warning:
~
✓ brew cleanup
Warning: Skipping (old) /usr/local/Cellar/gcc/4.8.2 due to it being linked
There are two gcc version in my Cellar:
~
✓ ls /usr/local/Cellar/gcc
4.8.2 4.8.2_1
Do I need both? I would like to remove the old version. How can I achieve that?
I solved it by running the following commands
brew unlink gcc
brew rm gfortran
brew cleanup
brew link gcc
It seems that gfortran was linked to the old gcc version.

Permissions Error installing ruby via homebrew via chef via vagrant on osx

I am trying to install ruby using homebrew, using chef, run by a vagrant script in a VMWare fusion VM running mac os x 10.8.5.
During the ruby install, I get the following error:
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of brew install ruby ----
STDOUT: ==> Installing dependencies for ruby: pkg-config, readline, libyaml, openssl
==> Installing ruby dependency: pkg-config
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pkg-config- 0.28.mountain_lion.bottle.tar.gz
==> Pouring pkg-config-0.28.mountain_lion.bottle.tar.gz
🍺 /usr/local/Cellar/pkg-config/0.28: 10 files, 636K
==> Installing ruby dependency: readline
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/readline-6.2.4.mountain_lion.bottle.tar.gz
==> Pouring readline-6.2.4.mountain_lion.bottle.tar.gz
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.
OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/readline/lib
CPPFLAGS: -I/usr/local/opt/readline/include
==> Summary
🍺 /usr/local/Cellar/readline/6.2.4: 31 files, 1.6M
==> Installing ruby dependency: libyaml
==> Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
STDERR: Error: Permission denied - /var/root/Library/Logs
---- End output of brew install ruby ----
Ran brew install ruby returned 1
I also got this error when I tried to install rbenv using homebrew, which failed installing autoconf. I am not sure why it's trying to access /var/root/. When I run "brew install autoconf" from the VM, it installs fine.
I also tried adding:
node.default['homebrew']['owner'] = 'vagrant'
to my recipe just to make sure that the homebrew install was using the local user, but it made no difference.
My recipe looks like this:
# required for homebrew
bash "take-usr-local-ownership" do
user "vagrant"
cwd "/"
code <<-EOH
sudo mkdir -p /usr/local
sudo chown -R `whoami`:staff /usr/local
EOH
end
include_recipe 'homebrew'
# Install each of the packages using the `package` resource
%w(ruby).each do |package|
package package
end
Any ideas?
The syntax from the chef doc looks like this:
package "ruby" do
action :install
end
So that may be part of the issue.
The other thing is, who is homebrew installed by? Root? Vagrant? I assume you have to set that somewhere, not just who uses brew install.

Resources