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
Related
I'm doing a project using react-rails but when I run
bundle install
I get
Could not find json-1.8.1 in any of the sources
Specifically, this is the entire error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/montana/.rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
/Users/montana/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160629-5602-i1di2t.rb extconf.rb
creating Makefile
current directory: /Users/montana/.rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /Users/montana/.rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
/Users/montana/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/ruby/intern.h:797:9: note: macro 'rb_str_new' defined here
#define rb_str_new(str, len) __extension__ ( \
^
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' (aka 'unsigned long (const char *, long)') [-Wint-conversion]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^ ~~~~~~~~~~
1 warning and 1 error generated.
make: *** [generator.o] Error 1
There's been various posts about this on stackoverflow, and have tried most "solutions' but none seem to work for me, I also ran
gem list | grep json
It says I have the json gem via
json (1.8.3)
multi_json (1.10.1)
I've tried to stop spring, updating the gems, & bundler. I've also ran
rbenv rehash
To no avail, still getting this error, any input would be highly appreciated.
I had a problem last time on Ubuntu, i tried to install this library and it worked as well.
sudo apt-get install libgmp3-dev
You can refer document at: Failed to build gem json native extension
You may want to lower down your ruby version or bump json version up. See: https://github.com/flori/json/issues/229
Had a quick look at json 1.8.1 gemspec and no mention of ruby 2.3.0 support as of today.
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
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.
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
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.