sparklemotion / nokogiri

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

Rails 4.2 installation issues with Nokogiri on OS X #1214

Closed andrasio closed 8 years ago

andrasio commented 9 years ago

Some developers have had issues when installing Nokogiri because it depends on libiconv, which doesn't ship with OS X Yosemite. I do know we have /usr/lib/libiconv.dylib, but I can't find header files.

I faced issues before Rails 4.2 release while trying to install nokogiri.

We at Tokaido would like to make developer's life easier by simply shipping with a static build of libiconv included with a Ruby build that has a patched rbconfig.rb file. With this hack, when someone tries to install nokogiri on our isolated environment, it will implicitly add the configure flags to the path where our own libiconv header and libs are.

This approach works. The problem is that this line is the showstopper, no matter the flags we pass in.

if darwin_p && !File.exist?('/usr/include/iconv.h')

I'm somewhat worried about the rest of rubyists trying to install latest Rails and face this. Tokaido will ship with Rails 4.2 and nokogiri already compiled so it shouldn't be a problem for them but I wanted to share this.

With our isolated environment and assuming we have 'iconv.h' at /path/to/tokaido/iconv/include/iconv.h (which we do), if we do a symlink from /usr/include/iconv.h (using sudo) to our Tokaido iconv.h and run:

gem install nokogiri --no-ri --no-rdoc

it compiles successfully.

tenderlove commented 9 years ago

Is Tokaido meant to run on a machine that doesn't have the xcode dev tools installed?

andrasio commented 9 years ago

@tenderlove Initially, yes.

You open Tokaido and should be able to boot a web app within seconds.

andrasio commented 9 years ago

@tenderlove I'm facing something new now.

Hacked rubygems with the following code at rubygems/ext/builder.rb

  def ready(tokaido_gem_extensioner)
    say "Tokaido is looking if build flags are needed for a smooth native build..."

    addition = tokaido_gem_extensioner.flags_for(@spec.name)

    say "#{addition.size} found."

    begin
      say "Tokaido will add the following flags: #{addition.join(', ')}" 
      @build_args  << addition
    end unless addition.empty?
  end

  def initialize spec, build_args = spec.build_args
    @spec       = spec
    @build_args = build_args
    @gem_dir    = spec.full_gem_path

    @ran_rake   = nil

    require File.join(File.expand_path("~"), '.tokaido/Bootstrap/lib/tokaido/bootstrap/piloto')
    Tokaido::Bootstrap::GemExtensioner.new(self)
  end

On the Tokaido side we have:

module Tokaido
  module Bootstrap
    module Flags
      STATIC_BUILDS = File.join(File.expand_path("~"), ".tokaido", "Gems", "supps")
      ICONV = File.join(STATIC_BUILDS, "iconv")

      NOKOGIRI = ["--with-iconv-dir=#{ICONV}"]
    end

    class GemExtensioner
      def initialize(builder)
        @builder = builder
        @builder.ready(self)
      end  

      def flags_for(given_gem)
        begin
          Flags.const_get(given_gem.upcase.to_sym)
        rescue
          []
        end
      end
    end
  end
end

