I did: sudo apt-get install ruby ruby-dev.
And i run: sudo gem install jekyll.
But it gives this output:
Building native extensions. This could take a while... ERROR: Error
installing jekyll: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 -r ./siteconf20151018-15792-1gfjwox.rb extconf.rb creating Makefile
make "DESTDIR=" clean sh: 1: make: not found
make "DESTDIR=" sh: 1: make: not found
make failed, exit code 127
Gem files will remain installed in
/var/lib/gems/2.1.0/gems/fast-stemmer-1.0.2 for inspection. Results
logged to
/var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/fast-stemmer-1.0.2/gem_make.out
You need to install make and other build tools first, run this:
sudo apt-get install build-essential
make: not found
This means that the program make (that is used to build libraries from code) is not present on your machine. You should try to install it with your package manager.
sudo apt-get cmake
might do the trick.
sudo apt-get install build-essential solves the issue for mysql gem failing due to make program failure for linux.
When I try to install compass using sudo gem install compass it show me this :
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/1.8/usr/bin/ruby -r ./siteconf20141125-86718-gjziv3-0.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... no
checking for rb_thread_call_without_gvl()... no
checking for ffi_prep_cif_var()... no
creating extconf.h
creating Makefile
make clean
make
mkdir -p "/Library/Ruby/Gems/1.8/gems/ffi-1.9.6/ext/ffi_c"/libffi-i386; (if [ ! -f "/Library/Ruby/Gems/1.8/gems/ffi-1.9.6/ext/ffi_c"/libffi-i386/Makefile ]; then echo "Configuring libffi for i386"; cd "/Library/Ruby/Gems/1.8/gems/ffi-1.9.6/ext/ffi_c"/libffi-i386 && env CC=" xcrun cc" CFLAGS="-arch i386 " LDFLAGS="-arch i386" "/Library/Ruby/Gems/1.8/gems/ffi-1.9.6/ext/ffi_c/libffi"/configure --disable-static --with-pic=yes --disable-dependency-tracking --host=i386-apple-darwin > /dev/null; fi); env MACOSX_DEPLOYMENT_TARGET=10.4 make -C "/Library/Ruby/Gems/1.8/gems/ffi-1.9.6/ext/ffi_c"/libffi-i386
Configuring libffi for i386
configure: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used
configure: error: in `/Library/Ruby/Gems/1.8/gems/ffi-1.9.6/ext/ffi_c/libffi-i386':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[1]: *** No targets specified and no makefile found. Stop.
make: *** ["/Library/Ruby/Gems/1.8/gems/ffi-1.9.6/ext/ffi_c"/libffi-i386/.libs/libffi_convenience.a] Error 2
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/ffi-1.9.6 for inspection.
Results logged to /Library/Ruby/Gems/1.8/extensions/universal-darwin-11/1.8/ffi-1.9.6/gem_make.out
I have correctly install sass and xcode' tools but nothing change. I even try to upgrade ruby. What should I do?
It happens because you want to sudo install and probably environment variables are not configured to use your installed ruby, instead it uses the system ruby which probably is not what you want to use.
The easiest way to use Ruby on Mac is to install rbenv and ruby-build using homebrew.
To install homebrew just run this command which can be found on brew homepage:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
To install rbenv and ruby-build you can run these commands which can be found on Github:
brew update
brew install rbenv ruby-build
Forgot to add that for sure, then you need to install a ruby version using rbenv and make it global.
rbenv install 2.1.5
rbenv global 2.1.5
And finally:
gem install compass
Just make sure that gem binary points to the version you've installed.
You can run gem env and checkout printed paths, if it doesn't point to newly installed ruby gem path, close the terminal and open a new one then install the gem.
Here is the first few lines of what's printed out on my machine:
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.0
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-darwin13.0]
- INSTALLATION DIRECTORY: /Users/jani/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
....
I bought a new Mac this week and have had big problems getting this gem installed. It was never a problem on my old Mac but seems to be particularly difficult on this one.
I have installed libvirt via Homebrew, Xcode4.4 (with command line tools) and gcc4.2. I have symlinked to make gcc4.2 the default compiler.
gem install ruby-libvirt -v '0.4.0' fails because it cannot find the headers
If I pass in the paths to the headers and libraries, like so:
ruby-libvirt -v '0.4.0' -V -- --with-libvirt-include=/usr/local/Cellar/libvirt/0.9.11.3/include/ --with-libvirt-lib=/usr/local/Cellar/libvirt/0.9.11.3/lib/
, it compiles just fine but fails when linking with the following errors:
linking shared-object _libvirt.bundle
ld: library not found for -lruby.1.9.1
collect2: ld returned 1 exit status
make: *** [_libvirt.bundle] Error 1
I have installed Ruby 1.9.3 via RVM and haven't had any troubles installing other native extensions, so I cannot see why it fails to find the ruby libraries in this case.
Does anyone have any ideas? Help would be much appreciated.
I built ruby-libvirt-0.4.0/ext/libvirt by proving external libvirt installed using brew.
Here is what I did to successfully install libvirt.
brew install libvirt
ruby extconf.rb --with-libvirt-include=/usr/local/include/libvirt --with-libvirt-lib=/usr/local/lib/libvirt
gem install ruby-libvirt -v '0.4.0' -V -- --with-libvirt-include=/usr/local/Cellar/libvirt/1.1.4/include/libvirt --with-libvirt-lib=/usr/local/Cellar/libvirt/1.1.4/lib
Hope this helps.
To install the gem you need to install the libvirt libraries. Using 'Homebrew' (a package manager for mac) :
brew install libvirt
bundle install
The exact error you got might have been:
An error occurred while installing ruby-libvirt (0.4.0)
I have finally solved this. It turns out that the command line tools were not properly installed. The following line needs to be added to your .zshrc file (or whatever applies to your choice of shell):
export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH
You need only to install libvirt, before the bundle install.
brew install libvirt
gem install ruby-ldap
Building native extensions. This could take a while...
ERROR: Error installing ruby-ldap:
ERROR: Failed to build gem native extension.
/usr/bin/ruby.exe extconf.rb
--with-ldap-dir=/usr
--with-openldap2
checking for ldap.h... yes
[...]
creating Makefile
make
gcc -I. -I. -I/usr/lib/ruby/1.8/i386-cygwin -I. ...
[...]
gcc -shared -s -o ldap.so ...
The configuration and the compilation works just fine. But the installation throws this error:
make install
/usr/bin/install -c -m 0755 ldap.so /usr/lib/ruby/gems/1.8/gems/ruby-ldap-0.9.12/lib
/usr/bin/install -c -m 644 ./lib/ldap/control.rb /usr/lib/ruby/gems/1.8/gems/ruby-ldap-0.9.12/lib/ldap
/usr/bin/install: `./lib/ldap/control.rb' and `/usr/lib/ruby/gems/1.8/gems/ruby-ldap-0.9.12/lib/ldap/control.rb' are the same file
Makefile:130: recipe for target `/usr/lib/ruby/gems/1.8/gems/ruby-ldap-0.9.12/lib/ldap/control.rb' failed
make: *** [/usr/lib/ruby/gems/1.8/gems/ruby-ldap-0.9.12/lib/ldap/control.rb] Error 1
./lib/ldap/control.rb and /usr/lib/ruby/gems/1.8/gems/ruby-ldap-0.9.12/lib/ldap/control.rb are indeed the same file, but why? Other gems with nativ bindings like mysql worked just fine. I reported this as a bug, but some other guy does not have the problem, so the package itself is intact.
If I download the gem and run:
ruby extconf.rb
make install
The Makefile runs just fine.
It must be my system/configuration. Whats going wrong here?
Wow, very oddly, I got this working by downgrading RubyGems and then upgrading it back. I downgraded it first to match a version (1.4.1) I had on another system that could install ruby-ldap just fine. I thought this might make it work on my current system, but I got the same error you did. I upgraded RubyGems back to what I had (1.8.15), then it all magically worked.
So:
$ gem update --system 1.4.1 # Downgrade to 1.4.1
...
$ gem update --system # Go back to current
...
$ gem install ruby-ldap
Building native extensions. This could take a while...
Successfully installed ruby-ldap-0.9.12
1 gem installed
Installing ri documentation for ruby-ldap-0.9.12...
Installing RDoc documentation for ruby-ldap-0.9.12...
$
FYI, I didn't have to use sudo because I'm using rvm and I was installing ruby-ldap into a per-project gemset.
If you are using Ubunty, try to perform
sudo apt-get install libsasl2-dev
More about it at https://github.com/alexey-chebotar/ruby-ldap/issues/7
Got the DevKit installed and re-ran the ffi install….got this as an output:
C:\Documents and Settings\******>gem install ffi
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe 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_thread_has_gvl_p()... yes
checking for ruby_native_thread_p()... yes
checking for rb_thread_call_with_gvl()... yes
creating extconf.h
creating Makefile
make
C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_ffi_c'" > ffi_c-i386-mingw32.def
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DRUBY_EXTCONF_H=\"extcon
f.h\" -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -
Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-declaration-a
fter-statement -o AbstractMemory.o -c AbstractMemory.c
In file included from AbstractMemory.c:28:0:
compat.h:65:20: warning: extra tokens at end of #ifndef directive
compat.h:69:24: warning: extra tokens at end of #ifndef directive
In file included from AbstractMemory.h:29:0,
from AbstractMemory.c:29:
Types.h:68:17: fatal error: ffi.h: No such file or directory
compilation terminated.
make: *** [AbstractMemory.o] Error 1
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.1
0 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.10/ext/ffi_c/gem_m
ake.out
_________________________________________________________________________________
Not sure how to deal with this issue. Kindly help.
The gem install ffi fails due to the gem trying to build a bundled copy of libffi, which does not work due to assumptions that /usr/bin/env exists and too old libffi copy.
However, you can build the ffi gem against the system libffi - install the packages:
apt install clang make ruby-dev libffi-dev
After that the ffi gem should build:
gem install ffi
Version 1.0.10 has issues compiling on windows.
You can use the 1.0.9
gem install ffi --version='1.0.9'
sudo apt-get install libffi-dev
This worked for me
For me the fix was running in this order. I'm not sure what all was relevant, but it worked:
gem install ffi --version '1.0.9'
The above failed, but then I could successfully run:
gem install bundler
...and subsequently:
gem install ffi
...which got the latest version (1.6.0 at the time of writing this) and installed it successfully.
Note that installing version 1.0.9 isn't going to be enough if your bundler keeps trying to go out and grab the latest version. In your gemfile you'll also want to put:
gem 'ffi', '1.0.9'
This should satisfy the dependency for whatever gem is asking for it and let you get up and running.
when the above steps are followed, it might results the following message.
$ bundle install
Fetching source index for https://rubygems.org/
You have requested:
ffi = 1.0.9
The bundle currently has ffi locked at 1.0.11.
Try running `bundle update ffi`
In that case, you can run the 'bundle update ffi' command and the error will be solved.
Installing the 'osx-gcc-installer' worked for me: (osx 10.8)
https://github.com/kennethreitz/osx-gcc-installer/downloads
Helped me:
sudo apt install build-essential
Debian 9
Ruby 2.3.3
you need this,
apt-get install ruby2.2-dev
Copied from another post:
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
For me, this usually works
gem install ffi -- --disable-system-libffi
On MacOS (Catalina), running brew install libtool first solved the problem for me.
This worked for me
gem install ffi -- --disable-system-libffi
on Ubuntu 20.04 (WSL)
Put DevKit in front of your PATH, and install again from Windows command prompt.
I got the same problem. In my case, I have not install the DevKit, which can be found: http://rubyinstaller.org/downloads/. After installing DevKit, just follow the instruction https://github.com/oneclick/rubyinstaller/wiki/development-kit and finally it's up and running.
I had to install automake to get it working. Worked on both mac OSX as well as Ubuntu (CI machine).
Run this: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then: brew install cocoapods