New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builds failing with "zlib is missing; necessary for building libxml2" #72

Closed
jessereynolds opened this Issue Feb 10, 2015 · 25 comments

Comments

Projects
None yet
@jessereynolds
Copy link
Member

jessereynolds commented Feb 10, 2015

USER DATA SCRIPT STARTING AT Tue Feb 10 03:26:33 UTC 2015
UPDATING omnibus-flapjack
From https://github.com/flapjack/omnibus-flapjack
   b8fe522..dd4e2fc  master     -> origin/master
 * [new branch]      readme-update -> origin/readme-update
Updating b8fe522..dd4e2fc
Fast-forward

...snip...

Fetching git://github.com/opscode/omnibus-software.git
Fetching git://github.com/Hobbsee/omnibus.git
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake 10.4.2
Installing mime-types 1.25.1
Installing mini_portile 0.6.2

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb 
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** 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=/usr/bin/ruby1.9.1
    --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


Gem files will remain installed in /tmp/bundler20150210-1666-1wjwab1/nokogiri-1.6.6.2/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /tmp/bundler20150210-1666-1wjwab1/nokogiri-1.6.6.2/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.
ubuntu@ip-10-45-3-184:~/omnibus-flapjack$ find /usr -name *zlib*
/usr/src/linux-headers-3.13.0-32-generic/include/config/ubifs/fs/zlib.h
/usr/src/linux-headers-3.13.0-32-generic/include/config/crypto/zlib.h
/usr/src/linux-headers-3.13.0-32-generic/include/config/zlib
/usr/src/linux-headers-3.13.0-32-generic/include/config/squashfs/zlib.h
/usr/src/linux-headers-3.13.0-32-generic/include/config/jffs2/zlib.h
/usr/src/linux-headers-3.13.0-32-generic/include/linux/zlib.h
/usr/src/linux-headers-3.13.0-32/lib/zlib_inflate
/usr/src/linux-headers-3.13.0-32/lib/zlib_deflate
/usr/src/linux-headers-3.13.0-32/include/linux/zlib.h
/usr/share/doc/zlib1g
/usr/share/ri/1.9.1/system/Zlib/zlib_version-c.ri
/usr/lib/ruby/1.9.1/x86_64-linux/zlib.so
/usr/lib/python3.4/encodings/zlib_codec.py
/usr/lib/python3.4/encodings/__pycache__/zlib_codec.cpython-34.pyc
/usr/lib/rsyslog/lmzlibw.so
/usr/lib/python2.7/encodings/zlib_codec.py
/usr/lib/python2.7/encodings/zlib_codec.pyc

@jessereynolds jessereynolds added the Bug label Feb 10, 2015

@jessereynolds

This comment has been minimized.

Copy link
Member Author

jessereynolds commented Feb 10, 2015

Fixed this by including zlib1g-dev package in the ami we're using

@asbjornenge

This comment has been minimized.

Copy link

asbjornenge commented Apr 8, 2015

@jessereynolds love it when people leave the solution for others to find. Thank you 👍

@jessereynolds

This comment has been minimized.

Copy link
Member Author

jessereynolds commented Apr 8, 2015

@asbjornenge :-) ... which project did you strike this one in?

@asbjornenge

This comment has been minimized.

Copy link

asbjornenge commented Apr 9, 2015

@jessereynolds https://github.com/Thibaut/devdocs actually, trying to build locally. Got it working eventually 👍 😄

@guaka

This comment has been minimized.

Copy link

guaka commented Jul 1, 2015

What's an "ami" and how do I include zlib1g-dev in it? :)

@SarahRiley

This comment has been minimized.

Copy link
Contributor

SarahRiley commented Jul 6, 2015

@guaka, the AMI is what we use to build Flapjack cleanly and reproducibly on Amazon Web Services. You don't need an AMI to build on your own machine - just install zlib1g-dev (or the equivalent package for your operating system), and you won't see this error.

@gessgallardo

This comment has been minimized.

Copy link

gessgallardo commented Oct 21, 2015