So, when I run gem install nokogiri --no-ri --no-rdoc (before this I'm symlinking from /usr/include/iconv.h to /path/to/tokaido/iconv/include/iconv.h to pass the showstopper). The new errors I'm facing are the following: (I believe when it tries libxml2 it doesn't find libiconv.a that Tokaido bundles up with)

Also I'm not sure if at this point of failure is actually linking to the dylib that OS X Yosemite ships with.

MacBook-Air-de-Margot:~ andras$ gem install nokogiri --no-ri --no-rdoc
Tokaido is looking if build flags are needed for a smooth native build...
checking for nokogiri ...
1 found.
Tokaido will add the following flags:  --with-iconv-dir=/Users/andras/.tokaido/Gems/supps/iconv 
Building native extensions with: ' --with-iconv-dir=/Users/andras/.tokaido/Gems/supps/iconv '
This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /Users/andras/.tokaido/Rubies/2.1.5-p273/bin/ruby -r ./siteconf20141223-58767-1xvrxz9.rb extconf.rb  --with-iconv-dir=/Users/andras/.tokaido/Gems/supps/iconv 
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
checking for iconv using --with-iconv-* flags... yes
************************************************************************
IMPORTANT NOTICE:

Buidling Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:
    - 0001-Revert-Missing-initialization-for-the-catalog-module.patch
    - 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch

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.2.tar.gz into tmp/x86_64-apple-darwin12.5.0/ports/libxml2/2.9.2... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch...
Running 'patch' for libxml2 2.9.2... OK
Running 'configure' for libxml2 2.9.2... OK
Running 'compile' for libxml2 2.9.2... OK
Running 'install' for libxml2 2.9.2... OK
Activating libxml2 2.9.2 (from /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2)...
************************************************************************
IMPORTANT NOTICE:

Buidling Nokogiri with a packaged version of libxslt-1.1.28
with the following patches applied:
    - 0001-Adding-doc-update-related-to-1.1.28.patch
    - 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
    - 0003-Initialize-pseudo-random-number-generator-with-curre.patch
    - 0004-EXSLT-function-str-replace-is-broken-as-is.patch
    - 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch
    - 0007-Separate-function-for-predicate-matching-in-patterns.patch
    - 0008-Fix-direct-pattern-matching.patch
    - 0009-Fix-certain-patterns-with-predicates.patch
    - 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch
    - 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
    - 0014-Fix-for-bug-436589.patch
    - 0015-Fix-mkdir-for-mingw.patch

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
************************************************************************
Extracting libxslt-1.1.28.tar.gz into tmp/x86_64-apple-darwin12.5.0/ports/libxslt/1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0004-EXSLT-function-str-replace-is-broken-as-is.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0006-Fix-str-padding-to-work-with-UTF-8-strings.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0007-Separate-function-for-predicate-matching-in-patterns.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0008-Fix-direct-pattern-matching.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0009-Fix-certain-patterns-with-predicates.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0014-Fix-for-bug-436589.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/patches/libxslt/0015-Fix-mkdir-for-mingw.patch...
Running 'patch' for libxslt 1.1.28... OK
Running 'configure' for libxslt 1.1.28... OK
Running 'compile' for libxslt 1.1.28... OK
Running 'install' for libxslt 1.1.28... OK
Activating libxslt 1.1.28 (from /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28)...
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.
-----
*** 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=/Users/andras/.tokaido/Rubies/2.1.5-p273/bin/ruby
    --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
    --with-xml2lib
    --without-xml2lib
    --with-libxml2lib
    --without-libxml2lib

extconf failed, exit code 1

Gem files will remain installed in /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5 for inspection.
Results logged to /Users/andras/.tokaido/Gems/extensions/x86_64-darwin-12/2.1.0-static/nokogiri-1.6.5/gem_make.out

mkmf.log

"/usr/bin/clang -o conftest -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -pipe  conftest.c  -L. -L/Users/andras/.tokaido/Rubies/2.1.5-p273/lib -L. -Bstatic    -arch x86_64   -lruby-static -framework CoreFoundation  -lpthread -ldl -lobjc  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"/usr/bin/clang -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -pipe   -arch x86_64  -Werror -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

"/usr/bin/clang -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -pipe  -Wno-error=unused-command-line-argument-hard-error-in-future  -arch x86_64  -Werror -c conftest.c"
error: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Werror,-Wunknown-warning-option]
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

have_iconv?: checking for iconv using --with-iconv-* flags... -------------------- yes

"/usr/bin/clang -o conftest -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -I/Users/andras/.tokaido/Gems/supps/iconv/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -pipe  conftest.c  -L. -L/Users/andras/.tokaido/Rubies/2.1.5-p273/lib -L/Users/andras/.tokaido/Gems/supps/iconv/lib -L. -Bstatic    -arch x86_64   -lruby-static -framework CoreFoundation  -lpthread -ldl -lobjc  "
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _main in conftest-50cde2.o
  "_libiconv_open", referenced from:
      _main in conftest-50cde2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <stdlib.h>
 4: #include <iconv.h>
 5: 
 6: int main(void)
 7: {
 8:     iconv_t cd = iconv_open("", "");
 9:     iconv(cd, NULL, NULL, NULL, NULL);
10:     return EXIT_SUCCESS;
11: }
/* end */

"/usr/bin/clang -o conftest -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -I/Users/andras/.tokaido/Gems/supps/iconv/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -pipe  conftest.c  -L. -L/Users/andras/.tokaido/Rubies/2.1.5-p273/lib -L/Users/andras/.tokaido/Gems/supps/iconv/lib -L. -Bstatic    -arch x86_64   -lruby-static -framework CoreFoundation -liconv -lpthread -ldl -lobjc  "
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <stdlib.h>
 4: #include <iconv.h>
 5: 
 6: int main(void)
 7: {
 8:     iconv_t cd = iconv_open("", "");
 9:     iconv(cd, NULL, NULL, NULL, NULL);
10:     return EXIT_SUCCESS;
11: }
/* end */

--------------------

have_library: checking for main() in -llzma... -------------------- yes

"/usr/bin/clang -o conftest -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/andras/.tokaido/Rubies/2.1.5-p273/lib -L. -Bstatic    -arch x86_64   -lruby-static -framework CoreFoundation -llzma  -lpthread -ldl -lobjc  "
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
/* end */

--------------------

have_func: checking for xmlParseDoc() in libxml/parser.h... -------------------- no

"/usr/bin/clang -o conftest -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/include -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2\" -DNOKOGIRI_LIBXML2_PATCHES\=\"0001-Revert-Missing-initialization-for-the-catalog-module.patch\ 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch\" -DNOKOGIRI_LIBXSLT_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28\" -DNOKOGIRI_LIBXSLT_PATCHES\=\"0001-Adding-doc-update-related-to-1.1.28.patch\ 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch\ 0003-Initialize-pseudo-random-number-generator-with-curre.patch\ 0004-EXSLT-function-str-replace-is-broken-as-is.patch\ 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch\ 0007-Separate-function-for-predicate-matching-in-patterns.patch\ 0008-Fix-direct-pattern-matching.patch\ 0009-Fix-certain-patterns-with-predicates.patch\ 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch\ 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch\ 0014-Fix-for-bug-436589.patch\ 0015-Fix-mkdir-for-mingw.patch\" -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/andras/.tokaido/Rubies/2.1.5-p273/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib -L. -Bstatic    -arch x86_64  /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lpthread -ldl -lobjc  "
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _xmlIconvWrapper in libxml2.a(encoding.o)
  "_libiconv_close", referenced from:
      _xmlFindCharEncodingHandler in libxml2.a(encoding.o)
      _xmlCharEncCloseFunc in libxml2.a(encoding.o)
  "_libiconv_open", referenced from:
      _xmlFindCharEncodingHandler in libxml2.a(encoding.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libxml/parser.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))xmlParseDoc; return 0; }
