An Error Occurred While Installing Ffi 1 9 25 and Bundler Cannot Continue

Failed to build gem native extension (installing Compass)

When I attempt to install the latest version of compass (https://rubygems.org/gems/compass/versions/1.0.0.alpha.17), I get the following error.

              ERROR:  Error installing compass: ERROR: Failed to build gem native extension.   ERROR:  Error installing compass:   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=" clean  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  make failed, exit code 2  Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3 for inspection. Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/ffi-1.9.3/gem_make.out                          

What's going on here? How do I install the latest compass without error?


1) Solution

Try this, then try to install compass again

              apt-get install ruby-dev                          
2) Solution

In order to install compass On Mac OS X 10.10 (Yosemite)had to perform the following:

1. Set Up Ruby Environment

  • Ensure ruby is installed and up to date: ruby -v
  • Update gem's sudo gem update --system

2. Set Up MAC Environment

Install the Xcode Command Line Tools this is the key to install Compass.

              xcode-select --install                          

Installing the Xcode Command Line Tools are the key to getting Compass working on OS X

3. Install Compass

              sudo gem install compass                          
3) Solution

The best way is sudo apt-get install ruby-compass to install compass.

4) Solution

You can try in Debian with

              sudo apt-get install gcc ruby-dev rubygems compass                          

for Fedora, Centos

              yum -y install gcc ruby-devel rubygems compass                          

It worked for me.

5) Solution

I struggled with you same issue for about 3 hours. As of Compass 1.0.alpha19, the requirement is for the rvm version 1.9.3.

There are several uncollected posts, however what worked for me was the following:

  1. sudo gem uninstall sass
  2. sudo gem uninstall compass
  3. rvm install ruby-1.9.3-p448
  4. sudo gem install sass --pre
  5. sudo gem install compass --pre

and that did it. Hope it works for you as well!

6) Solution

For me to solve this issue, I had to make sure I had the most current version of Ruby and the gems gem update --system; then, I had to make sure that Xcode & the Command Line Tools were installed: xcode-select --install.

7) Solution

On Mac OS you need to install this feature!

              xcode-select --install                          
8) Solution

If you are using Ubuntu, you should try install build-essential

              apt install build-essential                          

I had troubles with gems installation on fresh installation of ubuntu, and this solution worked for me.

9) Solution

Hi it was a challenge to get it work on Mac so anyway here is a solution

  1. Install macports
  2. Install rvm
  3. Restart Terminal
  4. Run rvm requirements then run rvm install 2.1
  5. And last step to run gem install compass --pre

I'm not sure but ruby version on Mavericks doesn't support native extensions etc... so if you point to other ruby version like I did "2.1" it works fine.

10) Solution
              sudo gem update --system sudo gem install compass                          
11) Solution

Not sure why none of these are marked as the correct answer, but I landed here through a google search, so I will pass along what I know...

@paul_g's method was pretty close for me, my steps on a Mac osx10.9 Retina:

  • Install macports
  • Install rvm (stable with ruby add --insecure flag for SSL related issues) $\curl -sSL --insecure https://get.rvm.io | bash -s stable --ruby
  • Restart Terminal / Resource your profile
  • Run rvm requirements --with-gcc=clang You won't have to update Ruby because you downloaded the last stable version
  • And last step to run gem install compass --pre
12) Solution

For Mac OS:

My error was I forgot to select option in XCode - Preferences - Locations - Command Line Tools after new XCode installation (I had 2 versions and later I deleted one). Maybe it will help someone.

enter image description here

13) Solution

For macOS 10.14 Mojave, make sure you have already installed command line tools via xcode-select --install and the run the following command to install std headers.

              sudo open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg                          

Now try your command again.

14) Solution

You could need to install Apple's Command Line Tools, which probably aren't installed on your system by default. I was getting the same error, but before following any of the instructions here I installed Command Line Tools (due to an unrelated issue) and lo and behold compass installed without issue when I tried again. YMMV.

15) Solution

In order to install Compass on Yosemite you need to set up the Ruby environment and to install the Xcode Command Line Tools. But, most important thing, after updating Xcode, be sure to launch the Xcode application and accept the Apple license terms. It will complete the installation of the components. After that, you can install Compass: sudo gem install compass

