13

I am attempting to install a gem, and I get this error, which myself and the gem author have never seen before. How do I fix this?

Davids-MacBook-Pro:web david$ sudo /usr/bin/gem install compass --pre
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing compass:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... yes
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... no
checking for rb_thread_blocking_region()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... no
creating extconf.h
creating Makefile

make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
Call.c:303:5: warning: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Wimplicit-function-declaration]
rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL);
^
./Thread.h:78:39: note: expanded from macro 'rbffi_thread_blocking_region'
# define rbffi_thread_blocking_region rb_thread_call_without_gvl
                                  ^
1 warning generated.
compiling ClosurePool.c
compiling DataConverter.c
DataConverter.c:43:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
1 warning generated.
compiling DynamicLibrary.c
compiling ffi.c
compiling Function.c
Function.c:479:33: warning: incompatible pointer types passing 'VALUE (void *)' to parameter of type 'void *(*)(void *)' [-Wincompatible-pointer-types]
    rb_thread_call_with_gvl(callback_with_gvl, &cb);
                            ^~~~~~~~~~~~~~~~~
Function.c:102:46: note: passing argument to parameter 'func' here
extern void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
                                         ^
Function.c:563:9: warning: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Wimplicit-function-declaration]
    rb_thread_call_without_gvl(async_cb_wait, &w, async_cb_stop, &w);
    ^
Function.c:738:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
3 warnings generated.
compiling FunctionInfo.c
compiling LastError.c
compiling LongDouble.c
compiling MappedType.c
compiling MemoryPointer.c
compiling MethodHandle.c
compiling Platform.c
compiling Pointer.c
compiling Struct.c
compiling StructByReference.c
compiling StructByValue.c
compiling StructLayout.c
compiling Thread.c
compiling Type.c
compiling Types.c
compiling Variadic.c
linking shared-object ffi_c.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [ffi_c.bundle] Error 1


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3/ext/ffi_c/gem_make.out
David Williams
  • 8,388
  • 23
  • 83
  • 171
  • 1
    Try using something like `rvm` or `rbenv` instead of installing Ruby through what I assume is `brew`. – Justin Wood May 02 '14 at 13:25
  • 1
    seems something similar? http://stackoverflow.com/questions/22352838/ruby-gem-install-json-fails-on-mavericks-and-xcode-5-1-unknown-argument-mul – Alex May 07 '14 at 08:15

4 Answers4

17

If this is occuring in OSX Mavericks, please ensure the command line tools are installed by running the following.

Older editions of OSX & XCode had the install for Command Line Tools in the XCode IDE itself. In OSX Mavericks I had to run the commands below to fix my command line tools so that I could install rubygems using native extensions.

$ sudo xcode-select --install
$ xcode-select --print-path
/Library/Developer/CommandLineTools
Chris
  • 788
  • 4
  • 11
  • Did you read the bounty description? The install command no longer works http://imgur.com/yNM2RRC – David Williams May 07 '14 at 23:09
  • My apologies; I must have skipped over the final link. I am taking a look at the other images and I'll update if I think of something. – Chris May 08 '14 at 01:00
  • 2
    You can download the command line tools directly from apple's website. Log in, and it should be a couple of entries down. https://developer.apple.com/downloads/index.action# – Cereal May 12 '14 at 19:14
  • 2
    $ sudo xcode-select --install works on Yosemite .1 – crazyGuy Nov 29 '14 at 00:10
  • 7
    'xcode-select --print-path' gives '/Applications/Xcode.app/Contents/Developer' on my Mavericks, after running the install command. – Per Quested Aronsson Dec 05 '14 at 21:16
13

Try this:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install <gemName>

For an explanation see this answer

soheildb
  • 1,490
  • 9
  • 9
0

On OSX-10.9.5 using xcode-select --install did not work for me. It started and asked to confirm the licence but then reported that it could not find the software.

I ended up visiting: https://developer.apple.com/downloads/index.action#, downloading the appropriate CommandLineTools dmg for OSX-10.9.5, installing the tools manually from the pkg, and then using: xcode-select --switch=/Library/Developer/CommandLineTools, to set the path.

After which everything worked fine.

James B. Byrne
  • 1,048
  • 12
  • 27
-1

This is an Apple LLVM error.

For now, you can:

export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"

Though as you can see from the warning name this not a permanent solution.

Source: https://langui.sh/2014/03/10/wunused-command-line-argument-hard-error-in-future-is-a-harsh-mistress/

Cory Petosky
  • 12,458
  • 3
  • 39
  • 44
dx7
  • 804
  • 5
  • 11
  • I followed that post, but still get the same `clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future make: *** [ffi_c.bundle] Error 1 Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3 for inspection. Results logged to /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3/ext/ffi_c/gem_make.out Davids-MacBook-Pro:~ david$ echo $ARCHFLAGS -Wno-error=unused-command-line-argument-hard-error-in-future` ideas? – David Williams May 05 '14 at 16:27
  • 1
    The answer accepted is the same of this one 9 days after. :( – dx7 Apr 19 '15 at 21:30