/* end */

"/usr/bin/clang -o conftest -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/include -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2\" -DNOKOGIRI_LIBXML2_PATCHES\=\"0001-Revert-Missing-initialization-for-the-catalog-module.patch\ 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch\" -DNOKOGIRI_LIBXSLT_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28\" -DNOKOGIRI_LIBXSLT_PATCHES\=\"0001-Adding-doc-update-related-to-1.1.28.patch\ 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch\ 0003-Initialize-pseudo-random-number-generator-with-curre.patch\ 0004-EXSLT-function-str-replace-is-broken-as-is.patch\ 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch\ 0007-Separate-function-for-predicate-matching-in-patterns.patch\ 0008-Fix-direct-pattern-matching.patch\ 0009-Fix-certain-patterns-with-predicates.patch\ 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch\ 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch\ 0014-Fix-for-bug-436589.patch\ 0015-Fix-mkdir-for-mingw.patch\" -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/andras/.tokaido/Rubies/2.1.5-p273/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib -L. -Bstatic    -arch x86_64  /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lpthread -ldl -lobjc  "
conftest.c:15:27: error: too few arguments to function call, single argument 'cur' was not specified
int t(void) { xmlParseDoc(); return 0; }
              ~~~~~~~~~~~ ^
/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2/libxml/parser.h:841:11: note: 'xmlParseDoc' declared here
XMLPUBFUN xmlDocPtr XMLCALL
          ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libxml/parser.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { xmlParseDoc(); return 0; }
