Skip to content

Build fail on Linux #40

@Ryuno-Ki

Description

@Ryuno-Ki

This occured to me when trying to install jekyll-webmention_io, see aarongustafson/jekyll-webmention_io#75.

$ bundle install
Fetching gem metadata from https://rubygems.org/..........                                                                                                              
Fetching gem metadata from https://rubygems.org/.                                                                                                                       
Resolving dependencies...                                                                                                                                               
Using public_suffix 2.0.5                                                                                                                                               
Using addressable 2.5.1                                                                                                                                                 
Using bundler 1.16.0                                                                                                                                                    
Using colorator 1.1.0                                                                                                                                                   
Fetching unf_ext 0.0.7.5                                                                                                                                                
Installing unf_ext 0.0.7.5 with native extensions                                                                                                                       
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.                                                                                                      
                                                                                                                                                                        
    current directory: $HOME/.gem/ruby/2.3.0/gems/unf_ext-0.0.7.5/ext/unf_ext                                                                                    
/usr/bin/ruby23 -r ./siteconf20180225-16640-mruchr.rb extconf.rb                                                                                                        
checking for main() in -lstdc++... *** 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. 

Provided configuration options:                                                                                                                                         
        --with-opt-dir                                                                                                                                                  
        --without-opt-dir                                                                                                                                               
        --with-opt-include                                                                                                                                              
        --without-opt-include=${opt-dir}/include                                                                                                                        
        --with-opt-lib                                                                                                                                                  
        --without-opt-lib=${opt-dir}/lib64                                                                                                                              
        --with-make-prog                                                                                                                                                
        --without-make-prog                                                                                                                                             
        --srcdir=.                                                                                                                                                      
        --curdir                                                                                                                                                        
        --ruby=/usr/bin/$(RUBY_BASE_NAME)23                                                                                                                             
        --with-static-libstdc++                                                                                                                                         
        --without-static-libstdc++                                                                                                                                      
        --with-stdc++lib                                                                                                                                                
        --without-stdc++lib                                                                                                                                             
/usr/lib64/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an                                                                                       
executable file. (RuntimeError)                                                                                                                                         
You have to install development tools first.                                                                                                                            
        from /usr/lib64/ruby/2.3.0/mkmf.rb:541:in `try_link0'                                                                                                           
        from /usr/lib64/ruby/2.3.0/mkmf.rb:556:in `try_link'                                                                                                            
        from /usr/lib64/ruby/2.3.0/mkmf.rb:765:in `try_func'                                                                                                            
        from /usr/lib64/ruby/2.3.0/mkmf.rb:997:in `block in have_library'
        from /usr/lib64/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
        from /usr/lib64/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
        from /usr/lib64/ruby/2.3.0/mkmf.rb:320:in `open'
        from /usr/lib64/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
        from /usr/lib64/ruby/2.3.0/mkmf.rb:320:in `open'
        from /usr/lib64/ruby/2.3.0/mkmf.rb:346:in `postpone'
        from /usr/lib64/ruby/2.3.0/mkmf.rb:941:in `checking_for'
        from /usr/lib64/ruby/2.3.0/mkmf.rb:992:in `have_library'
        from extconf.rb:6:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be                                                                                     
found here:                                                                                                                                                             
                                                                                                                                                                        
$HOME/.gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/unf_ext-0.0.7.5/mkmf.log                                                                                     
                                                                                                                                                                        
extconf failed, exit code 1                                                                                                                                             
                                                                                                                                                                        
Gem files will remain installed in $HOME/.gem/ruby/2.3.0/gems/unf_ext-0.0.7.5                                                                                    
for inspection.                                                                                                                                                         
Results logged to                                                                                                                                                       
$HOME/.gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/unf_ext-0.0.7.5/gem_make.out                                                                                 
                                                                                                                                                                        
An error occurred while installing unf_ext (0.0.7.5), and Bundler cannot                                                                                                
continue.
Make sure that `gem install unf_ext -v '0.0.7.5'` succeeds before bundling.

In Gemfile:
  jekyll-webmention_io was resolved to 2.8.5, which depends on
    http was resolved to 2.2.2, which depends on
      http-cookie was resolved to 1.0.3, which depends on
        domain_name was resolved to 0.5.20170404, which depends on
          unf was resolved to 0.1.4, which depends on
            unf_ext

Activity

grasp

grasp commented on Apr 18, 2018

@grasp

any solution on this?

grasp

grasp commented on Apr 18, 2018

@grasp

my solution is : apt-get install g++

silverhammermba

silverhammermba commented on Apr 27, 2018

@silverhammermba

Nothing to do with this extension:

checking for main() in -lstdc++... *** extconf.rb failed *** 

This is telling you that you don't have a C++ compiler installed. You won't be able to install any native extensions that use C++.

Ryuno-Ki

Ryuno-Ki commented on May 13, 2018

@Ryuno-Ki
Author

G++ is installed

LC_ALL=C g++ --version
g++ (Gentoo Hardened 6.4.0-r1 p1.3) 6.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Still the same error.

kjian

kjian commented on May 22, 2018

@kjian

same here:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/kjian/.rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20180522-62521-1v2gv2c.rb extconf.rb

checking for main() in -lstdc++... yes
creating Makefile
...
unf was resolved to 0.1.4, which depends on
unf_ext

kjian

kjian commented on May 22, 2018

@kjian

I have installed multiple Xcode in /Applications, when compiling unf_ext, it selected the wrong Xcode.

So, when i reset the compiling toolchain to default, it worked.

sudo xcode-select -r

Ryuno-Ki

Ryuno-Ki commented on Jun 2, 2018

@Ryuno-Ki
Author

Now we just need to find a pendant on Linux :-)

JoshuaEdwards1991

JoshuaEdwards1991 commented on Jul 13, 2018

@JoshuaEdwards1991

Any fix for this?

kanstantsin-klachkou

kanstantsin-klachkou commented on Jul 30, 2018

@kanstantsin-klachkou

gem install unf_ext -v '0.0.7.5'

and then try again bundle install

inertia186

inertia186 commented on Nov 23, 2018

@inertia186

Well, it says to do that right in the error. Why didn't I think of that?

talezion

talezion commented on Oct 13, 2019

@talezion

Any solutions?

I get the same error.

sudo gem install unf_ext -v '0.0.7.6' --source 'https://rubygems.org/'

I was setting fastlane with Firebase Distribution and had to run bundle update

fastlane add_plugin firebase_app_distribution

Fetching unf_ext 0.0.7.6
Installing unf_ext 0.0.7.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

An error occurred while installing unf_ext (0.0.7.6), and Bundler
cannot continue.
Make sure that `gem install unf_ext -v '0.0.7.6' --source
'https://rubygems.org/'` succeeds before bundling.
talezion

talezion commented on Oct 13, 2019

@talezion

I updated ruby to 2.6.3 and is works now!

marlti7

marlti7 commented on Dec 23, 2019

@marlti7

Any fix for this?

hokita

hokita commented on Mar 4, 2020

@hokita

Any fix for this? ruby 2.6.5 doesn't work

KlausLiu

KlausLiu commented on Nov 14, 2020

@KlausLiu

Any fix for this? ruby 2.6.0 doesn't work

AndiBrunner

AndiBrunner commented on Jan 7, 2021

@AndiBrunner

I had the same issue, installing ruby-dev helped.

$ sudo apt-get install ruby-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @grasp@inertia186@KlausLiu@silverhammermba@talezion

        Issue actions

          Build fail on Linux · Issue #40 · knu/ruby-unf_ext