Problems getting ruby-libvirt extensions to compile Mountain Lion - ruby

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

Related

Error installing Ruby 3.1.2 on macOS 12.5

I'm trying to install Ruby 3.1.2 on macOS 12.5, using chruby as my version manager.
Running ruby-install ruby, I get this error:
>>> Extracting ruby-3.1.2.tar.xz to /Users/justin/src/ruby-3.1.2 ...
/usr/local/bin/../share/ruby-install/util.sh: line 56: xzcat: command not found
/usr/local/bin/ruby-install: line 46: cd: /Users/justin/src/ruby-3.1.2: No such file or directory
>>> Regenerating ./configure script ...
autoreconf: error: 'configure.ac' is required
!!! Configuration of ruby 3.1.2 failed!
I'm not quite sure how to troubleshoot this. Anybody have some tips for me?
There seems to be an issue in ruby-install tracking this.
I appears that ruby-install currently does not explicitly depend on xz as a dependency although they are required for chruby and ruby-install. Until the new version of ruby-install is fully available on homebrew, you can manually install the xz package with
brew install xz
to make sure xz (and thus the xzcat executable) are available on your system. Afterwards, you should be able to install your Ruby version.

Trying to install ruby 2.1.2 with rbenv on OSX BUILD FAILED

So, as the title suggests, I'm trying to install ruby 2.1.2, altough I've tried to install other versions as well, and I'm getting the same errors. I'm running OSX 10.9.2.
I've tried:
Installing a fresh gcc compiler, via brew install gcc47
Installing updated OSX command line tools
Uninstalling rbenv and trying again
Restarting the machine
Here is the sum of what I'm getting:
rbenv install 2.1.2
Downloading ruby-2.1.2.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/f22a6447811a81f3c808d1c2a5ce3b5f5f0955c68c9a749182feb4 25589e6635
Installing ruby-2.1.2...
BUILD FAILED
Inspect or clean up the working tree at /var/folders/6c/h_82199n12515_hd3rcp2x5w0000gn/T/ruby-build.20140528115901.38728
Results logged to /var/folders/6c/h_82199n12515_hd3rcp2x5w0000gn/T/ruby-build.20140528115901.38728.log
Last 10 log lines:
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
compiling miniinit.c
compiling miniprelude.c
translating probes probes.d
compiling bignum.c
compiling class.c
dtrace: failed to compile script probes.d: Preprocessor not found
make: *** [probes.h] Error 1
make: *** Waiting for unfinished jobs....
compiling compar.c
Thoughts?
Gist of verbose output
I was able to build it using:
CONFIGURE_OPTS="--disable-dtrace" rbenv install 2.1.2
Basically that's what is suggested in the question's comment by wicz.
The solution by KurtPreston did not work for me. Also using OS X 10.9.
I was able to get this working in my own environment by:
Removing the gcc installed by Homebrew: brew remove gcc47
Re-installing the XCode Command Line Tools from the XCode Downloads page at https://developer.apple.com/downloads
I was trying to install 2.0 and ran into the same error. However now the CONFIGURE_OPTIONS override doesn't seem to work anymore with rvm at least, so I needed to build it with rvm install --reconfigure -C --disable-dtrace ruby-2.0.0-p594. This was the first Google result off the error message ("dtrace: failed to compile script probes.d: Preprocessor not found") so I figured I should add this as a current solution for rvm users. Running on OSX Mavericks.
I cannot reproduce this on my machine, sorry. For reference, here's my dtrace version if that should have anything to do with the error:
dtrace -V
dtrace: Sun D 1.7
You can try to check for XCode and command line tools updates. GCC 4 should not be necessary, you can use the compiler that ships with XCode:
brew uninstall gcc4
Finally, update everything and try again:
brew update
brew upgrade rbenv ruby-build
rbenv uninstall 2.1.2
rbenv install 2.1.2
If that does not work yet: some people have reported that a simple reboot of the machine solved similar errors with dprobe/dtrace.