/* end */

--------------------

have_library: checking for xmlParseDoc() in -lxml2... -------------------- no

"/usr/bin/clang -o conftest -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/include -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2\" -DNOKOGIRI_LIBXML2_PATCHES\=\"0001-Revert-Missing-initialization-for-the-catalog-module.patch\ 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch\" -DNOKOGIRI_LIBXSLT_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28\" -DNOKOGIRI_LIBXSLT_PATCHES\=\"0001-Adding-doc-update-related-to-1.1.28.patch\ 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch\ 0003-Initialize-pseudo-random-number-generator-with-curre.patch\ 0004-EXSLT-function-str-replace-is-broken-as-is.patch\ 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch\ 0007-Separate-function-for-predicate-matching-in-patterns.patch\ 0008-Fix-direct-pattern-matching.patch\ 0009-Fix-certain-patterns-with-predicates.patch\ 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch\ 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch\ 0014-Fix-for-bug-436589.patch\ 0015-Fix-mkdir-for-mingw.patch\" -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/andras/.tokaido/Rubies/2.1.5-p273/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib -L. -Bstatic    -arch x86_64  /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation -lxml2 /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lpthread -ldl -lobjc  "
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _xmlIconvWrapper in libxml2.a(encoding.o)
  "_libiconv_close", referenced from:
      _xmlFindCharEncodingHandler in libxml2.a(encoding.o)
      _xmlCharEncCloseFunc in libxml2.a(encoding.o)
  "_libiconv_open", referenced from:
      _xmlFindCharEncodingHandler in libxml2.a(encoding.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libxml/parser.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))xmlParseDoc; return 0; }
/* end */

"/usr/bin/clang -o conftest -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/include -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2\" -DNOKOGIRI_LIBXML2_PATCHES\=\"0001-Revert-Missing-initialization-for-the-catalog-module.patch\ 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch\" -DNOKOGIRI_LIBXSLT_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28\" -DNOKOGIRI_LIBXSLT_PATCHES\=\"0001-Adding-doc-update-related-to-1.1.28.patch\ 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch\ 0003-Initialize-pseudo-random-number-generator-with-curre.patch\ 0004-EXSLT-function-str-replace-is-broken-as-is.patch\ 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch\ 0007-Separate-function-for-predicate-matching-in-patterns.patch\ 0008-Fix-direct-pattern-matching.patch\ 0009-Fix-certain-patterns-with-predicates.patch\ 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch\ 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch\ 0014-Fix-for-bug-436589.patch\ 0015-Fix-mkdir-for-mingw.patch\" -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/andras/.tokaido/Rubies/2.1.5-p273/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib -L. -Bstatic    -arch x86_64  /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation -lxml2 /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lpthread -ldl -lobjc  "
conftest.c:15:27: error: too few arguments to function call, single argument 'cur' was not specified
int t(void) { xmlParseDoc(); return 0; }
              ~~~~~~~~~~~ ^
/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2/libxml/parser.h:841:11: note: 'xmlParseDoc' declared here
XMLPUBFUN xmlDocPtr XMLCALL
          ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libxml/parser.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { xmlParseDoc(); return 0; }
/* end */

--------------------

have_library: checking for xmlParseDoc() in -llibxml2... -------------------- no

