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

libxml check fails b/c libiconv is not getting included in list of linked libs #1199

Closed mcmire closed 9 years ago

mcmire commented 9 years ago

Quick facts:

I am getting this error when attempting to install Nokogiri:

libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.

Here is the mkmf.log output:

"clang -o conftest -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/Users/elliot/.rbenv/versions/2.1.4/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/elliot/.rbenv/versions/2.1.4/lib -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib  -fstack-protector     -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 */

"clang -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/Users/elliot/.rbenv/versions/2.1.4/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -Wno-error=shorten-64-to-32  -pipe    -Werror -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

"clang -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/Users/elliot/.rbenv/versions/2.1.4/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -Wno-error=shorten-64-to-32  -pipe  -Wno-error=unused-command-line-argument-hard-error-in-future   -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

"clang -o conftest -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/usr/local/opt/libiconv//include -I/Users/elliot/.rbenv/versions/2.1.4/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/elliot/.rbenv/versions/2.1.4/lib -L/usr/local/opt/libiconv//lib -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib  -fstack-protector     -lruby-static -framework CoreFoundation  -lpthread -ldl -lobjc  "
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _main in conftest-defd6e.o
  "_libiconv_open", referenced from:
      _main in conftest-defd6e.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 */

"clang -o conftest -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/usr/local/opt/libiconv//include -I/Users/elliot/.rbenv/versions/2.1.4/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/elliot/.rbenv/versions/2.1.4/lib -L/usr/local/opt/libiconv//lib -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib  -fstack-protector     -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

"clang -o conftest -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/Users/elliot/.rbenv/versions/2.1.4/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -Wno-error=shorten-64-to-32  -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib  -fstack-protector     -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

"clang -o conftest -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/include -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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\"  -O3 -Wno-error=shorten-64-to-32  -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib  -fstack-protector    /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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 */

"clang -o conftest -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/include -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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\"  -O3 -Wno-error=shorten-64-to-32  -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib  -fstack-protector    /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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

"clang -o conftest -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/include -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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\"  -O3 -Wno-error=shorten-64-to-32  -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib  -fstack-protector    /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation -lxml2 /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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 */

"clang -o conftest -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/include -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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\"  -O3 -Wno-error=shorten-64-to-32  -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib  -fstack-protector    /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation -lxml2 /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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

"clang -o conftest -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/include -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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\"  -O3 -Wno-error=shorten-64-to-32  -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib  -fstack-protector    /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation -llibxml2 /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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 */

"clang -o conftest -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0/ruby/backward -I/Users/elliot/.rbenv/versions/2.1.4/include/ruby-2.1.0 -I. -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/include -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/include/libxml2 -I/Users/elliot/.rbenv/versions/2.1.4/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -DNOKOGIRI_LIBXML2_PATH\=\"/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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\"  -O3 -Wno-error=shorten-64-to-32  -pipe  -DNOKOGIRI_USE_PACKAGED_LIBRARIES conftest.c  -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib -L/Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib -L. -L/Users/elliot/.rbenv/versions/2.1.4/lib  -fstack-protector    /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a -llzma -lruby-static -framework CoreFoundation -llibxml2 /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libexslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2/lib/libxml2.a /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28/lib/libxslt.a -lm -liconv -lpthread -lz /Users/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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/elliot/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.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 */

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

So the error in this case appears to be misleading.

As you can see, when it checks whether libiconv is installed, the first check (without the -liconv flag) fails, but then the second one succeeds.

When have_func is then called to determine whether libxml is fully available, that check fails, as libiconv is being referenced inside of libxml. However doing so does not work, as the -liconv flag is not being passed to clang in this case.

Ideally, I believe have_iconv? should add libiconv to the list of libraries somehow so that subsequent commands properly include it.

mcmire commented 9 years ago

Okay, I figured it out. Ruby 2.1.4 was already installed, but where apple-gcc42 had been brew linked. I unlinked it prior to installing Nokogiri. After keeping it unlinked, then completely removing Ruby 2.1.4 and re-installing it using Clang instead, I didn't have any problems re-installing Nokogiri.

flavorjones commented 9 years ago

Is there anything we can learn from this, that we should add to the installation tutorial?