16) Solution

you must have gcc,json_pure

i collect some information from several post

                sudo gem uninstall sass sudo gem uninstall compass sudo gem update --system gem install json_pure   (if you have already have continued to next step) sudo yum install gcc gcc-c++   (if you have already have continued to next step) sudo gem install sass  sudo gem install compass              

Hi if ** sudo gem update --system ** not working you got an error in the update then use

sudo gem update --system 2.7.8

17) Solution

In ubuntu 14.04, while execute apt-get install rubygems, there is a error

E: Package 'rubygems' has no installation candidate

follow command solve the problems.

sudo apt-get install gcc ruby-devel rubygems-integration ruby-compass

18) Solution

when

gem install overcommit

is run also this error have been placed in terminal.

              Failed to build gem native extension                          

please do the same

              xcode-select --install                          

and it will fix that issue too

19) Solution

On yosemite, all you must do is install the command line tools. then it works.

Even if other gems installed fine. You must run xcode-select --install for gem install compass to work.

Good luck.

20) Solution

On Mac OS X 10.9, if you try xcode-select --install, you will get the following error :

Can't install the software because it is not currently available from the Software Update server.

The solution is to download Command Line Tools (OS X 10.9) directly from Apple website : https://developer.apple.com/downloads/index.action?name=for%20Xcode%20-

You will then be able to install the last version of Command Line Tools.

21) Solution

Try brew install coreutils.

I've hit this problem while rebuilding an aging sass/compass project that was recently updated to ruby 2.2.5 by a colleague. The project uses rvm and bundler. These were my commands

              $ rvm install ruby-2.2.5 $ rvm use ruby-2.2.5 $ gem install bundler $ bundle install                          

This caused me to hit the famed ffi installation errors, that are reported around the StackOverflow environment:

              An error occurred while installing ffi (1.9.14), and Bundler cannot continue.                          

Most of the suggestions to solve this problem are to install Xcode command line tools. However this was already installed in my environment:

              $ xcode-select -p /Library/Developer/CommandLineTools                          

Other suggestions said to install gcc... so I tried:

              $ brew install gcc46                          

But this also failed due to a segmentation fault... ¯\_(ツ)_/¯.

So, I then tried installing compass by hand, just to see if it would give the same ffi error:

              $ gem install compass                          

But to my surprise, I got a totally different error:

              make: /usr/local/bin/gmkdir: No such file or directory                          

So I searched for that issue, and found this ancient blog post that said to install coreutils:

              $ brew install coreutils                          

After installing coreutils with Homebrew, bundler was able to finish and installed compass and dependencies successfully.

The End.

22) Solution

Try this, then try to install compass again

              sudo apt install ruby-full                          
23) Solution

I had the same problem on Linux Mint but I was able to fix it by uninstalling ruby and install it again.

Uninstall ruby:

              sudo apt-get remove ruby                          

It reported some ruby packages like:

              Package 'ruby' is not installed, so not removed The following packages were automatically installed and are no longer required: libruby2.2 ruby-chunky-png ruby-sass rubygems-integration Use 'apt-get autoremove' to remove them.                          

Uninstall remaining packages*

              apt-get autoremove                          

Install ruby again

              sudo apt-get install ruby2.2                          

Install Compass

              sudo gem install compass                          

The last command was executed with success.

24) Solution