Nokogiri gem fails to install in OS X Mavericks

Install fails showing:
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
checking for iconv_open() in -liconv... no
checking for libiconv_open() in iconv.h... no
checking for libiconv_open() in -liconv... no
checking for libiconv_open() in -liconv... no
libiconv is missing.
However, looking at nokogiri's mkmf.log, the following errors are shown:
ld: warning: ignoring file /usr/local/Cellar/libxslt/1.1.28/lib/libxslt.dylib, **file was built for x86_64 which is not the architecture being linked (i386)**: /usr/local/Cellar/libxslt/1.1.28/lib/libxslt.dylib
ld: warning: ignoring file /usr/local/Cellar/libxml2/2.9.1/lib/libxml2.dylib, **file was built for x86_64 which is not the architecture being linked (i386)**: /usr/local/Cellar/libxml2/2.9.1/lib/libxml2.dylib
ld: warning: ignoring file /usr/local/Cellar/libiconv/1.14/lib/libiconv.dylib, **file was built for x86_64 which is not the architecture being linked (i386)**: /usr/local/Cellar/libiconv/1.14/lib/libiconv.dylib
I have xcode and it's command tools installed.
My ~/.bash_profile has 64bit compiling forced by: export ARCHFLAGS="-arch x86_64"
I have libxml2, libxslt, and libiconv installed via Homebrew, and each is linked.
I've tried installing all of these without the ARCHFLAG in .bash_profile.
I've also brew install apple-gcc42 and linked, as per how tos I've found.
I've tried installing nokogiri by passing paths to libxml2, libxslt, and libiconv in /usr/local/Cellar/, but the install still fails, with same errors as above.
I've wasted at least a day on this - just trying to get one Ruby gem installed. I'd really like to get back to actually developing.
Can anyone please help?
Setting NOKOGIRI_USE_SYSTEM_LIBRARIES=1 before actually installing the gem did the trick for me.
Summarising:
If previously installed, uninstall the gem:
$ gem uninstall nokogiri
Use Homebrew to install libxml2, libxslt and libiconv if needed:
$ brew install libxml2 libxslt libiconv
Install the gem specifying the paths to the libraries to be linked against:
$ NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem install nokogiri -- --use-system-libraries --with-iconv-dir="$(brew --prefix libiconv)" --with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config" --with-xslt-config="$(brew --prefix libxslt)/bin/xslt-config"
Check if HomeBrew is installed correctly with the appropriate XCode command line tools.
brew doctor
You can also check via XCode > Preferences
With valid command line tools installed, I was able to resolve the nokogiri error encountered after the OSX Maverick upgrade.
Also found that some of the 'brew' packages were outdated after the OS X Mountain Lion to Maverick upgrade. (e.g. qt, postgresql)
Here's what worked for me:
If you haven't already done so, install the XCode developer tools: $ xcode-select --install
Use homebrew to install (or reinstall) libxml2, libxslt and libiconv: $ brew install libxml2 libxslt libiconv
Install nokogiri: gem install nokogiri -- --with-iconv-dir=/usr/local/opt/libiconv
I found the solution I needed in an unmerged pull request to update the Nokogiri tutorials. I recommend that if someone else encounters this issue and has exhausted the solutions here, check that pull request list to see if someone has submitted an update to the instructions on the Nokogiri tutorials page.
From github page
First, you should:
xcode-select --install
and then re-install nokogiri.
That worked for me while another suggestion didn't. Hope this helps someone else.

Can't install RMagick 2.13.1. Can't find MagickWand.h.