"/usr/bin/clang -o conftest -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/include -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2\" -DNOKOGIRI_LIBXML2_PATCHES\=\"0001-Revert-Missing-initialization-for-the-catalog-module.patch\ 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch\" -DNOKOGIRI_LIBXSLT_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28\" -DNOKOGIRI_LIBXSLT_PATCHES\=\"0001-Adding-doc-update-related-to-1.1.28.patch\ 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch\ 0003-Initialize-pseudo-random-number-generator-with-curre.patch\ 0004-EXSLT-function-str-replace-is-broken-as-is.patch\ 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch\ 0007-Separate-function-for-predicate-matching-in-patterns.patch\ 0008-Fix-direct-pattern-matching.patch\ 0009-Fix-certain-patterns-with-predicates.patch\ 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch\ 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch\ 0014-Fix-for-bug-436589.patch\ 0015-Fix-mkdir-for-mingw.patch\" -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/andras/.tokaido/Rubies/2.1.5-p273/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib -L. -Bstatic    -arch x86_64  /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation -llibxml2 /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lpthread -ldl -lobjc  "
ld: library not found for -llibxml2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libxml/parser.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))xmlParseDoc; return 0; }
/* end */

"/usr/bin/clang -o conftest -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/x86_64-darwin12.0 -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0/ruby/backward -I/Users/andras/.tokaido/Rubies/2.1.5-p273/include/ruby-2.1.0 -I. -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/include -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -I/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2\" -DNOKOGIRI_LIBXML2_PATCHES\=\"0001-Revert-Missing-initialization-for-the-catalog-module.patch\ 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch\" -DNOKOGIRI_LIBXSLT_PATH\=\"/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28\" -DNOKOGIRI_LIBXSLT_PATCHES\=\"0001-Adding-doc-update-related-to-1.1.28.patch\ 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch\ 0003-Initialize-pseudo-random-number-generator-with-curre.patch\ 0004-EXSLT-function-str-replace-is-broken-as-is.patch\ 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch\ 0007-Separate-function-for-predicate-matching-in-patterns.patch\ 0008-Fix-direct-pattern-matching.patch\ 0009-Fix-certain-patterns-with-predicates.patch\ 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch\ 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch\ 0014-Fix-for-bug-436589.patch\ 0015-Fix-mkdir-for-mingw.patch\" -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/andras/.tokaido/Rubies/2.1.5-p273/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib -L/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib -L. -Bstatic    -arch x86_64  /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation -llibxml2 /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/lib/libxml2.a -llzma -lpthread -ldl -lobjc  "
conftest.c:15:27: error: too few arguments to function call, single argument 'cur' was not specified
int t(void) { xmlParseDoc(); return 0; }
              ~~~~~~~~~~~ ^
/Users/andras/.tokaido/Gems/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin12.5.0/libxml2/2.9.2/include/libxml2/libxml/parser.h:841:11: note: 'xmlParseDoc' declared here
XMLPUBFUN xmlDocPtr XMLCALL
          ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libxml/parser.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { xmlParseDoc(); return 0; }
/* end */

--------------------
andrasio commented 9 years ago

@tenderlove So, you are not supposed to have the developer tools (initially) when running Tokaido. I was working on this nokogiri issue before Rails 4.2 was released.

When someone wants to use the isolated environment from Tokaido, and, say, start using gems that are native extensions, then yes, developer would have to install developer tools.

I was concerned with the fact that, someone might want to use nokogiri in the future... and face this. Ideally, having developer tools and Tokaido should be a breeze to install it (then again the showstopper line)

But now that Rails 4.2 is out, I stumbled with the surprise that it requires nokogiri.

Currently I'm trying many libiconv builds and see if the problem could be there.

wycats commented 9 years ago

@tenderlove the idea is that Tokaido should be enough to get started and get through a training class smoothly without failure modes. If you install the dev tools later, Tokaido picks up the change and patches rbconfig to point at the right C compiler.

flavorjones commented 9 years ago

I believe this will be fixed by the fix proposed in #1218.

mojca commented 9 years ago

