Error installing gem atomic - ruby-on-rails

I tried installing the atomic gem after a bundle error when I ran rails new "app" command. I'm running OS X 10.9.2. I also tried the xcode-select --install command. Here are my results.
> sudo gem install atomic -v '1.1.16'
Building native extensions. This could take a while...
ERROR: Error installing atomic:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for libkern/OSAtomic.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling atomic_reference.c
atomic_reference.c:57:59: warning: incompatible pointer types passing 'void **' to parameter of type 'volatile int64_t *' (aka 'volatile long long *') [-Wincompatible-pointer-types]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
^~~~~~~~~~~~~~~
/usr/include/libkern/OSAtomic.h:507:93: note: passing argument to parameter '__theValue' here
bool OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue );
^
1 warning generated.
linking shared-object atomic_reference.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: *** [atomic_reference.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/atomic-1.1.16 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/atomic-1.1.16/gem_make.out

For Installing atomic 1.1.16, you must have JDK8 installed on your system. It is a prerequisite.
However, it is not required after that. Just for installing the gem.
To run the gem, you just need JDK6 or greater.

Related

Error installing gem bson_ext version 1.5.1

I am trying to set up a ruby 2.3.0 project in my system . Upon running bundle install , I am getting the following error :-
Fetching bson_ext 1.5.1
Installing bson_ext 1.5.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/admin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bson_ext-1.5.1/ext/cbson
/Users/admin/.rbenv/versions/2.3.0/bin/ruby -I /Users/admin/.rbenv/versions/2.3.0/lib/ruby/site_ruby/2.3.0 -r ./siteconf20201009-77301-z7iyto.rb
extconf.rb
checking for asprintf()... yes
checking for ruby/st.h... yes
checking for ruby/regex.h... yes
checking for ruby/encoding.h... yes
creating Makefile
current directory: /Users/admin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bson_ext-1.5.1/ext/cbson
make "DESTDIR=" clean
current directory: /Users/admin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bson_ext-1.5.1/ext/cbson
make "DESTDIR="
compiling encoding_helpers.c
compiling cbson.c
cbson.c:118:36: warning: passing 'char *' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
result_t status = check_string(RSTRING_PTR(string), RSTRING_LEN(string),
^~~~~~~~~~~~~~~~~~~
/Users/admin/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/ruby.h:994:5: note: expanded from macro 'RSTRING_PTR'
(!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./encoding_helpers.h:26:44: note: passing argument to parameter 'string' here
result_t check_string(const unsigned char* string, const int length,
^
cbson.c:602:18: error: implicit declaration of function 'bson_buffer_get_max_size' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (length > bson_buffer_get_max_size(buffer)) {
^
cbson.c:602:18: note: did you mean 'bson_buffer_set_max_size'?
./bson_buffer.h:34:6: note: 'bson_buffer_set_max_size' declared here
void bson_buffer_set_max_size(bson_buffer_t buffer, int max_size);
^
1 warning and 1 error generated.
make: *** [cbson.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/admin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bson_ext-1.5.1 for inspection.
Results logged to /Users/admin/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-18/2.3.0-static/bson_ext-1.5.1/gem_make.out
An error occurred while installing bson_ext (1.5.1), and Bundler cannot continue.
Make sure that `gem install bson_ext -v '1.5.1'` succeeds before bundling.
In Gemfile:
bson_ext
Changing the bson_ext version does not work . I specifically need version 1.5.1 for the project.
Please help !!!

Can't install Puma gem on OSX 10.11.3

I just reformat my MacBook and I try to clone of my Rails project. When I do bundle install, Puma gem failed.
When I run gem install puma -v '2.13.4', I get this error:
Fetching: puma-2.13.4.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20160211-95547-1pdaoaq.rb extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling http11_parser.c
compiling io_buffer.c
io_buffer.c:119:10: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
return rb_str_new(b->top, b->cur - b->top);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:796:20: note: expanded from macro 'rb_str_new'
rb_str_new_static((str), (len)) : \
^~~~~
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:727:37: note: passing argument to parameter here
VALUE rb_str_new_static(const char *, long);
^
io_buffer.c:119:10: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
return rb_str_new(b->top, b->cur - b->top);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:797:13: note: expanded from macro 'rb_str_new'
rb_str_new((str), (len)); \
^~~~~
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:706:29: note: passing argument to parameter here
VALUE rb_str_new(const char*, long);
^
2 warnings generated.
compiling mini_ssl.c
In file included from mini_ssl.c:3:
/Users/zulhilmi/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/backward/rubyio.h:2:2: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings]
#warning use "ruby/io.h" instead of "rubyio.h"
^
mini_ssl.c:4:10: fatal error: 'openssl/bio.h' file not found
#include <openssl/bio.h>
^
1 warning and 1 error generated.
make: *** [mini_ssl.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/zulhilmi/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/puma-2.13.4 for inspection.
What should I do?
About my project and my environment:
Ruby: 2.2.0 (I'm using RVM)
Rails: 4.2.0
OSX: 10.11.3
Instead of force linking openssl(which is NOT recommended according to this Github Opened issue) as proposed by Zulhilmi Zainudin,
I recommend the following solution based on issue 783 of Puma source code(reference below).
I'm using El Capitan (10.11) with openssl installed via Homebrew:
$ gem install puma -v 2.13.4 -- --with-opt-dir=/usr/local/opt/openssl
Reference: https://github.com/puma/puma/issues/783
But if you want to make it work for all your Gemfiles you can still:
$ bundle config build.puma --with-opt-dir=/usr/local/opt/openssl
and confirm:
$ grep PUMA ~/.bundle/config
the output should be:
BUNDLE_BUILD__PUMA: "--with-opt-dir=/usr/local/opt/openssl"
Reference: https://github.com/puma/puma/issues/718
This solution works for me:
brew install openssl
brew link --force openssl

Failed to build ruby gem ffi native extension

I've created a base box for Vagrant using VirtualBox and the latest image of Ubuntu server 12.04 LTS.
Installed all updates, build-essential, libffi-dev among others
I've installed rvm and ruby 1.9.3-p484 (this is the required version).
When I try to install the ffi gem via gem install ffi I get:
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby extconf.rb
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
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()... yes
creating extconf.h
creating Makefile
make clean
make
compiling Types.c
compiling MethodHandle.c
compiling MappedType.c
compiling Function.c
Function.c: In function ‘callback_invoke’:
Function.c:479:9: warning: passing argument 1 of ‘rb_thread_call_with_gvl’ from incompatible pointer type [enabled by default]
Function.c:102:14: note: expected ‘void * (*)(void *)’ but argument is of type ‘VALUE (*)(void *)’
compiling Struct.c
compiling Type.c
compiling MemoryPointer.c
compiling Pointer.c
compiling DynamicLibrary.c
DynamicLibrary.c: In function ‘library_initialize’:
DynamicLibrary.c:127:23: error: ‘RTLD_LAZY’ undeclared (first use in this function)
DynamicLibrary.c:127:23: note: each undeclared identifier is reported only once for each function it appears in
DynamicLibrary.c: In function ‘rbffi_DynamicLibrary_Init’:
DynamicLibrary.c:327:5: error: ‘RTLD_LAZY’ undeclared (first use in this function)
DynamicLibrary.c:328:5: error: ‘RTLD_NOW’ undeclared (first use in this function)
DynamicLibrary.c:329:5: error: ‘RTLD_GLOBAL’ undeclared (first use in this function)
make: *** [DynamicLibrary.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p484#somegemset/gems/ffi-1.9.3 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p484#somegemset/extensions/x86_64-linux/1.9.1/ffi-1.9.3/gem_make.out
I can't seem to find any information about this error. I'm guessing I'm missing an obvious package, but really not sure what it can be.
Would definitely appreciate any help I can get on this one.

Trouble installing rails on MAC OS X 10.9.2

Having trouble installing rails on mac and wondering if someone could help me:
dannys-mbp-2:~ Danny1$ sudo gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for libkern/OSAtomic.h... yes
creating Makefile
make "DESTDIR=" clean
make
"DESTDIR="
compiling atomic_reference.c
atomic_reference.c:57:59: warning: incompatible pointer types passing 'void **' to parameter of type 'volatile int64_t *' (aka 'volatile long long *') [-Wincompatible-pointer-types]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
^~~~~~~~~~~~~~~
/usr/include/libkern/OSAtomic.h:507:93: note: passing argument to parameter '__theValue' here
bool OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue );
^
1 warning generated.
linking shared-object atomic_reference.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: *** [atomic_reference.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/atomic-1.1.16 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/atomic-1.1.16/gem_make.out
I was dealing with this and finally stumbled upon the Bug report for this. I used the following command and it worked for me:
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install rails
Official report: https://bugs.ruby-lang.org/issues/9624

(Another) error when installing Rails

I am currently trying to install Rails on a new Mac.
I have an error when I try to install the gem "atomic".
I already tried every solutions I found on the net: installing xcode, trying changing the versions of ruby, etc. but it never works.
My config:
OS X 10.9.2
xcode 5.1
ruby 2.0.0p247
gem 2.2.2
when I enter "xcode-select -p", I get:
/Applications/Xcode.app/Contents/Developer
during atomic install, the error is the following:
"ERROR: Error installing atomic:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for libkern/OSAtomic.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling atomic_reference.c
atomic_reference.c:57:59: warning: incompatible pointer types passing 'void **' to parameter of type 'volatile int64_t *' (aka 'volatile long long *') [-Wincompatible-pointer-types]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
^~~~~~~~~~~~~~~
/usr/include/libkern/OSAtomic.h:507:93: note: passing argument to parameter '__theValue' here
bool OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue );
^
1 warning generated.
linking shared-object atomic_reference.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: *** [atomic_reference.bundle] Error 1
make failed, exit code 2"
Don't hesitate to ask for more infos,
Thanks a lot
I would recommend following steps:
Uninstall atomic gem
gem uninstall atomic
Re-Install atomic gem
gem install atomic
Install rails
gem install rails

Resources