Issues installing oj Ruby gem on OSX 10.9.2 - ruby

I'm new to Ruby and tried installing the oj gem with the following command:
sudo gem install oj -v '2.1.6'
Unfortunately I have received the following error. Is this due to using Ruby 2.0? Are there any workarounds?
ERROR: Error installing oj:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
>>>>> Creating Makefile for ruby version 2.0.0 on universal.x86_64-darwin13 <<<<<
creating Makefile
make "DESTDIR="
compiling cache8.c
compiling circarray.c
compiling compat.c
compiling dump.c
dump.c:165:1: warning: unused function 'ulong2str' [-Wunused-function]
ulong2str(uint32_t num, char *end) {
^
1 warning generated.
compiling err.c
compiling fast.c
fast.c:151:1: warning: unused function 'next_white' [-Wunused-function]
next_white(ParseInfo pi) {
^
1 warning generated.
compiling hash.c
compiling hash_test.c
compiling object.c
compiling odd.c
compiling oj.c
compiling parse.c
compiling resolve.c
compiling saj.c
saj.c:130:1: warning: unused function 'next_white' [-Wunused-function]
next_white(ParseInfo pi) {
^
1 warning generated.
compiling scp.c
compiling strict.c
compiling val_stack.c
linking shared-object oj.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: *** [oj.bundle] Error 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/oj-2.1.6 for inspection.

This issue is due to Xcode 5.1 - its already reported as a bug to Ruby.
https://bugs.ruby-lang.org/issues/9624#change-45736
There is some more additional discussion here:
Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'

Related

foodcritic (3.0.3) gem installation is failing in Mac OS High Sierra

My food critic gem installation is failing with the below error
Following gems were not installed:
foodcritic (3.0.3): Error installing foodcritic
ERROR: Failed to build gem native extension. current directory
/Users/dmanna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/yajl-ruby-1.1.0/ext/yajl
/Users/dmanna/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf/20180729-63637-1dtcegj.rb.extconf.rb creating Makefile current
directory: /Users/dmanna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/yajl-ruby-1.1.0/ext/yajl make "DESTDIR=" clean current
directory: /Users/dmanna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/yajl-ruby-1.1.0/ext/yajl make "DESTDIR=" compiling
yajl.c compiling yajl_alloc.c compiling yajl_buf.c compiling yajl_encode.c compiling yajl_ext.c yajl_ext.c:852:22 error: use of undeclared identifier 'rb_cFixnum' rb_define_method(rb_cFixnum, "to_json", rb_yajl_json_ext_fixnum_to_json, -1); ^ 1 error generated.
make: *** [yajl_ext.o] Error 1 make failed, exit code 2 Gem files remain installed in
/Users/dmanna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/yajl-ruby-1.1.0 for inspection. Results logged to
/Users/dmanna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-17/2.5.0-static/yajl-ruby-1.1.0/gem_make.out
Output of gem_make.out
current directory: /Users/dmanna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/yajl-ruby-1.1.0/ext/yajl
/Users/dmanna/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20180729-63637-1dtcegj.rb extconf.rb
creating Makefile
current directory: /Users/dmanna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/yajl-ruby-1.1.0/ext/yajl
make "DESTDIR=" clean
current directory: /Users/dmanna/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/yajl-ruby-1.1.0/ext/yajl
make "DESTDIR="
compiling yajl.c
compiling yajl_alloc.c
compiling yajl_buf.c
compiling yajl_encode.c
compiling yajl_ext.c
yajl_ext.c:852:22: error: use of undeclared identifier 'rb_cFixnum'
rb_define_method(rb_cFixnum, "to_json", rb_yajl_json_ext_fixnum_to_json, -1);
^
1 error generated.
make: *** [yajl_ext.o] Error 1
make failed, exit code 2
rbenv version - 2.5.1 OS
Mac 10.13.6
I am new to ruby. I am getting this error when trying to import a project in RubyMine and installing the gems.
Can someone let me know what is going wrong and how can I get around this?
Foodcritic 3.0.3 is from 2013. See here:
https://rubygems.org/gems/foodcritic/versions/3.0.3
Unfortunately it is not compatible with the latest version of Ruby. Your choices are to either downgrade Ruby to something less than 2.4, maybe even as low as 1.9 to be sure of compatibility, or upgrade foodcritic to its latest version (14.0.0).

How to install syck 1.0.1 on Ubuntu 15.04?

I'm getting an error installing syck on Ubuntu 15.04. Building the native extensions fails:
Installing syck 1.0.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/markus/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150618-8242-1z0c5iw.rb extconf.rb
checking for st.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling bytecode.c
compiling implicit.c
compiling token.c
token.re: In function ‘sycklex_yaml_utf8’:
token.re:541:36: warning: variable ‘lvl’ set but not used [-Wunused-but-set-variable]
compiling rubyext.c
rubyext.c:31:20: error: field ‘hash’ has incomplete type
struct RHash hash;
^
rubyext.c: In function ‘syck_seq_initialize’:
rubyext.c:1529:15: warning: variable ‘node’ set but not used [-Wunused-but-set-variable]
SyckNode *node;
^
Makefile:237: recipe for target 'rubyext.o' failed
make: *** [rubyext.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/markus/.rvm/gems/ruby-2.2.1#mygemset/gems/syck-1.0.1 for inspection.
Results logged to /home/markus/.rvm/gems/ruby-2.2.1#mygemset/extensions/x86_64-linux/2.2.0/syck-1.0.1/gem_make.out
An error occurred while installing syck (1.0.1), and Bundler cannot continue.
Make sure that `gem install syck -v '1.0.1'` succeeds before bundling.
Does someone have an idea what the issue is and how to fix it?

can't install gems with Bundler

Im trying to install wpscan
I have macbook pro 10.9.2
Im running mavericks osx.
I followed the instruction:
git clone https://github.com/wpscanteam/wpscan.git
cd wpscan
and then I'm trying to
sudo gem install bundler && bundle install --without test development
and after that I get this error:
sudo gem install bundler && bundle install --without test development
Successfully installed bundler-1.6.1
Parsing documentation for bundler-1.6.1
1 gem installed
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Gem::Installer::ExtensionBuildError: 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 /var/folders/pf/hl1jk3kx5_j2q70fbwyj18180000gn/T/bundler20140407-7061-7v0bbm/ffi-1.9.3/gems/ffi-1.9.3 for inspection.
Results logged to /var/folders/pf/hl1jk3kx5_j2q70fbwyj18180000gn/T/bundler20140407-7061-7v0bbm/ffi-1.9.3/gems/ffi-1.9.3/ext/ffi_c/gem_make.out
An error occurred while installing ffi (1.9.3), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.3'` succeeds before bundling.
can anyone help me?
Thanks.
My guess is that this is your problem (here with json, but it appears to be a variant of the same problem): Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'
Long story short: the temporary fix is "ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install [gem]" where [gem] is the particular gem whose command-line argument is causing the crash.

error occurred while installing crypt (3.1.7)

I have an error message while running sudo bundle install:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for ruby/util.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling bcrypt_ext.c
compiling crypt.c
compiling crypt_blowfish.c
compiling crypt_gensalt.c
compiling wrapper.c
linking shared-object bcrypt_ext.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: *** [bcrypt_ext.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/bcrypt-3.1.7 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/bcrypt-3.1.7/gem_make.out
An error occurred while installing bcrypt (3.1.7), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.7'` succeeds before bundling.
Then I tried to run sudo gem install bcrypt -v '3.1.7' and have below error message:
Building native extensions. This could take a while...
ERROR: Error installing bcrypt:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for ruby/util.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling bcrypt_ext.c
compiling crypt.c
compiling crypt_blowfish.c
compiling crypt_gensalt.c
compiling wrapper.c
linking shared-object bcrypt_ext.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: *** [bcrypt_ext.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/bcrypt-3.1.7 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/bcrypt-3.1.7/gem_make.out
After this, I try to run sudo gem install bcrypt, still not working. Any tips?
I had upgraded Xcode from the Mac App Store, and that caused this particular error for me.
The way to fix it in my case: run Xcode and accept the license terms, etc. Then when I ran bundle install, it compiled and installed bcrypt just fine.

RVM + Ruby 1.9.3 + MacPorts Typhoeus Missing > Bundle Install stuck at FFI

I have Ruby version manager RVM on OSC Mavericks with MacPorts. I was trying to update WPScan that runs on ruby. I was trying to do an update:
ruby wpscan.rb --update
when I run into this error:
Could not find gem 'typhoeus (>= 0.6.3) ruby' in the gems available on this machine.
I had this error before. So a ran bundle install. Then I ran into other errors:
sudo bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Installing ffi (1.9.3) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/jasper/.rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb
checking for ffi_call() in -lffi... yes
-----------------cut ----------------
checking for ffi_prep_cif_var()... yes
creating extconf.h
creating Makefile
make
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
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
make install
make: /opt/local/bin/gmkdir: No such file or directory
make: [/Users/jasper/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/gems/1.9.1/gems/ffi-1.9.3/lib/ffi_c.bundle] Error 1 (ignored)
/opt/local/bin/ginstall -c -m 0755 ffi_c.bundle /Users/jasper/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/gems/1.9.1/gems/ffi-1.9.3/lib
make: /opt/local/bin/ginstall: No such file or directory
make: *** [/Users/jasper/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/gems/1.9.1/gems/ffi-1.9.3/lib/ffi_c.bundle] Error 1
Gem files will remain installed in /Users/jasper/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/gems/1.9.1/gems/ffi-1.9.3 for inspection.
Results logged to /Users/jasper/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/gems/1.9.1/gems/ffi-1.9.3/ext/ffi_c/gem_make.out
An error occurred while installing ffi (1.9.3), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.3'` succeeds before bundling.
I do have /opt/local/bin/gmdir. I added it myself, but the error remains and then there are some warnings and errors concerning other directories that not seem to exist. why does the script does not create them? Any easy way around these errors so I can ran my favourite WP scanner?
NB I thought RVM would work without MacPorts... But it is looking for directories in MacPorts.
gmkdir is a part of GNU Core Utilities.
You can install them with command sudo port install coreutils.

Resources