When I try do install rmagick I get the following error message:
Can't install RMagick 2.13.1. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
I'm on Mac OSX 10.6.8, ruby 1.9.2p290, rvm 1.10.2.
Can anyone help me please to solve this problem.
If you're on Ubuntu, installing this package is what fixed it for me:
sudo apt-get install libmagickwand-dev
It looks like ImageMagick 7 changed include file path.
On building rmagick, since it includes file as wand/MagickWand.h There are no workarounds. It looks like sticking with ImageMagick 6 for now.
On Mac OS X (I tested on Sierra), I used HomeBrew's versions tap like:
brew tap homebrew/versions
brew install imagemagick#6
Then, use the path shown on above installation:
PKG_CONFIG_PATH=/usr/local/opt/imagemagick#6/lib/pkgconfig gem install rmagick
To install with ImageMagick 6.
I didn't want to mess with environment variables since I wanted bundler to be able to compile this gem on its own on a CI machine. Instead, I used Homebrew to install pkg-config:
brew install pkgconfig
and the next time I tried compiling the RMagick gem it found the header file without issue.
(This is pkg-config 0.28, ImageMagick 6.8.0-10, and RMagick 2.13.2, all on Mountain Lion.)
I had a similar issue with running
$ gem install rmagick
First of all, do you have imagemagick installed? If you're not sure, run
$ convert --version
If you do, you probably either installed it with fink or macports (maybe homebrew?). What is happening is that rvm can't find the imagemagick directory.
After reading
https://superuser.com/questions/361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-install
I exported the imagemagick path by adding
$ export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"
to my ~/.bash_profile, sourcing the new profile, then running:
gem install rmagick
It worked for me after I did this.
fix this setting the include path of your current imagemagick installation:
Install ImageMagick with brew
brew install imagemagick
find library
$ mdfind MagickWand.h
/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/wand/MagickWand.h
Install rmagick gem
$ C_INCLUDE_PATH=/path/MagickWand.h gem install rmagick
example:
$ C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/ gem install rmagick
I marked this as a favorite because it seems to come back to bite me with every new system I need to install RMagick on (and time has passed and version numbers have rolled).
Mac OS X 10.8.4
rvm 1.22.3
ruby-2.0.0-p247
Xcode 4.6.3 developer tools installed
$ brew install imagemagick
==> /usr/local/Cellar/imagemagick/6.8.6-3
$ brew install pkgconfig
==> /usr/local/Cellar/pkg-config/0.28
$ C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.6-3/include/ImageMagick-6 PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.6-3/lib/pkgconfig/ gem install rmagick
Successfully installed rmagick-2.13.2
Many thanks to everyone who added helpful answers above!
Mac users using brew
If you can use v6 of ImageMagick instead of 7, you can try this
brew install imagemagick#6 --force && brew link imagemagick#6 --force
Note this will unlink your existing IM installation, so be careful if you have other projects on your machine using ImageMagick without problems.
For my own and others edification, I got past the error about the magicwand.h by using the suggestion xonico. MDFind plus the C_INCLUDE_PATH. However, it then gave me an error about MagickCore.pc. My final command to get this working had to include both like so:
C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/ PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/ gem install rmagick
Obviously your paths will vary depending on whether you're using brew like me and what version of imagemagick you were installing. Also, xcode command line tools did have to be installed, as others have mentioned.
Thanks for everyone's posts on this! I am plussing your answers since it contributed to mine!
For Ubuntu:
sudo apt-get install imagemagick libmagickwand-dev
gem install rmagick
I had a problem after update to Maverics.
It have lost a lot of linkings.
In my case I had to refresh links to pkg-config
brew unlink pkg-config
brew link pkg-config
Then installing rmagick worked like a charm.
I updated to Mountain Lion and started getting this same problem. I had to re-install brew, XCode, the XCode tools - pretty much the whole environment!
I eventually solved this problem using the answer from phopkins above...
brew install pkgconfig
Once that was successfully completed (I had to delete some old symlinks first) then I was able to successfully install the RMagick gem
This worked for me on Mac OsX
Install Imagemagick:
brew remove imagemagick
brew install imagemagick
Make sure pkg-config is correctly linked:
brew uninstall pkg-config
brew install pkg-config
brew unlink pkg-config && brew link pkg-config
Install gem
gem install rmagick
For Ubuntu users:
It will never done directly on Ubuntu. You should first install packages to run this command...:
sudo apt-get install libmagickwand-dev
...and then do install:
gem install rmagick
You may get the same issue, for that, Try clearing your apt repository and removing any broken packages first:
sudo apt-get update
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove
If the system identifies any broken packages, forcefully remove them (replace package_name with your own):
sudo dpkg --remove -force --force-remove-reinstreq package_name
Then re-install any missing packages again. :)
An issue for me was that rmagick is out of date and not updated regularly. If you have too new of an ImageMagick version, then it might not be compatible. Check your version of ImageMagick using the following:
$ convert --version
If the ImageMagick version is > 7, it is not compatable with rmagick. The user will get errors such as
Can't install RMagick 2.16.0. Can't find MagickWand.h.
*** extconf.rb failed ***
Go back to version six of ImageMagick until they update rmagick to be compatible with version seven of ImageMagick. Someone has hosted the appropriate version(6) in a separate gem - 'imagemagick#6'.
If you need rmagick to work but currently have an imagemagick version 7 or higher, here are the steps to switch:
$ gem install imagemagick#6
$ brew unlink imagemagick
$ brew link imagemagick#6 --force
Helped me on Debian Wheezy 64bit
apt-get install libmagickcore-dev libmagickwand-dev
Try reinstalling both Imagemagick and PkgConfig. That should fix it for Mavericks
brew update && brew upgrade
brew reinstall imagemagick
brew reinstall pkgconfig
C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick gem install rmagick
I was really struggling with this on OS X Mountain Lion (after upgrading from Lion) and none of the suggestions regarding C_INCLUDE_PATH, PKG_CONFIG_PATH, ln'ing various files, etc., were working. On the same day I upgraded to Mountain Lion, I also upgraded XCode to 4.5.2, but I didn't really think too much of this.
Eventually I stopped trying to install RMagick and had to pass on the work to a colleague.
Then, by chance, I found that I was trying to use bundle install on another project and I wasn't able to install the json gem because "make" could not be found. I checked into that and found you need to go to XCode -> Preferences -> Downloads and install the command line tools to get make working again. The json gem installed fine.
Then I paused...and tried
gem install rmagick
One more time. It worked perfectly.
for a rails based application, I found this
sudo apt-get install -y libmagickwand-6-headers
C_INCLUDE_PATH=/usr/include/ImageMagick-6 gem install rmagick
bundle update rmagick
bundle install
worked on debian jessie
I ran into this because I'd run OS X's Migration Assistant and nothing was relinked after the migration. You need to check the output of Wand-config --ldflags --libs. In my case it gave:
$ Wand-config --ldflags --libs
/usr/local/bin/Wand-config: line 50: pkg-config: command not found
/usr/local/bin/Wand-config: line 53: pkg-config: command not found
After relinking pkg-config, libpng, and libfreetype, that became:
$ Wand-config --ldflags --libs
-L/usr/local/Cellar/imagemagick/6.8.8-9/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16
-L/usr/local/Cellar/imagemagick/6.8.8-9/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16
And then:
$ gem install rmagick
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.2
Parsing documentation for rmagick-2.13.2
Done installing documentation for rmagick after 4 seconds
1 gem installed
In linux OS:
C_INCLUDE_PATH=/usr/local/include/ImageMagick-6/ gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/home/vagrant/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
...
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
then:
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
in my .bashrc file to pick up MagickCore.pc, then created two symlinks:
ln -s /usr/local/include/ImageMagick/wand /usr/local/include/ImageMagick-6/wand
ln -s /usr/local/include/ImageMagick/magick /usr/local/include/ImageMagick-6/magick
Now:
$ gem install rmagick
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.2
1 gem installed
boom everything works fine.
At arch linux, after installing imagemagick#6, gem wasn't able to install package rmagick and got error below.
Can't install RMagick 2.16.0. Can't find MagickWand.h
Worked for me using below steps
added pkgconfig path to .bashrc
export PKG_CONFIG_PATH="/usr/lib/imagemagick6/pkgconfig"
Created two symlinks as below
ln -s /usr/include/ImageMagick-6/wand /usr/include/ImageMagick-6/wand
ln -s /usr/local/include/ImageMagick/magick /usr/include/ImageMagick-6/magick
There are some variants to this problem. Mostly the case is dealing with a legacy application that run older versions of ruby.
rmagick has a dependancy on imagemagick... but not just any. If you've gone too far ahead, it may be wise to backtrack:
brew uninstall imagemagick
Then proceed with an appropriate version
brew install imagemagick#6
then you path needs to be adjusted and forced upon homebrew
export PATH="/usr/local/opt/imagemagick#6/bin:$PATH"
brew link --force imagemagick#6
then you can install rmagick to most recent or versioned
gem install rmagick -v '2.15.4' --source 'https://rubygems.org/'
I had a hard time getting this same issue to work when I had a default ImageMagick install on OSX 10.8 (no homebrew or macports). No combination of the suggestions in this thread or threads linked to from this thread worked for me (modifying the paths for my local install of course).
I simply deleted the default ImageMagick 6 install, and then reinstalled with macports. My rmagick install worked immediately after with no other changes.
on OSX Maverick 10.9.1
it took me ages to figure it out but I solved these issues the following way:
nano /etc/paths
changed:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
into:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
that that local stuff, like 'brew' is loaded first.
now I hit 'brew doctor' into the terminal, to see if there's something messed up
if you get the following output
Your system is ready to brew.
everthing is fine. if not ti will tell you what to do. Like kick out unbrewed stuff, broken libs, clean symlinks and whatnot.
When you are ready to brew, you need ghostscript(for pdfs), libpng, imagemagick via brew.
then you can happily type : 'gem install rmagick', in case you did't kill your ruby setup. But thats easy to reinstall via your cleaned up brew.
PS:
another helpful command is: 'which convert', to show you what version of imagemagick is used by the system.
as well as --version
so if you installed git via brew and do 'git --version' and it returns some apple git version, your load path is broken...
On Mac OS X 10.9, try to update your Xcode if there's a warning about it.
$ brew doctor
I you found some warning, do:
$ sudo /Developer/Library/uninstall-developer-folder
Then try:
$ bundle install
again
That worked fine for me.
On CentOS 6.5 x64, it was pretty easy:
yum install ImageMagick ImageMagick-devel
gem install rmagick -v '2.13.2'
I was able to fix this by upgrading to 2.13.2
All brew options failed to install rmagick 2.13.1 on yosemite 10.10
this worked
get the latest RVM
\curl -sSL https://get.rvm.io | bash -s stable --ruby
rvm install 2.1.1
rvm use 2.1.1
download and install the package file
http://cactuslab.com/imagemagick
(I used pacifist to install)
Confirm location of MagickCore.pc file
mdfind magickcore.pc
eg. /opt/ImageMagick/lib/pkgconfig/MagickCore.pc
Manually download rmagick-2.15.2.gem file
https://rubygems.org/gems/rmagick/versions/2.15.2
from that dir
sudo C_INCLUDE_PATH=/opt/ImageMagick/include/ImageMagick-6/ PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig gem install --local rmagick-2.15.2.gem
If you are having issues with bundle installer still complaining about 2.13.1
In your gem file / gem.lock file upgrade ALL dependencies
rmagick (2.13.1) - > rmagick (>= 2.15.2)
Got same error for alpine 3.9 image build. It comes with ImageMagick 7.0.8.38-r0
To fix that you either use alpine 3.5 with ImageMagick 6.9.6.8-r1:
FROM alpine:3.5
Or install ImageMagick 6.9.6.8-r1 with package repository for 3.5:
RUN apk add imagemagick-dev=6.9.6.8-r1 --repository http://dl-3.alpinelinux.org/alpine/v3.5/main/
There is an open issue in rmagick repo regarding failed builds for ImageMagick 7.0.x. so hopefully it will be fixed soon.

ERROR: Error installing ffi: ERROR: Failed to build gem native extension

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

Resources