I'm tyring to install cohttp with opam and I get an error regarding modular-implicits
Here is the stack trace for camlp4
chris#chris-870Z5E-880Z5E-680Z5E:~$ opam install camlp4
The following actions will be performed:
∗ install camlp4 4.02.0-1modular-implicits
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[camlp4] Archive in cache
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of camlp4 failed at "make all".
Processing 1/1: [camlp4: rm]
#=== ERROR while installing camlp4.4.02.0-1modular-implicits ==================#
# opam-version 1.2.2
# os linux
# command make all
# path /home/chris/.opam/core/build/camlp4.4.02.0-1modular-implicits
# compiler system (4.02.3)
# exit-code 2
# env-file /home/chris/.opam/core/build/camlp4.4.02.0-1modular-implicits/camlp4-12430-e7966f.env
# stdout-file /home/chris/.opam/core/build/camlp4.4.02.0-1modular-implicits/camlp4-12430-e7966f.out
# stderr-file /home/chris/.opam/core/build/camlp4.4.02.0-1modular-implicits/camlp4-12430-e7966f.err
### stdout ###
# [...]
# cp /usr/lib/ocaml/compiler-libs/parsetree.cmi camlp4/import/parsetree.cmi
# cp /usr/lib/ocaml/compiler-libs/outcometree.cmi camlp4/import/outcometree.cmi
# cp /usr/lib/ocaml/compiler-libs/oprint.cmi camlp4/import/oprint.cmi
# cp /usr/lib/ocaml/compiler-libs/toploop.cmi camlp4/import/toploop.cmi
# /usr/bin/ocamlc.opt -c -g -w Z -I camlp4/import -warn-error A-3 -I camlp4/config -I camlp4 -o camlp4/config/Camlp4_config.cmi camlp4/config/Camlp4_config.mli
# /usr/bin/ocamlc.opt -c -g -w a -I camlp4/import -warn-error A-3 -I camlp4/config -I camlp4/boot -o camlp4/boot/Camlp4.cmo camlp4/boot/Camlp4.ml
# + /usr/bin/ocamlc.opt -c -g -w a -I camlp4/import -warn-error A-3 -I camlp4/config -I camlp4/boot -o camlp4/boot/Camlp4.cmo camlp4/boot/Camlp4.ml
# File "camlp4/boot/Camlp4.ml", line 14607, characters 36-58:
# Error: Unbound type constructor Asttypes.implicit_flag
# Command exited with code 2.
### stderr ###
# + echo camlp4/Camlp4.cmo camlp4/Camlp4Top.cmo camlp4/camlp4prof.byte camlp4/mkcamlp4.byte camlp4/camlp4.byte camlp4/camlp4fulllib.cma camlp4/camlp4boot.byte camlp4/camlp4boot.cma camlp4/camlp4r.byte camlp4/camlp4r.cma camlp4/camlp4rf.byte camlp4/camlp4rf.cma camlp4/camlp4o.byte camlp4/camlp4o.cma camlp4/camlp4of.byte camlp4/camlp4of.cma camlp4/camlp4oof.byte camlp4/camlp4oof.cma camlp4/camlp4orf.byte camlp4/camlp4orf.cma camlp4/Camlp4Parsers/Camlp4AstLoader.cmo camlp4/Camlp4Parsers/Camlp4DebugParser.cmo camlp4/Camlp4Parsers/Camlp4GrammarParser.cmo camlp4/Camlp4Parsers/Camlp4ListComprehension.cmo camlp4/Camlp4Parsers/Camlp4MacroParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlOriginalQuotationExpander.cmo camlp4/Camlp4Parsers/Camlp4OCamlParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlParserParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlReloadedParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlRevisedParserParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlRevisedQuotationExpander.cmo camlp4/Camlp4Parsers/Camlp4QuotationCommon.cmo camlp4/Camlp4Parsers/Camlp4QuotationExpander.cmo camlp4/Camlp4Printers/Camlp4AstDumper.cmo camlp4/Camlp4Printers/Camlp4AutoPrinter.cmo camlp4/Camlp4Printers/Camlp4NullDumper.cmo camlp4/Camlp4Printers/Camlp4OCamlAstDumper.cmo camlp4/Camlp4Printers/Camlp4OCamlPrinter.cmo camlp4/Camlp4Printers/Camlp4OCamlRevisedPrinter.cmo camlp4/Camlp4Filters/Camlp4AstLifter.cmo camlp4/Camlp4Filters/Camlp4ExceptionTracer.cmo camlp4/Camlp4Filters/Camlp4FoldGenerator.cmo camlp4/Camlp4Filters/Camlp4LocationStripper.cmo camlp4/Camlp4Filters/Camlp4MapGenerator.cmo camlp4/Camlp4Filters/Camlp4MetaGenerator.cmo camlp4/Camlp4Filters/Camlp4Profiler.cmo camlp4/Camlp4Filters/Camlp4TrashRemover.cmo
# make: *** [byte] Error 10
=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions failed
∗ install camlp4 4.02.0-1modular-implicits
No changes have been performed
This is happening on Ubuntu 14.04, how can I get around this strange error that is happening?
EDIT: Relevant info
chris#chris-870Z5E-880Z5E-680Z5E:~$ ocaml -version
The OCaml toplevel, version 4.02.3
chris#chris-870Z5E-880Z5E-680Z5E:~$ opam --version
1.2.2
I would propose to have your ocaml compiler installed by opam (
opam switch 4.02.3
). It looks your ocaml is located in your system.
Apparently, this comes to an older revision of opam database : opam update may solve it.
Related
I am trying to install graphics using opam install graphics, but I get the following error
message:
$ opam install graphics
The following actions will be performed:
∗ install graphics 5.1.1
↻ recompile ocamlfind 1.9.1 [uses graphics]
↻ recompile base-bytes base [uses ocamlfind]
↻ recompile ounit2 2.2.4 [uses base-bytes]
↻ recompile ANSITerminal 0.8.2 [uses base-bytes]
===== ∗ 1 ↻ 4 =====
Do you want to continue? [Y/n] y
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
[ANSITerminal.0.8.2] found in cache
[graphics.5.1.1] found in cache
[ocamlfind.1.9.1] found in cache
[ounit2.2.2.4] found in cache
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
[ERROR] The compilation of graphics failed at "/Users/traviszhang/.opam/opam-init/hooks/sandbox.sh build dune
build -p graphics -j 3 #install".
#=== ERROR while compiling graphics.5.1.1 =====================================#
# context 2.0.8 | macos/x86_64 | ocaml-base-compiler.4.11.1 | https://opam.ocaml.org#7e6a6dcc
# path ~/.opam/cs3110-2021sp/.opam-switch/build/graphics.5.1.1
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p graphics -j 3 #install
# exit-code 1
# env-file ~/.opam/log/graphics-9364-8b8a2d.env
# output-file ~/.opam/log/graphics-9364-8b8a2d.out
### output ###
# [...]
# In file included from src/unix/subwindow.c:16:
# src/unix/libgraph.h:17:10: fatal error: 'X11/Xlib.h' file not found
# #include <X11/Xlib.h>
# ^~~~~~~~~~~~
# 1 error generated.
# cc src/text.o (exit 1)
# (cd _build/default/src && /usr/bin/cc -O2 -fno-strict-aliasing -fwrapv -D_FILE_OFFSET_BITS=64 -D_REENTRANT -g -I /Users/traviszhang/.opam/cs3110-2021sp/lib/ocaml -o text.o -c text.c)
# In file included from src/unix/text.c:16:
# src/unix/libgraph.h:17:10: fatal error: 'X11/Xlib.h' file not found
# #include <X11/Xlib.h>
# ^~~~~~~~~~~~
# 1 error generated.
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
┌─ The following actions failed
│ λ build graphics 5.1.1
└─
╶─ No changes have been performed
I have tried the following solutions, but none of them seem to work:
https://github.com/ocaml/graphics/issues/16 (running export LIBRARY_PATH=/opt/X11/lib)
Also adding export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig" to my .zshrc file (this is mentioned in the same thread as 1.
When I run pkg-config --list-all | grep x11 the x11 libraries pop up, but for some reason spam can't seem to find it when trying to install graphics. Any suggestions would be helpful!
Here is my current computer configuration:
macOS BigSur Version 11.2.1
Ocaml Compiler 4.11.1
Update:
This issue has been brought up in the following thread (https://github.com/ocaml/graphics/pull/36#issuecomment-846827032), and will be updated in the new graphics release.
The easiest path to get the graphics package working on macOS is to install and properly setup homebrew, after that you can just do
opam depext --install graphics
and it should install the system dependencies via homebrew (xquartz and xorgproto) and install the OCaml library.
I have an error installing utop in fedora 25 when I run "opam install utop". The first time I ran the command some packages were installed, but not all. I ran the same command again and got the error message below. Any suggestion?
The following actions will be performed:
- install lambda-term 1.12.0 [required by utop]
- install utop 2.0.2
===== 2 to install =====
Do you want to continue ? [Y/n] y
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[lambda-term] Archive in cache
[utop] Archive in cache
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of lambda-term failed at "jbuilder build -p lambda-term
-j 4".
#=== ERROR while installing lambda-term.1.12.0 ================================#
# opam-version 1.2.2
# os linux
# command jbuilder build -p lambda-term -j 4
# path /home/se/.opam/4.05.0/build/lambda-term.1.12.0
# compiler 4.05.0
# exit-code 1
# env-file /home/se/.opam/4.05.0/build/lambda-term.1.12.0/lambda-term-1999-58c514.env
# stdout-file /home/se/.opam/4.05.0/build/lambda-term.1.12.0/lambda-term-1999-58c514.out
# stderr-file /home/se/.opam/4.05.0/build/lambda-term.1.12.0/lambda-term-1999-58c514.err
### stderr ###
# Warning 3: deprecated: module Lwt_sequence
# [...]
# File "src/lTerm_widget_callbacks.ml", line 48, characters 2-21:
# Warning 3: deprecated: module Lwt_sequence
# This module is an implementation detail of Lwt. See
# https://github.com/ocsigen/lwt/issues/361
# ocamlc src/lTerm_unix.{cmo,cmt} (exit 2)
# (cd _build/default && /home/se/.opam/4.05.0/bin/ocamlc.opt -w -40 -safe-string -g -bin-annot -I /home/se/.opam/4.05.0/lib/bytes -I /home/se/.opam/4.05.0/lib/camomile -I /home/se/.opam/4.05.0/lib/lwt -I /home/se/.opam/4.05.0/lib/lwt_react -I /home/se/.opam/4.05.0/lib/ocaml -I /home/se/.opam/4.05.0/lib/ocaml/threads -I /home/se/.opam/4.05.0/lib/react -I /home/se/.opam/4.05.0/lib/result -I /home/se/.opam/4.05.0/lib/zed -no-alias-deps -I src -o src/lTerm_unix.cmo -c -impl src/lTerm_unix.ml)
# File "src/lTerm_unix.ml", line 342, characters 32-51:
# Error: This expression has type bytes but an expression was expected of type
# string
=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions were aborted
- install utop 2.0.2
The following actions failed
- install lambda-term 1.12.0
No changes have been performed
Problem fixed:
opam update
opam upgrade
and possibly
opam reinstall [whatever-was-not-installed-correctly]
I currently have Fedora 26 installed, and I have installed the following packages:
sudo dnf install opam ocaml gcc gcc-c++ m4 make ocamldoc sqlite-devel libcurl-devel fuse-devel zlib-devel ocaml-camlp4-devel redhat-rpm-config
This is the error I currently get trying to install utop:
#=== ERROR while installing lwt.2.7.1 =========================================#
# opam-version 1.2.2
# os linux
# command make build
# path /home/z/.opam/system/build/lwt.2.7.1
# compiler system (4.02.3)
# exit-code 2
# env-file /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.env
# stdout-file /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.out
# stderr-file /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.err
### stdout ###
# ./setup.exe -build
# ocamlfind ocamlopt -package unix -package ocamlbuild -linkpkg -package cppo_ocamlbuild myocamlbuild.ml /usr/lib64/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# + ocamlfind ocamlopt -package unix -package ocamlbuild -linkpkg -package cppo_ocamlbuild myocamlbuild.ml /usr/lib64/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# File "myocamlbuild.ml", line 1:
# Error: Files /home/z/.opam/system/lib/cppo_ocamlbuild/ocamlbuild_cppo.cmxa
# and /usr/lib64/ocaml/ocamlbuild/ocamlbuildlib.cmxa
# make inconsistent assumptions over implementation Ocamlbuild_plugin
# Command exited with code 2.
# Makefile:33: recipe for target 'build' failed
### stderr ###
# W: Cannot find source file matching module 'Lwt_unix' in library lwt-unix.
# W: Use InterfacePatterns or ImplementationPatterns to define this file with feature "source_patterns".
# W: Cannot find source file matching module 'Lwt_unix' in library lwt-unix.
# W: Use InterfacePatterns or ImplementationPatterns to define this file with feature "source_patterns".
# E: Failure("Command ''/usr/bin/ocamlbuild' src/core/lwt.cma src/core/lwt.cmxa src/core/lwt.a src/core/lwt.cmxs src/logger/lwt-log.cma src/logger/lwt-log.cmxa src/logg$r/lwt-log.a src/logger/lwt-log.cmxs src/unix/liblwt-unix_stubs.a src/unix/dlllwt-unix_stubs.so src/unix/lwt-unix.cma src/unix/lwt-unix.cmxa src/unix/lwt-unix.a src/unix$lwt-unix.cmxs src/simple_top/lwt-simple-top.cma src/simple_top/lwt-simple-top.cmxa src/simple_top/lwt-simple-top.a src/simple_top/lwt-simple-top.cmxs src/react/lwt-reac$.cma src/react/lwt-react.cmxa src/react/lwt-react.a src/react/lwt-react.cmxs src/preemptive/lwt-preemptive.cma src/preemptive/lwt-preemptive.cmxa src/preemptive/lwt-pre$mptive.a src/preemptive/lwt-preemptive.cmxs src/ppx/ppx.cma src/ppx/ppx.cmxa src/ppx/ppx.a src/ppx/ppx.cmxs src/ppx/ppx_lwt_ex.native doc/examples/unix/logging.native d$c/examples/unix/relay.native doc/examples/unix/parallelize.native -use-ocamlfind -plugin-tags 'package(cppo_ocamlbuild)' -tag debug' terminated with error code 10")
# make: *** [build] Error 1
What should I do?
Thank you!
Opam's "system compiler", that is used by default on opam init, is an hybrid setting in which the packages are installed in the local opam sandbox, but the compiler from the system (/usr) is used. See the opam switch command to use a sandbox with a compiler compiled by opam instead, or to switch back.
Your example shows that you are using a system compiler, as provided by dnf install ocaml ; opam is consequently supposed to use e.g. /usr/bin/ocamlopt, but installed software and libs from ~/.opam/system/{bin,lib}.
What is supposed to happen is that lwt depends on ocamlbuild and ocamlfind, which opam installs first; then PATH is set so that ~/.opam/system/bin/ is first and these installed binaries are always chosen. It's where something must be going wrong, because the end of the log shows that /usr/bin/ocamlbuild was called.
It's difficult to know what without more details, and I failed to reproduce on a Fedora 25 container. But you could:
check if ocamlbuild and ocamlfind were properly installed by opam, and the presence of ~/.opam/system/bin/ocaml{find,build}
check if there is any global or environment configuration of ocamlfind that could interfere (which ocamlfind; ocamlfind printconf; opam config exec -- ocamlfind printconf).
check the linked environment file: /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.env to see if PATH is properly defined
run with -v to see all commands issued by opam
Of course, as mentionned in the comments above, using a standard (i.e. non-system) switch, which includes its own OCaml compiler, would work around the issue. It takes a tad longer to compile though.
I'm having problems very similar to this question.
I have a MacBook Pro on macOS Sierra. I've installed ocaml and opam via brew. (brew install ocaml, brew install opam) This installed ocaml 4.03.0, and it appears to work fine on its own.
I tried to install oasis (opam install oasis), but the installation failed due to a failure in installing ocamlfind:
➜ ~ opam install ocamlfind
The following actions will be performed:
∗ install ocamlfind 1.6.2
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 🐫
[ocamlfind] Archive in cache
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 🐫
[ERROR] The compilation of ocamlfind failed at "./configure -bindir /Users/drautb/.opam/system/bin -sitelib /Users/drautb/.opam/system/lib -mandir /Users/drautb/.opam/system/man -config /Users/drautb/.opam/system/lib/findlib.conf -no-custom -no-topfind".
Processing 1/1: [ocamlfind: rm]
#=== ERROR while installing ocamlfind.1.6.2 ===================================#
# opam-version 1.2.2
# os darwin
# command ./configure -bindir /Users/drautb/.opam/system/bin -sitelib /Users/drautb/.opam/system/lib -mandir /Users/drautb/.opam/system/man -config /Users/drautb/.opam/system/lib/findlib.conf -no-custom -no-topfind
# path /Users/drautb/.opam/system/build/ocamlfind.1.6.2
# compiler system (4.03.0)
# exit-code 1
# env-file /Users/drautb/.opam/system/build/ocamlfind.1.6.2/ocamlfind-41584-6d07ae.env
# stdout-file /Users/drautb/.opam/system/build/ocamlfind.1.6.2/ocamlfind-41584-6d07ae.out
# stderr-file /Users/drautb/.opam/system/build/ocamlfind.1.6.2/ocamlfind-41584-6d07ae.err
### stdout ###
# [...]
# Configuration for str written to site-lib-src/str/META
# Configuration for threads written to site-lib-src/threads/META
# Configuration for unix written to site-lib-src/unix/META
# Configuration for stdlib written to site-lib-src/stdlib/META
# Configuration for bigarray written to site-lib-src/bigarray/META
# Configuration for ocamldoc written to site-lib-src/ocamldoc/META
# Configuration for camlp4 written to site-lib-src/camlp4/META
# Configuration for compiler-libs written to site-lib-src/compiler-libs/META
# Configuration for bytes written to site-lib-src/bytes/META
# Detecting compiler arguments: FAILED (see the file ocargs.log for details)
### stderr ###
# ./configure: line 553: cd: src: No such file or directory
=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 🐫
The following actions failed
∗ install ocamlfind 1.6.2
No changes have been performed
I thought it might be related to ocaml 4.03.0, so I tried switching to ocaml 4.02.1. (opam switch 4.02.1) This fails also:
➜ ~ opam switch 4.02.1
=-=- Installing compiler 4.02.1 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 🐫
[default.comp] http://caml.inria.fr/pub/distrib/ocaml-4.02/ocaml-4.02.1.tar.gz downloaded
Now compiling OCaml. This may take a while, please bear with us...
[ERROR] Compiler build failed at "./configure -prefix /Users/drautb/.opam/4.02.1 -with-debug-runtime":
# opam-version 1.2.2
# os darwin
# command ./configure -prefix /Users/drautb/.opam/4.02.1 -with-debug-runtime
# path /Users/drautb/.opam/4.02.1/build/ocaml
# exit-code 2
# env-file /Users/drautb/.opam/log/log-42620-d2c37b.env
# stdout-file /Users/drautb/.opam/log/log-42620-d2c37b.out
# stderr-file /Users/drautb/.opam/log/log-42620-d2c37b.err
### stdout ###
# [ERROR!]Cannot guess host type. You must specify one with the -host option.
### stderr ###
# ./configure: line 190: cd: config/auto-aux: No such file or directory
# ./configure: line 222: ../gnu/config.guess: No such file or directory
I've tried reinstalling XCode, I've tried reinstalling ocaml and opam via homebrew with the --build-from-source option, (including rm -rf ~/.opam) and the errors persist.
Has anyone else had issues like this?
I have had no problem installing any OCaml packages via opam in the past. However I am unable to install Cryptokit.
I am using the command:
$ opam install cryptokit
and I recieve the following error messages (I am unsure what they mean and cannot find any documentation on the errors):
[ERROR] The compilation of cryptokit.1.9 failed.
Removing cryptokit.1.9.
ocamlfind remove cryptokit
===== ERROR while installing cryptokit.1.9 =====
# opam-version 1.1.0
# os linux
# command make
# path /home/alpha/.opam/system/build/cryptokit.1.9
# compiler system (4.01.0)
# exit-code 2
# env-file /home/alpha/.opam/system/build/cryptokit.1.9/cryptokit-9111-ffb3fd.env
# stdout-file /home/alpha/.opam/system/build/cryptokit.1.9/cryptokit-9111-ffb3fd.out
# stderr-file /home/alpha/.opam/system/build/cryptokit.1.9/cryptokit-9111-ffb3fd.err
### stdout ###
# ...[truncated]
# mv stubs-md5.o src/stubs-md5.o
# ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-misc.c
# mv stubs-misc.o src/stubs-misc.o
# ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-rng.c
# mv stubs-rng.o src/stubs-rng.o
# ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-zlib.c
# + ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-zlib.c
# src/stubs-zlib.c:19:18: fatal error: zlib.h: No such file or directory
# compilation terminated.
# Command exited with code 2.
### stderr ###
# E: Failure("Command ''/usr/bin/ocamlbuild' src/libcryptokit_stubs.a src/dllcryptokit_stubs.so src/cryptokit.cma src/cryptokit.cmxa src/cryptokit.a src/cryptokit.cmxs -tag debug -classic-display' terminated with error code 10")
# make: *** [build] Error 1
'opam install cryptokit' failed.
# src/stubs-zlib.c:19:18: fatal error: zlib.h: No such file or directory
OPAM does not install non OCaml external libraries automatically. It is out of the scope of this tool. Cryptokit depends on several external libraries and zlib is one of them.
You must install zlib and its header files (and those of other libraries) by your distribution's package manager or by hand. In many distributions it should be provided by the name of zlib-dev or something similar.
In Ubuntu:
sudo apt-get install zlib1g zlib1g-dev
[This should be a comment for the response above.]