👍 @SarahKowalik thx!

@r0zar

This comment has been minimized.

Copy link

r0zar commented Nov 19, 2015

for ubuntu:

sudo apt-get install zlib1g-dev

worked for me

@JanisVepris

This comment has been minimized.

Copy link

JanisVepris commented Nov 26, 2015

Solution by @Heshuge worked for me on Ubuntu 15.10.

@rchennuri

This comment has been minimized.

Copy link

rchennuri commented Dec 4, 2015

Thank you @Heshuge , solution is worked for me on Ubuntu 14.4

@liuzxc

This comment has been minimized.

Copy link

liuzxc commented Dec 22, 2015

thanks @Heshuge , it works for me!

@hastebrot

This comment has been minimized.

Copy link

hastebrot commented Jan 21, 2016

Thanks. Needed this for Nokogiri on Ubuntu 14.04.

@thindiyeh

This comment has been minimized.

Copy link

thindiyeh commented Jan 26, 2016

for Redhat or Centos use #sudo yum install zlib-devel -y

@samnissen

This comment has been minimized.

Copy link

samnissen commented Feb 29, 2016

@jiajielu

This comment has been minimized.

Copy link

jiajielu commented Mar 25, 2016

@Heshuge worked for me on Ubuntu 12.04

@markpahulje

This comment has been minimized.

Copy link

markpahulje commented May 14, 2016

RE: Fixed this by including zlib1g-dev package in the ami we're using jessereynolds

Installing zlib1g-dev, fixed issued when trying to install Nokogiri on Debian 8.4

Installed nokogiri RC2 using 'sudo gem install nokogiri -v 1.6.8.rc2' which originally complained about

zlib is missing; necessary for building libxml2

, which made no sense because libxml2 was present.

Many Thanks, jessereynolds!!!! Hope this helps next person ;)

@labcerouno

This comment has been minimized.

Copy link

labcerouno commented May 18, 2016

today, from the official github pages page: tells me to install jekyll; jekyll asks me for nokogiri 1.6.7.2; nokogir asks me for zlib. i find this page and install zlib1g-dev. i guess things are ok now. i guess this version is kinda outdated, right?

@yidingalan

This comment has been minimized.

Copy link

yidingalan commented Oct 27, 2016

works for me on ubuntu 16.04

@planetrobbie

This comment has been minimized.

Copy link

planetrobbie commented Dec 19, 2016

works for me too on 16.04, hurrah and thanks.

@behroozam

This comment has been minimized.

Copy link

behroozam commented Mar 24, 2017

zlib is missing; necessary for building libxml2
needed for nokogiri or jemoji package .
solution: sudo apt-get install zlib1g-dev

allyusd added a commit to allyusd/docker-ubuntu-jekyll that referenced this issue Mar 25, 2017

fix: missing zlib1g-dev package
ref: Builds failing with "zlib is missing; necessary for building libxml2" flapjack/omnibus-flapjack#72
@Alfredo-Moreira

This comment has been minimized.

Copy link

Alfredo-Moreira commented Mar 30, 2017

How do you solve this for a OSX system? All i unfortunately see is Linux fixes :(

@ingokeck

This comment has been minimized.

Copy link

ingokeck commented Jun 19, 2017

To install nokogiri on MacOS X is a nightmare. Some people have no issues on new out-of-the-box systems. All others try to find the one version that works. I finally got it working one day by manually setting the paths to the libraries it claimed it was not finding.

@jamespfinn

This comment has been minimized.

Copy link

jamespfinn commented Aug 30, 2017

For anyone who landed here because they ran into this issue on the Amazon Linux AMI, installint the zlib-devel package solved the problem for me.

@jbananas

This comment has been minimized.

Copy link

jbananas commented Oct 13, 2017

Ran into this on WSL while installing a Jekyll theme gem that depended on nokogiri. sudo apt-get install zlib1g-dev fixed it right up

@penut85420

This comment has been minimized.

Copy link

penut85420 commented Dec 8, 2018

thanks @r0zar, work for me on ubuntu 18.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment