Mac OS X Lion Xcode problems using RVM - ruby

I had Xcode 4.1 preview 5 working fine but decided to upgrade to the final xcode 4.1 thru the App store. I uninstalled Xcode first...
sudo /Developer/Library/uninstall-devtools –mode=all
Then installed Xcode thru the app store and rebooted.
I also removed RVM completely but... now whenever I try and install a version of Ruby it fails. In the error file i get this:
[2011-07-27 18:29:25] ./configure --prefix="/Users/holden/.rvm/usr"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking for gcc... /usr/bin/gcc-4.2
checking whether the C compiler works... no
configure: error: in `/Users/holden/.rvm/src/yaml-0.1.4':
configure: error: C compiler cannot create executables
See `config.log' for more details
There is no gcc-4.2 or any other gcc in the /usr/bin directory.
What's up with Xcode?

Apparently even after downloading and "installing" XCode from the Appstore and despite the long process after downloading where it appears to install it and the words "Installed" eventually become displayed next to it in the store. You must still manually install it again within your applications folder before it will work.
Odd.

Just bought a Mac,
what I had to do to make it work after installing Xcode and seeing that /usr/bin doesn't have gcc, was:
Enter Xcode preferences going over to the downloads tab and install Command Line Tools.
After setting up my developer account and downloading the tools I opened terminal and typed
rvm install 1.9.3 --with-gcc=clang
and everything compiled and works.

Note - after running "Install Xcode" I still only have "gcc" in /usr/bin, not gcc-4.2. But still worked fine, /usr/bin/gcc was a symlink to /usr/bin/llvm-gcc-4.2

Guy's answer above seems to fix the problem compiling Ruby in RVM with XCode 4.2 installed completely, and removed for me to install GCC from https://github.com/kennethreitz/osx-gcc-installer . This is preferable for users needing to have both RVM and XCode 4.2 installed.

Related

Installing valgrind on Mac OS X Catalina [duplicate]

I tried to install Valgrind with the command "brew install valgrind" and I get a message that says:
"valgrind: This formula either does not compile or function as expected on macOS versions newer than Sierra due to an upstream incompatibility. Error: An unsatisfied requirement failed this build."
I also tried to "brew edit valgrind" and replace "sourceware.org/git/valgrind.git" with "git://sourceware.org/git/valgrind.git" in head section of the code, then wrote on Iterm "brew install --HEAD valgrind" but it gives me:
Last 15 lines from /Users/m/Library/Logs/Homebrew/valgrind/02.configure:
checking for gcc-ar... no
checking for perl... /usr/bin/perl
checking for gdb... /no/gdb/was/found/at/configure/time
checking dependency style of clang... none
checking for diff -u... yes
checking for clang option to accept ISO C99... none needed
checking for a supported version of gcc... ok (clang-11.0.0)
checking build system type... x86_64-pc-darwin
checking host system type... x86_64-pc-darwin
checking for a supported CPU... ok (x86_64)
checking for a 64-bit only build... yes
checking for a 32-bit only build... no
checking for a supported OS... ok (darwin)
checking for the kernel version... unsupported (19.0.0)
configure: error: Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x and 17.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12/13)
READ THIS: https://docs.brew.sh/Troubleshooting
See https://github.com/LouisBrunner/valgrind-macos/.
Either try
brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
Or compile it from the source, if the above method doesn't work. (But they should have fixed the above method just recently.)
git clone https://github.com/LouisBrunner/valgrind-macos.git
cd valgrind-macos
./autogen.sh
./configure --prefix=/where/you/want/it/installed --enable-only64bit
make
sudo make install
Enjoy!
https://github.com/sowson/valgrind
brew install --HEAD https://raw.githubusercontent.com/sowson/valgrind/master/valgrind.rb
MacOS Catalina (10.15.4), I was able to confirm the operation.

Configure error installing Ruby 1.9.3 on Mac OS 10.10 with rvm and Homebrew

