sparklemotion / nokogiri

Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.
https://nokogiri.org/
MIT License
6.16k stars 903 forks source link

Running 'compile' for libxml2 2.9.4... ERROR, review '/home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.4/compile.log' to see what happened. Last lines are: #1525

Closed chikadance closed 8 years ago

chikadance commented 8 years ago

the full output is:

roroco@roroco ~/Dropbox/rbs/ro_dict $ gem install nokogiri
Fetching: nokogiri-1.6.8.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    current directory: /home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/home/roroco/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20160813-19846-197qb86.rb extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts -g -std=c11 -fPIC... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.4.

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.4.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.4... OK
Running 'configure' for libxml2 2.9.4... OK
Running 'compile' for libxml2 2.9.4... ERROR, review '/home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.4/compile.log' to see what happened. Last lines are:
========================================================================
  status = getaddrinfo (host, NULL, &hints, &result);
           ^
nanohttp.c:1079:2: warning: nested extern declaration of ‘getaddrinfo’ [-Wnested-externs]
  status = getaddrinfo (host, NULL, &hints, &result);
  ^
nanohttp.c:1085:35: error: dereferencing pointer to incomplete type ‘struct addrinfo’
  for (res = result; res; res = res->ai_next) {
                                   ^
nanohttp.c:1089:7: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
       freeaddrinfo (result);
       ^
nanohttp.c:1089:7: warning: nested extern declaration of ‘freeaddrinfo’ [-Wnested-externs]
nanohttp.c:1073:18: warning: unused variable ‘hints’ [-Wunused-variable]
  struct addrinfo hints, *res, *result;
                  ^
make[2]: *** [nanohttp.lo] Error 1
make[2]: Leaving directory `/home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.4/libxml2-2.9.4'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.4/libxml2-2.9.4'
make: *** [all] Error 2
========================================================================
*** 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}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/roroco/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME)
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build
/home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:366:in `block in execute': Failed to complete compile task (RuntimeError)
    from /home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `chdir'
    from /home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `execute'
    from /home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:111:in `compile'
    from /home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:150:in `cook'
    from extconf.rb:364:in `block (2 levels) in process_recipe'
    from extconf.rb:257:in `block in chdir_for_build'
    from extconf.rb:256:in `chdir'
    from extconf.rb:256:in `chdir_for_build'
    from extconf.rb:363:in `block in process_recipe'
    from extconf.rb:262:in `tap'
    from extconf.rb:262:in `process_recipe'
    from extconf.rb:555:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /home/roroco/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out

my os is:

roroco@roroco ~/Dropbox/rbs/ro_dict $ lsb_release  -a
No LSB modules are available.
Distributor ID: LinuxMint
Description:    Linux Mint 17.3 Rosa
Release:    17.3
Codename:   rosa

my ruby version is:

roroco@roroco /tmp/youku $ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

when i try gem install nokogiri -- --use-system-libraries, i can install success, but i get ruby c ext error

chikadance commented 8 years ago
module Nokogiri
  module XML
    class Node
      # default Node#[] or Node#get will raise ruby c err, i cannot find the reason, so i should override it
      def [](name, *args, &blk)
        attributes[name].to_s
      end
  end
end
kokphinsheng commented 8 years ago

Kok phin chian Affinbank 200310001515

flavorjones commented 8 years ago

Hello!

A hint as to why you're getting this error is found in this line of the output:

checking if the C compiler accepts -g -std=c11 -fPIC... yes

These compiler options aren't set by Nokogiri ... they're likely being set in your CFLAGS environment variable, or in your build system.

Specfically, the error you're seeing is being cause by the -std=c11 option. libxml2's source code doesn't meet the C11 standard.

Hope this helps, -m

kokphinsheng commented 8 years ago

Send money bank account 200310001515 AFFINBANK Send to home depot

kokphinsheng commented 8 years ago

Code standard - std€c11 kok phin chian

flavorjones commented 8 years ago

Seems legit!