I tried the patch from http://buegling.com/blog/2015/4/26/building-nokogiri-on-os-x, but I still get the same problem:

Activating libxslt 1.1.28 (from /Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxslt/1.1.28)...
checking for main() in -llzma... no
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.
-----
*** extconf.rb failed ***

with mkmf.log complaining about libiconv:

have_func: checking for xmlParseDoc() in libxml/parser.h... -------------------- no

"clang -o conftest -I/Users/me/.rbenv/versions/2.2.3/include/ruby-2.2.0/x86_64-darwin11.0 -I/Users/me/.rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/backward -I/Users/me/.    rbenv/versions/2.2.3/include/ruby-2.2.0 -I. -I/Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxslt/1.1.28/        include -I/Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxml2/2.9.2/include/libxml2 -I/Users/me/.rbenv/       versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxml2/2.9.2/include/libxml2 -I/Users/me/.rbenv/versions/2.2.3/include  -            D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   "-DNOKOGIRI_LIBXML2_PATH=\"/Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.  rc3/ports/x86_64-apple-darwin11.4.2/libxml2/2.9.2\"" "-DNOKOGIRI_LIBXML2_PATCHES=\"\"" "-DNOKOGIRI_LIBXSLT_PATH=\"/Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/      nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxslt/1.1.28\"" "-DNOKOGIRI_LIBXSLT_PATCHES=\"\""  -O3 -Wno-error=shorten-64-to-32  -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES   conftest.c  -L/Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxml2/2.9.2/lib -L/Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxslt/1.1.28/lib -L. -L/Users/me/.rbenv/versions/2.2.3/lib -L. -L/Users/me/.rbenv/versions/2.2. 3/lib  -fstack-protector -L/usr/local/lib    /Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxslt/1.1.28/lib/     libexslt.a -lm -liconv -lpthread -lz /Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxml2/2.9.2/lib/libxml2.a /   Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/me/. rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxml2/2.9.2/lib/libxml2.a -lruby-static -framework CoreFoundation /Users/me/. rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/me/.rbenv/       versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxml2/2.9.2/lib/libxml2.a /Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/ nokogiri-1.6.7.rc3/ports/x86_64-apple-darwin11.4.2/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6. 7.rc3/ports/x86_64-apple-darwin11.4.2/libxml2/2.9.2/lib/libxml2.a -lpthread -ldl -lobjc  "
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _xmlIconvWrapper in libxml2.a(encoding.o)
  "_libiconv_close", referenced from:
      _xmlFindCharEncodingHandler in libxml2.a(encoding.o)
      _xmlCharEncCloseFunc in libxml2.a(encoding.o)
  "_libiconv_open", referenced from:
      _xmlFindCharEncodingHandler in libxml2.a(encoding.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Initially it does find the header, even though I don't quite understand the logic (it fails, but say that finding iconv was successful):

have_header: checking for iconv.h... -------------------- yes

[...]

have_iconv?: checking for iconv... -------------------- yes

"clang -o conftest -I/Users/me/.rbenv/versions/2.2.3/include/ruby-2.2.0/x86_64-darwin11.0 -I/Users/me/.rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/backward -I/Users/me/.rbenv/versions/2.2.3/include/ruby-2.2.0 -I. -I/Users/me/.rbenv/versions/2.2.3/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -Wno-   error=shorten-64-to-32  -pipe  conftest.c  -L. -L/Users/me/.rbenv/versions/2.2.3/lib -L. -L/Users/me/.rbenv/versions/2.2.3/lib  -fstack-protector -L/usr/local/lib     -lruby-static -framework CoreFoundation  -lpthread -ldl -lobjc  "
Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      _main in conftest-TqBJYZ.o
  "_iconv_open", referenced from:
      _main in conftest-TqBJYZ.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <stdlib.h>
 4: #include <iconv.h>
 5: 
 6: int main(void)
 7: {
 8:     iconv_t cd = iconv_open("", "");
 9:     iconv(cd, NULL, NULL, NULL, NULL);
10:     return EXIT_SUCCESS;
11: }
/* end */

My current workaround is to use

gem install nokogiri -- --use-system-libraries --with-xml=/opt/local/

but I don't like this solution because the gem will become broken as soon as I upgrade libxml2 inside /opt/local.

Why doesn't nokogiri simply fetch and build its own version of libiconv like it does for libxml2? That would solve a number of problems.

flavorjones commented 9 years ago

@mojca, thanks for commenting. I just said, above your comment, that we have a PR to fix this issue.

mojca commented 9 years ago

Which PR and which problem? All I wanted to say is that I tried to apply https://github.com/sparklemotion/nokogiri/pull/1218/files, but my problem didn't go away yet. It is possible that the PR #1218 solves one of the many problems related to libiconv (mainly on 10.11), just not all of them yet.

flavorjones commented 8 years ago

@mojca Can you please try building from source on master? If that doesn't address your issue, then let's examine what's going on with the patch from #1218 applied.

There is likely more than one issue going on, so I'm trying to be thorough and not conflate things.

mojca commented 8 years ago

I tried the master and it still fails. What's the desired way to send you feedback / details?

checking for main() in -llzma... no
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.

The file ~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-11/2.2.0-static/nokogiri-1.6.7.rc4/mkmf.log says that the failure to find libxml

have_func: checking for xmlParseDoc() in libxml/parser.h... -------------------- no

is because of:

Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _xmlIconvWrapper in libxml2.a(encoding.o)
  "_libiconv_close", referenced from:
      _xmlFindCharEncodingHandler in libxml2.a(encoding.o)
      _xmlCharEncCloseFunc in libxml2.a(encoding.o)
  "_libiconv_open", referenced from:
      _xmlFindCharEncodingHandler in libxml2.a(encoding.o)
ld: symbol(s) not found for architecture x86_64

while the beginning of gem_make.out reports that iconv has been successfully found:

checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes

I was following the last section of http://buegling.com/blog/2015/4/26/building-nokogiri-on-os-x to build from master (without checking out any particular tag, just leaving the sources at master).

mojca commented 8 years ago

As already mentioned above, one particularly suspicious part of the log is the following:

have_iconv?: checking for iconv... -------------------- yes

"clang -o conftest -I/Users/me/.rbenv/versions/2.2.3/include/ruby-2.2.0/x86_64-darwin11.0 -I/Users/me/.rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/backward -I/Users/me/.rbenv/versions/2.2.3/include/ruby-2.2.0 -I. -I/Users/me/.rbenv/versions/2.2.3/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -Wno-error=shorten-64-to-32  -pipe  conftest.c  -L. -L/Users/me/.rbenv/versions/2.2.3/lib -L. -L/Users/me/.rbenv/versions/2.2.3/lib  -fstack-protector -L/usr/local/lib     -lruby-static -framework CoreFoundation  -lpthread -ldl -lobjc  "
Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      _main in conftest-iiEMBa.o
  "_iconv_open", referenced from:
      _main in conftest-iiEMBa.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <stdlib.h>
 4: #include <iconv.h>
 5: 
 6: int main(void)
 7: {
 8:     iconv_t cd = iconv_open("", "");
 9:     iconv(cd, NULL, NULL, NULL, NULL);
10:     return EXIT_SUCCESS;
11: }
/* end */

There is no -liconv in the command that calls clang. I don't understand why the "iconv detection" succeeds in the first place. But calling clang manually on the same source file without -liconv fails for me as well. And if I add -liconv manually, the compilation succeeds. (But I don't know where that flag should be added in the configuration files, so I don't know how to fix the problem.)

flavorjones commented 8 years ago

@mojca Great, thank you for the additional feedback. This is useful for us to narrow down the cause of your problem.

Worth noting, though, that patch #1218 (commit c623c84) does really address the original poster's problem in this issue, and so I'm going to close this ticket.

It sounds like you're describing a different problem, possibly the one being discussed at #1334. Can we pick up this thread there, where we're trying to reproduce an issue that sounds like what you're describing.