Note for those thinking of marking this duplicate: yes, my XCode tools are installed and up to date.
I started this morning with a system having neither rvm or Homebrew, and was able to install rvm and Ruby 1.9.3 successfully after overriding the default Homebrew installation directory, changing it from /usr/local to /opt/brew.
This afternoon, though, after seeing various warnings about possible weird behavior for some Homebrew recipes if installed anywhere other than /usr/local, I decided to blow all that away and reinstall with Homebrew in the default location.
Now, what worked this morning doesn't work: I get the error below (from configure.log):
[2015-02-04 15:39:24] ./configure
current path: /Users/dmoles/.rvm/src/ruby-1.9.3-p551
PATH=/usr/local/opt/gcc48/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/dmoles/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/ImageMagick/bin:/opt/bin:/opt/apache-ant-1.9/bin:/opt/apache-maven-3/bin:/opt/apache-tomcat-8.0.15/bin:/Users/dmoles/.rvm/bin:/usr/local/bin
command(7): ./configure --prefix=/Users/dmoles/.rvm/rubies/ruby-1.9.3-p551 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --without-tcl --without-tk --disable-install-doc --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... x86_64-apple-darwin14.1.0
checking host system type... x86_64-apple-darwin14.1.0
checking target system type... x86_64-apple-darwin14.1.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/dmoles/.rvm/src/ruby-1.9.3-p551':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
My guess is that this morning it was using the XCode toolchain, and this afternoon it's using Homebrew's, which for some reason isn't working. But it's not clear to me just how that would happen, since I can see above that rvm is playing various games with $PATH. (My usual $PATH: /Users/dmoles/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/ImageMagick/bin:/opt/bin:/opt/apache-ant-1.9/bin:/opt/apache-maven-3/bin:/opt/apache-tomcat-8.0.15/bin:/Users/dmoles/.rvm/bin -- without all the /usr/local/opt at the beginning or the extra /usr/local/bin at the end.)
My rvm version is 1.26.10; gcc-48 is Homebrew gcc48 4.8.4.

OS X 10.9.2: checking whether the C compiler works... no

I'm attempting to install texinfo 5.2, and I'm running into some issues during ./configure, which I believe are related to the C compiler. When I upgraded from Snow Leopard, I didn't perform a clean install, so perhaps that's part of the problem. Anyway, here's what I've got:
ryansmacbook:texinfo-5.2 ryan$ sudo ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" CPP="gcc -E" CXXCPP="g++ -E"
Password:
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking for perl... /usr/bin/perl
checking Perl version and Encode module... yes
checking for gawk... (cached) awk
checking for gcc... gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64
checking whether the C compiler works... no
configure: error: in `/Users/ryan/Downloads/texinfo-5.2':
configure: error: C compiler cannot create executables
See `config.log' for more details
I've read some of the other questions related to this, so I attempted to install Command Line Tools.
ryansmacbook:~ ryan$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
So it seems they're not installed, although I'm running Xcode 5.1 installed from the App Store. From what I've read, Command Line Tools should be installed, but I've tried
$ xcode-select --install
anyway, and when I tell it to install, a message pops up saying "Can't install software because it is not currently available from the Software Update server."
I found what I thought might be a work-around at http://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/, so I did the following:
ryansmacbook:Tools ryan$ brew install coreutils
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.
==> Downloading http://ftpmirror.gnu.org/coreutils/coreutils-8.22.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/coreutils/8.22 --program-prefix=g --w
==> make install
==> Caveats
All commands have been installed with the prefix 'g'.
If you really need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
/usr/local/share/info/dir: Permission denied
==> Summary
🍺 /usr/local/Cellar/coreutils/8.22: 211 files, 10M, built in 2.4 minutes
But I still have the ./configure issue.
For reference,
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
Although I did attempt to install gcc-4.7 the other day, and it's currently living at
/usr/gcc-4.7.2/bin/gcc-4.7
I'm not quite sure how to get it to run as a command from the command line because
$ gcc-4.7 --version
-bash: gcc-4.7: command not found
is what I'm getting now, but that may be neither here nor there.
edit: Since this doesn't directly answer my question about checking whether the C compiler works, I'm not submitting this as an answer. I just tried brew install texinfo, and that worked like a charm. At this point, I can't really remember why I was trying to install texinfo from source nor can I remember what I needed it for (maybe something GNU Make-related or Emacs-related?).
I faced this same problem after installing xcode; All I had to do was run gcc. This then asked me to accept the xcode license. After, it just worked fine.
Hope this helps someone.
I can't really take credit for the answer, but the same things happened to me. I tried to get a ruby-1.9.3 ruby. RVM grabed gcc46 and told homebrew to install it. But then the rvm install command didn't like that. So brew uninstall gcc46 and then brew install apple-gcc42 worked like a charm.
For me the issue was I had not run
xcode-select --install
Once I did that everything ran fine
sudo ln -s \
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ \
/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain
I encountered this while setting up a React Native project. This solution worked.
sudo xcode-select --switch /Applications/Xcode.app
sudo gcc --version
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
I had similar "checking whether the C compiler works... no" problem in my yosemite mac.
I checked some things:
$ which gcc
gcc: aliased to nocorrect gcc
$ ll /usr/bin/gcc
-rwxr-xr-x 1 root wheel 14K 27 Sep 04:06 /usr/bin/gcc
$ gcc
gcc: fatal error: no input files
compilation terminated.
$ gcc --version
gcc: warning: couldn't understand kern.osversion '14.0.0
gcc (GCC) 4.8.3
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Then I installed it doing:
$ brew install gcc
Error: You must `brew link cloog' before gcc can be installed
$ brew link cloog
Linking /usr/local/Cellar/cloog/0.18.1... 8 symlinks created
$ brew install gcc
Error: gcc-4.8.3 already installed
To install this version, first `brew unlink gcc'
$ brew unlink gcc
Unlinking /usr/local/Cellar/gcc/4.8.3... 39 symlinks removed
$ brew install gcc
....
And it worked:
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
Similar problem while installing python3. My home brew was out dated. I simply update my home brew utility.
I faced a similar problem but my situation was different.
I had the Xcode with spaces in the app name removing those spaces fixed the problem:
sudo xcode-select --switch /Applications/Xcode14.0.app

configure: error: C compiler cannot create executables with Mavericks

I've checked stackoverflow but haven't found an answer yet.
I'm trying to install wget on Mavericks as shown here.
Here's what I'm getting:
bolo:wget-1.14 Michelin$ subl config.log
bolo:wget-1.14 Michelin$ ./configure --with-ssl=openssl
configure: configuring for GNU Wget 1.14
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... build-aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking build system type... i386-apple-darwin13.0.0
checking host system type... i386-apple-darwin13.0.0
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/Michelin/Downloads/wget-1.14':
configure: error: C compiler cannot create executables
See `config.log' for more details
My config.log:
https://gist.github.com/bolom/7552389
Other thing I have installed Command Line tools BUT I don't the assembler :(
B.
Below solved this for me in Mavericks. I had to use sudo for this to work.
From https://trac.macports.org/wiki/ProblemHotlist
Xcode License Agreement
When attempting to build a port which compiles an OS X app (e.g., gimp-app), the compilation may fail with an xcodebuild error. One of the possible causes of this is that an initial run of xcodebuild from the terminal may be needed to accept the EULA before any compilation can proceed. Run:
xcodebuild -license
from a terminal window and follow the prompts. After accepting the EULA, rebuild the port again.
With some ports and some versions of Xcode (e.g. libunwind-headers with Xcode 4.4+) you may need to accept the license as root, i.e.:
sudo xcodebuild -license
This will need to be repeated after any Xcode upgrade.
i'd suggest using homebrew (http://brew.sh/) to install wget:
brew install wget
an additional note for others out there: upgrading your command line tools for Mavericks is easy like this: http://www.computersnyou.com/2025/
I came across the same issue when working with Mac Ports for the first time.
When you newly install Xcode and command line tools, there's a license agreement you have to agree to first before the tools (and indeed Xcode) actually work.
Bring up a terminal session and type "ac" (no quotes)
You will be prompted to accept the license agreement. Page down and enter 'agree' at the end.
You should then be good too go!
Compiles worked for me from that point on.
Cheers

Upgrading to Ruby 1.9 on Mac OSX 10.4

I have an older powerbook running 10.4. It has Ruby 1.8.2 on it but I want to upgrade to 1.9. Other people suggested using macports and I tried it but am getting some weird errors. Can anyone assist?
sudo port install ruby19 +nosuffix
---> Computing dependencies for ruby19
---> Configuring gperf
Error: Target org.macports.configure returned: configure failure: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_gperf/work/gperf-3.0.4" && ./configure --prefix=/opt/local --infodir=/opt/local/share/info " returned error 1
Command output: checking whether make sets $(MAKE)... yes
configure: creating ./config.status
config.status: creating Makefile
=== configuring in lib (/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_gperf/work/gperf-3.0.4/lib)
configure: running /bin/sh ./configure '--prefix=/opt/local' '--infodir=/opt/local/share/info' --cache-file=/dev/null --srcdir=.
checking whether make sets $(MAKE)... yes
checking for gcc... /usr/bin/gcc-4.0
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
configure: error: ./configure failed for lib
Error: The following dependencies failed to build: libiconv gperf ncurses ncursesw openssl zlib readline
Error: Status 1 encountered during processing.
Before reporting a bug, first run the command again with the -d flag to get complete output.
You need to install Xcode. I think the latest for 10.4 is Xcode 2.5. From http://www.macports.org/install.php :
Please note that in order to install and run MacPorts on Mac OS X, your system must have installations of the following components:
Apple's Xcode Developer Tools (version 3.2.1 or later for Snow Leopard,
3.1.4 or later for
Leopard, or 2.5 for Tiger), found at the Apple Developer Connection
site or on your Mac OS X installation CDs/DVD. Ensure that the optional components for command line development are installed ("Unix Development" in the Xcode 3.x installer).
The X11 windowing environment (A.K.A. “X11 User”) for ports that depend on the functionality it provides to run.
*The “X11 User” package is an optional installation on your system CDs/DVD for Tiger, enabled through the “Customize” button of the installer, whereas it is included by default on Leopard and Snow Leopard.
*You can use the xorg-server port instead of Apple's X11.app if you wish.
Check your mac installation disc or download it from apple here (you'll need ADC membership which is free):
http://developer.apple.com/technology/xcode.html

Resources