1

I'm trying to install the ffi gem (so I can run Octopress) on my OS X Mountain Lion and am running into errors.

Running gem install install ffi -v '1.0.11' gives the following output:

/chetanshenoy.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include... no
checking for rb_thread_blocking_region()... yes
checking for ruby_native_thread_p()... yes
checking for rb_thread_call_with_gvl()... yes
creating extconf.h
creating Makefile

make
Configuring libffi
/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/configure: line 642: test: too many arguments
/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/configure: line 642: test: too many arguments
configure: WARNING: Libtool does not cope well with whitespace in `pwd`
cd "/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi" && make
make "AR_FLAGS=" "CC_FOR_BUILD=" "CFLAGS=" "CXXFLAGS=" "CFLAGS_FOR_BUILD=" "CFLAGS_FOR_TARGET=" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c" "JC1FLAGS=" "LDFLAGS=" "LIBCFLAGS=" "LIBCFLAGS_FOR_TARGET=" "MAKE=make" "MAKEINFO=/bin/sh "/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/missing" --run makeinfo " "PICFLAG=" "PICFLAG_FOR_TARGET=" "RUNTESTFLAGS=" "SHELL=/bin/sh" "exec_prefix=/usr/local" "infodir=/usr/local/share/info" "libdir=/usr/local/lib" "prefix=/usr/local" "AR=ar" "AS=as" "CC=gcc-4.2" "CXX=c++" "LD=ld" "NM=/usr/bin/nm" "RANLIB=ranlib" "DESTDIR=" all-recursive
make[2]: *** No rule to make target `HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/missing --run makeinfo '.  Stop.
make[1]: *** [all] Error 2
make: *** ["/Volumes/Secondary] Error 2

Any help is appreciated.

Chetan Shenoy
  • 843
  • 1
  • 10
  • 19
  • can you include `/chetanshenoy.rvm/rubies/ruby-1.9.3-p194/config` - best use [gist](https://gist.github.com) as this file is quite big. – mpapis Aug 13 '12 at 17:34
  • @mpapis Here's the config: [https://gist.github.com/3342924](https://gist.github.com/3342924) – Chetan Shenoy Aug 13 '12 at 19:34
  • this is what I thought - this might be bug in the way `ffi` is installed, ruby has no record of the path with spaces, have you tried latest or pre versions of `ffi`? – mpapis Aug 13 '12 at 21:22
  • yeah I assumed it was a bug. Unfortunately, one of Octopress' dependencies requires that specific version of `ffi`. I'll try to come up with a work around. Thanks and let me know if you have any other thoughts. – Chetan Shenoy Aug 13 '12 at 22:04
  • you use a "fix" for spaces in `$HOME`, you could try to fix it in other way: `sudo rm -rf /chetanshenoy.rvm && sudo mv "/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm" /chetanshenoy.rvm` – mpapis Aug 13 '12 at 22:52
  • yeah, I have 2 drives. I'm going to rename the secondary HDD to take out spaces. What's the safest way to do it without breaking rvm, etc? – Chetan Shenoy Aug 14 '12 at 04:32

2 Answers2

1

It looks like the ffi gem does not like spaces in paths also, as you checked already in the config it's not ruby using this paths, has to be something in the process of compiling the gem.

To make it compile you need to get rid of the spaces, there are few ways:

  1. reinstall rvm in a path without spaces, first you need to change rvm_path location in ~/.rvmrc, this is the "safe" choice,
  2. move rvm directly to the path pointed by rvm_path - sudo rm -rf /chetanshenoy.rvm && sudo mv "/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm" /chetanshenoy.rvm - this should work as ruby has no record of the home directory, but it can not be sure the path with spaces is saved in any location - in case of problems use solution 1.
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • Thanks for the help. I ended up just editing the gem and updating the libffi Makefile. I'll eventually need to figure out how to move `rvm` without screwing up any settings. – Chetan Shenoy Aug 14 '12 at 18:50
1

As stated in Issue with installing ImageMagick and rmagick on Mountain Lion, ffi appears to be configured to look for 'gcc-4.2', so once I updated my Apple command line tools (which I may or may not have needed to do), I created a symbolic link to make the ffi install configuration happy:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Community
  • 1
  • 1
David Vezzani
  • 1,449
  • 16
  • 24