Repository: rvm/rvm

Issue #1138: Use `xcode-select -print-path` instead of Xcode Command Line Tools.
Created: 2012-09-26T19:50:33Z
RVM assumes that my system headers are in my system folders, but they're actually inside my Xcode folder.
Instead of assuming, RVM should do something like:
`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/ # but don't assume 10.8 either

For more info man xcode-select:

-print-path
Prints the path of the current Xcode folder. This is a recommended way for scripts and other tools to locate the current Xcode folder.

What Xcode says about Command Line Tools:

Before installing, note that from within Terminal you can use the XCRUN tool to launch compilers and other tools embedded within the Xcode application. Use the XCODE-SELECT tool to define which version of Xcode is active.  Type "man xcrun" from within Terminal to find out more.
Downloading this package will install copies of the core command line tools and system headers into system folders, including the LLVM compiler, linker, and build tools.

NB:  CC="xcrun gcc-4.2" did not work on Mac OS X 10.8.2 (12C54). See below:
$ CC="xcrun gcc-4.2" rvm pkg install libyaml
Fetching yaml-0.1.4.tar.gz to ~/.rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  460k  100  460k    0     0   201k      0  0:00:02  0:00:02 --:--:--  259k
Extracting yaml-0.1.4.tar.gz to ~/.rvm/src
Configuring yaml in ~/.rvm/src/yaml-0.1.4.
Error running './configure --prefix=~/.rvm/usr', please read ~/.rvm/log/yaml/configure.log
Compiling yaml in ~/.rvm/src/yaml-0.1.4.
Error running 'make', please read ~/.rvm/log/yaml/make.log

Please note that it's required to reinstall all rubies:

    rvm reinstall all --force

$ cat ~/.rvm/log/yaml/configure.log
[2012-10-04 16:55:21] ./configure --prefix=~/.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)... yes
checking for gcc... xcrun gcc-4.2
checking whether the C compiler works... no
configure: error: in `~/.rvm/src/yaml-0.1.4':
configure: error: C compiler cannot create executables
See `config.log' for more details

$ cat ~/.rvm/log/yaml/make.log 
[2012-10-04 16:55:23] make
make: *** No targets specified and no makefile found.  Stop.

Duplicate issue #1139: Cannot Set CFLAGS
Created: 2012-09-26T20:17:07Z
I tried setting CFLAGS with ~/.rvmrc.
[~]$ cat ~/.rvmrc 
rvm_configure_env=(LDFLAGS=-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include)

But, that didn't help rvm pkg install openssl find my system headers: https://gist.github.com/3789921

Closing comment (2012-10-04T21:18:05Z): the final solution was in ~/.rvmrc:
rvm_configure_flags=(-I`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -L`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib)

related to #1138 & https://gist.github.com/3789921