First had to upgrade from Ruby 2.6 to 3.0 (see https://rvm.io/):

              $ curl -sSL https://get.rvm.io | bash -s stable --ruby $ source /Usrs/myuser/.rvm/scripts/rvm                          

Then I had to install it in local because otherwise Mac OSX permissions won`t let me upgrade it (see ERROR: While executing gem ... (Errno::EPERM) Operation not permitted):

              $ sudo gem install -n /usr/local/bin compass                          

I am not totally sure if installing rvm above first was necessary, but it was useful for upgrading ruby.

25) Solution

Installing Ruby gems on a Mac is a common source of confusion and frustration. Unfortunately, most solutions are incomplete, outdated, and provide bad advice. The answer here with the most votes says to use sudo which you should never need to do, especially if you don't understand what it does.

Learn why you should never use sudo to install gems.

It is correct that the error "Failed to build gem native extension" is due to the Apple command line tools not being installed. However, installing them won't necessarily provide you with a proper Ruby environment.

At a high level, there are 5 steps to a working Ruby setup, which I've written about in detail in my definitive guide to installing Ruby gems on a Mac. It explains why you are getting this error, compares the various solutions, why some are better than others, and why you shouldn't use sudo.

I've also written about these steps in this answer: https://stackoverflow.com/a/54873916/928191

Related Topics terminal macos ruby compass-sass
Comments
8 years, 5 months ago possible duplicate of Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'
8 years, 5 months ago I recently had the same issue but with a newer version. What I did is to uninstall the ruby version I installed previously with aptitude and then I installed it again with following the instructions at: rvm.io/rvm/install. With the new ruby/rvm version compass built properly.
8 years, 2 months ago Thanks for this, very helpful. I changed step 3 to rvm install ruby-2.1.2 as 1.9.3 is no longer being updated
8 years ago This solved the above issue for me, so I would say this is an acceptable answer to the above question.
8 years ago This fixes the error on Ubuntu, but it seems OP is using OSX.
7 years, 10 months ago For me this was exactly the right answer, it needs the Xcode command line tools
7 years, 7 months ago Worked on CentOS with "yum install ruby-devel" which is the equivalent. Thanks !
7 years, 7 months ago Funny to find a solution to my Ubuntu problem in an answer to an OSx question. Nevertheless, you've got my upvote as your answer just solved my problem. Tnx!
7 years, 6 months ago I would recommend not using macports.
7 years, 5 months ago Thanks, worked for me, you are right, the Xcode Command Line Tools are the key.
7 years, 4 months ago This worked for me with one addition - you have to actually start XCODE so that you can accept the license agreement and let it finish setup. Might be worth tagging onto your answer.
7 years, 3 months ago I also had to install make.
7 years, 1 month ago Wow, sometimes it's so easy ^^ tried to install compass with gem, but there were some dependencies not resolved by gem. With apt-get it worked fine! Thanks
7 years ago Accepting the update(terms of agreement) through the GUI worked also.
5 years, 12 months ago I think installing ruby-dev helped, but I also had to install gcc & make. The errors are not very clear about that.
5 years, 6 months ago I also had to run sudo yum install -y redhat-rpm-config for Fedora 24 before installing compass because of this error: gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
5 years ago On a recently updated MacBook Pro to Sierra 10.12.6, I also had to run "sudo xcodebuild -license" to accept terms and conditions, before running sudo gem install compass....
4 years, 11 months ago Any idea how to get this to work on Windows? I installed the Ruby dev tools using choco install ruby2.devkit but it's still not working
4 years ago ruby-dev did the trick stackoverflow.com/questions/20559255/…
3 years, 9 months ago I had the same problem. Some more people should upvote this.
3 years, 9 months ago please make sure you have make on your system.
3 years, 4 months ago xcode-select --install was done but this doesn't solve it for me
3 years, 4 months ago sudo gem update --system gave me errors: ERROR: While executing gem ... (Errno::EPERM) Operation not permitted @ rb_sysopen - System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem :(
3 years, 4 months ago I get xcode-select: error: command line tools are already installed, use "Software Update" to install updates. This doesn't fix it.
1 year, 7 months ago macOS 11.2 BigSur trying to install sudo gem install compass with OP error. Installing xcode fixed it and I can finally install compass. Mucha gracias!
8 months, 3 weeks ago This is the answer for me.
Mentions cusejuice Rutger van Baren Soviut neteru Nolwennig cooljl31 Ben Creasy vanduc1102 A. A. Trabucco Campos BlackHatSamurai alvescleiton paul.g Adrian tbremer double-beep Federico Bohn Community Eridana John Ryan Gratz Vincent Sit gsm A.Sanchez.SD lepix onebraveman JamesWilson Anja Ishmukhametova Pokkhi claudiu.f.marginean user8128167 monfresh

dixonmrsoled46.blogspot.com

Source: https://bitcoden.com/answers/failed-to-build-gem-native-extension-installing-compass

0 Response to "An Error Occurred While Installing Ffi 1 9 25 and Bundler Cannot Continue"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel