Nokogiri: When missing zlib, extconf.rb should emit a better message.

Created on 22 Dec 2014  路  5Comments  路  Source: sparklemotion/nokogiri

I don't know if anyone else is having this issue but I do currently use Chef for system stuff. It use to compile on the previous version but for some reason this version is not installing.

compile.log:

make  all-recursive
make[1]: Entering directory `/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2'
Making all in include
make[2]: Entering directory `/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2/include'
Making all in libxml
make[3]: Entering directory `/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2/include/libxml'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2/include/libxml'
make[3]: Entering directory `/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2/include'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2/include'
make[2]: Leaving directory `/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2/include'
Making all in .
make[2]: Entering directory `/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2'
  CC       SAX.lo
  CC       entities.lo
  CC       encoding.lo
  CC       error.lo
  CC       parserInternals.lo
  CC       parser.lo
  CC       tree.lo
  CC       hash.lo
  CC       list.lo
  CC       xmlIO.lo
  CC       xmlmemory.lo
  CC       uri.lo
  CC       valid.lo
  CC       xlink.lo
  CC       HTMLparser.lo
HTMLparser.c: In function 'htmlParseElementInternal':
HTMLparser.c:4369:5: warning: missing initializer [-Wmissing-field-initializers]
HTMLparser.c:4369:5: warning: (near initialization for 'node_info.begin_pos') [-Wmissing-field-initializers]
  CC       HTMLtree.lo
  CC       debugXML.lo
  CC       xpath.lo
xpath.c: In function 'xmlXPathRegisterFuncNS':
xpath.c:4875:5: warning: ISO C forbids passing argument 4 of 'xmlHashAddEntry2' between function pointer and 'void *' [-pedantic]
./include/libxml/hash.h:128:4: note: expected 'void *' but argument is of type 'xmlXPathFunction'
xpath.c: In function 'xmlXPathFunctionLookupNS':
xpath.c:4956:24: warning: ISO C forbids assignment between function pointer and 'void *' [-pedantic]
xpath.c: In function 'xmlXPathCompOpEval':
xpath.c:13552:41: warning: ISO C forbids assignment between function pointer and 'void *' [-pedantic]
xpath.c:13579:31: warning: ISO C forbids assignment between function pointer and 'void *' [-pedantic]
xpath.c: At top level:
trionan.c:218:1: warning: 'trio_is_negative' defined but not used [-Wunused-function]
  CC       xpointer.lo
  CC       xinclude.lo
  CC       nanohttp.lo
  CC       nanoftp.lo
  CC       catalog.lo
  CC       globals.lo
  CC       threads.lo
threads.c:53:12: warning: redundant redeclaration of 'pthread_once' [-Wredundant-decls]
/usr/include/pthread.h:478:12: note: previous declaration of 'pthread_once' was here
threads.c:56:14: warning: redundant redeclaration of 'pthread_getspecific' [-Wredundant-decls]
/usr/include/pthread.h:1103:14: note: previous declaration of 'pthread_getspecific' was here
threads.c:58:12: warning: redundant redeclaration of 'pthread_setspecific' [-Wredundant-decls]
/usr/include/pthread.h:1106:12: note: previous declaration of 'pthread_setspecific' was here
threads.c:61:12: warning: redundant redeclaration of 'pthread_key_create' [-Wredundant-decls]
/usr/include/pthread.h:1095:12: note: previous declaration of 'pthread_key_create' was here
threads.c:64:12: warning: redundant redeclaration of 'pthread_key_delete' [-Wredundant-decls]
/usr/include/pthread.h:1100:12: note: previous declaration of 'pthread_key_delete' was here
threads.c:67:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:66:12: warning: redundant redeclaration of 'pthread_mutex_init' [-Wredundant-decls]
/usr/include/pthread.h:733:12: note: previous declaration of 'pthread_mutex_init' was here
threads.c:69:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:68:12: warning: redundant redeclaration of 'pthread_mutex_destroy' [-Wredundant-decls]
/usr/include/pthread.h:738:12: note: previous declaration of 'pthread_mutex_destroy' was here
threads.c:71:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:70:12: warning: redundant redeclaration of 'pthread_mutex_lock' [-Wredundant-decls]
/usr/include/pthread.h:746:12: note: previous declaration of 'pthread_mutex_lock' was here
threads.c:73:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:72:12: warning: redundant redeclaration of 'pthread_mutex_unlock' [-Wredundant-decls]
/usr/include/pthread.h:757:12: note: previous declaration of 'pthread_mutex_unlock' was here
threads.c:75:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:74:12: warning: redundant redeclaration of 'pthread_cond_init' [-Wredundant-decls]
/usr/include/pthread.h:952:12: note: previous declaration of 'pthread_cond_init' was here
threads.c:77:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:76:12: warning: redundant redeclaration of 'pthread_cond_destroy' [-Wredundant-decls]
/usr/include/pthread.h:957:12: note: previous declaration of 'pthread_cond_destroy' was here
threads.c:79:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:78:12: warning: redundant redeclaration of 'pthread_cond_wait' [-Wredundant-decls]
/usr/include/pthread.h:973:12: note: previous declaration of 'pthread_cond_wait' was here
threads.c:81:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:80:12: warning: redundant redeclaration of 'pthread_equal' [-Wredundant-decls]
/usr/include/pthread.h:270:12: note: previous declaration of 'pthread_equal' was here
threads.c:83:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:82:18: warning: redundant redeclaration of 'pthread_self' [-Wredundant-decls]
/usr/include/pthread.h:267:18: note: previous declaration of 'pthread_self' was here
threads.c:85:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:84:12: warning: redundant redeclaration of 'pthread_key_create' [-Wredundant-decls]
/usr/include/pthread.h:1095:12: note: previous declaration of 'pthread_key_create' was here
threads.c:87:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:86:12: warning: redundant redeclaration of 'pthread_key_delete' [-Wredundant-decls]
/usr/include/pthread.h:1100:12: note: previous declaration of 'pthread_key_delete' was here
threads.c:89:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
threads.c:88:12: warning: redundant redeclaration of 'pthread_cond_signal' [-Wredundant-decls]
/usr/include/pthread.h:961:12: note: previous declaration of 'pthread_cond_signal' was here
  CC       c14n.lo
  CC       xmlstring.lo
  CC       buf.lo
  CC       xmlregexp.lo
  CC       xmlschemas.lo
  CC       xmlschemastypes.lo
  CC       xmlunicode.lo
  CC       xmlreader.lo
  CC       relaxng.lo
  CC       dict.lo
  CC       SAX2.lo
  CC       xmlwriter.lo
  CC       legacy.lo
  CC       chvalid.lo
  CC       pattern.lo
  CC       xmlsave.lo
  CC       xmlmodule.lo
  CC       schematron.lo
  CC       xzlib.lo
  CCLD     libxml2.la
  CC       testdso.lo
  CCLD     testdso.la
  CC       xmllint.o
  CCLD     xmllint
./.libs/libxml2.a(xmlIO.o): In function `xmlGzfileOpen_real':
xmlIO.c:(.text+0xff4): undefined reference to `gzdopen'
xmlIO.c:(.text+0x10ac): undefined reference to `gzopen64'
./.libs/libxml2.a(xmlIO.o): In function `xmlGzfileOpenW':
xmlIO.c:(.text+0x11c6): undefined reference to `gzdopen'
xmlIO.c:(.text+0x1267): undefined reference to `gzopen64'
./.libs/libxml2.a(xmlIO.o): In function `xmlGzfileRead':
xmlIO.c:(.text+0x12ae): undefined reference to `gzread'
./.libs/libxml2.a(xmlIO.o): In function `xmlGzfileWrite':
xmlIO.c:(.text+0x12f6): undefined reference to `gzwrite'
./.libs/libxml2.a(xmlIO.o): In function `xmlGzfileClose':
xmlIO.c:(.text+0x132d): undefined reference to `gzclose'
./.libs/libxml2.a(xmlIO.o): In function `xmlFreeZMemBuff':
xmlIO.c:(.text+0x13e8): undefined reference to `deflateEnd'
./.libs/libxml2.a(xmlIO.o): In function `xmlCreateZMemBuff':
xmlIO.c:(.text+0x15b7): undefined reference to `deflateInit2_'
xmlIO.c:(.text+0x1642): undefined reference to `crc32'
./.libs/libxml2.a(xmlIO.o): In function `xmlZMemBuffAppend':
xmlIO.c:(.text+0x19b9): undefined reference to `deflate'
xmlIO.c:(.text+0x1a58): undefined reference to `crc32'
./.libs/libxml2.a(xmlIO.o): In function `xmlZMemBuffGetContent':
xmlIO.c:(.text+0x1ae7): undefined reference to `deflate'
./.libs/libxml2.a(xmlIO.o): In function `__xmlParserInputBufferCreateFilename':
xmlIO.c:(.text+0x2f43): undefined reference to `gzdirect'
./.libs/libxml2.a(nanohttp.o): In function `xmlNanoHTTPFreeCtxt':
nanohttp.c:(.text+0x83b): undefined reference to `inflateEnd'
./.libs/libxml2.a(nanohttp.o): In function `xmlNanoHTTPScanAnswer':
nanohttp.c:(.text+0x17df): undefined reference to `inflateInit2_'
./.libs/libxml2.a(nanohttp.o): In function `xmlNanoHTTPRead':
nanohttp.c:(.text+0x21b2): undefined reference to `inflate'
collect2: ld returned 1 exit status
make[2]: *** [xmllint] Error 1
make[2]: Leaving directory `/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2'
make: *** [all] Error 2

mkmf.log:

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I.  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC  conftest.c  -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib  -Wl,-R/opt/chef/embedded/lib      -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby  -lpthread -lrt -ldl -lcrypt -lm   -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I.  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC    -Werror -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */

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

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I.  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC  -g -DXP_UNIX -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c  -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib  -Wl,-R/opt/chef/embedded/lib      -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby  -lpthread -lrt -ldl -lcrypt -lm   -lc "
/tmp/ccYBFLEn.o: In function `main':
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/conftest.c:8: undefined reference to `libiconv_open'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/conftest.c:9: undefined reference to `libiconv'
collect2: ld returned 1 exit status
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 */

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I.  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC  -g -DXP_UNIX -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c  -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib  -Wl,-R/opt/chef/embedded/lib      -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby -liconv -lpthread -lrt -ldl -lcrypt -lm   -lc "
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 */

--------------------
vendorezlib

Most helpful comment

Hi,

Can you make sure that you've got zlib1g-dev installed? Run:

sudo apt-get install zlib1g-dev

This should be checked for at installation time, but because of uninteresting collisions with the windows cross-compile, and the fact that zlib1g-dev is usually installed on Ubuntu machines, we reverted that change (see 05d083c9cae6200fec297fb188573deef500fcb2).

Let me know if this helps, and we'll prioritize the zlib check for the next point release.

All 5 comments

Hi,

Can you make sure that you've got zlib1g-dev installed? Run:

sudo apt-get install zlib1g-dev

This should be checked for at installation time, but because of uninteresting collisions with the windows cross-compile, and the fact that zlib1g-dev is usually installed on Ubuntu machines, we reverted that change (see 05d083c9cae6200fec297fb188573deef500fcb2).

Let me know if this helps, and we'll prioritize the zlib check for the next point release.

Confirmed... zlib1g-dev needed to be installed before it compiled correctly.

Great, thanks for the update. We'll make sure that we print a more useful error message in the next release.

See related commit e7c47565323ddcc08355fa1aa62432a9881ca706 and related issue #1188

See commit 13edff71e0bf004dab1a192da1c7ec31e51f2542 which addresses this and will be in 1.6.6 (soon).

Was this page helpful?
0 / 5 - 0 ratings