You need to install -dev package for zlib1g - it is named zlib1g-dev:
sudo apt-get install zlib1g-dev
and it will install zlib.pc file for pkg-config along with zlib.h header.
c - Error while configuring libpng: "zlib not installed" - Stack Overflow
anaconda - zlib not found when installing ShortRead - Stack Overflow
r - configure: error: zlib development files not found - Stack Overflow
software installation - configure: error: "could not find the zlib libaray." in Bash - Unix & Linux Stack Exchange
I believe that the problem lies with the configuration of autotools in r-base>3.4.1b2, but I'm not competent to fix that. The plus side is that, although configure can't find zlib during the pre-installation, zlib is actually present in any Conda environment with r-base and can be linked during the actual installation. I filed an issue at Conda-Forge, but until and unless the issue is resolved in r-base, I made a fork of ShortRead which skips the check. It works for me with r-base=3.5.1.
tldr: remotes::install_github("brendanf/ShortRead")
I had the same error for the past week. I tried every thing that was mentioned regarding the zlib library on the internet. I couldn't fix it properly. I have the zlib installed as when I run: pkg-config zlib --libs; I get as output: -lz
$ pkg-config zlib --libs
-lz
I am running conda (v4.5.4). R version 3.4.3 and I have R as a conda environment. I think the problem is with multiple zlib libraries (ubuntu base and conda).
Somehow I just made this to work. What I did was to install R in ubuntu shell (i.e. outside conda) and install the ShortRead library there. There was no conflict/error with the zlib. After that I added the core Rlib directories to libPaths in conda.
$.libPaths(c('/home/aridaman/.conda/envs/rstudio/lib/R/library','/usr/local/lib/R/site-library/','/usr/lib/R/site-library','/usr/lib/R/site-library'))
This is not ideal but somehow worked for me. I would be glad to have a better conda based solution.
You are missing zlib.h header file, on Linux install it via:
sudo apt-get install libz-dev
As a matter of fact, the module presents as zlib1g-dev in the apt repo, so this is the up-to-date call (Feb 2019):
sudo apt install zlib1g-dev
On Fedora: sudo dnf install zlib-devel (in older versions: sudo dnf install libz-devel).
This will provide the development support files for a library implementing the deflate compression method found in gzip and PKZIP.
If you've already zlib library, make sure you're compiling your code sources with -lz. See: How to fix undefined references to inflate/deflate functions?.
You have installed the library in a non-standard location ($HOME/zlib/). That means the compiler will not know where your header files are and you need to tell the compiler that.
You can add a path to the list that the compiler uses to search for header files by using the -I (upper-case i) option.
Also note that the LD_LIBRARY_PATH is for the run-time linker and loader, and is searched for dynamic libraries when attempting to run an application. To add a path for the build-time linker use the -L option.
All-together the command line should look like
$ c++ -I$HOME/zlib/include some_file.cpp -L$HOME/zlib/lib -lz
The configure option --prefix is used to tell the configure script (and the resulting makefiles) where to put the programs which will be installed. It does not tell where to get header-files and libraries.
To tell the configure script where to get files, you may have to adjust these variables:
- CPPFLAGS (for directories containing header-files)
- LDFLAGS (for directories containing libraries)
- LIBS (for the actual library names)
You can pass those values on the command-line to configure, e.g.,
myheader=$HOME/junk/include
mylibs=$HOME/junk/lib
./configure CPPFLAGS="-I$myheader" LDFLAGS="-L$mylibs"
Following up on the clarification (which should have been incorporated into the question)
when I try to build the files in dropbear by running
#!/bin/bash ./configure --prefix=$HOME/Hi3536_SDK_V2.0.4.0/dropbear --with-zlib=$HOME/Hi3536_SDK_V2.0.4.0/zlib/include --host=arm CC=arm-hisiv400-linux-gccbut it seems that it's unable to local the path to zlib
You can see the problem by looking at the source for the configure script:
# Check if zlib is needed
AC_ARG_WITH(zlib,
[ --with-zlib=PATH Use zlib in PATH],
[
# option is given
if test -d "$withval/lib"; then
LDFLAGS="-L${withval}/lib ${LDFLAGS}"
else
LDFLAGS="-L${withval} ${LDFLAGS}"
fi
if test -d "$withval/include"; then
CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
else
CPPFLAGS="-I${withval} ${CPPFLAGS}"
fi
]
)
That is, it expects the option value to be the pathname of a directory which contains both the include and lib subdirectories (or a directory containing the files expected to be in those subdirectories). The comment shows that the given value was the pathname of the include (sub)directory. The following compile/link check will fail:
AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** zlib missing - install first or check config.log ***]))
The likely fix: change that option to
--with-zlib=$HOME/Hi3536_SDK_V2.0.4.0/zlib
Check the config.log file. Odds are, you'll find repeated error messages about -Wno-pointer-sign.
What's happening isn't that configure is failing to find zlib, it's that configure is expecting a newer version of GCC than you're using, and GCC is erroring out on the unrecognized command-line option. All the tests are failing, it's just that the test for zlib is the first one where failure is fatal.
To fix this, edit the configure script to remove -Wno-pointer-sign from the CFLAGS parameters (for me, it was on line 3135).
I solved this problem by installing zlib development files:
# Debian-based
sudo apt install libz-dev
# Fedora-based
sudo dnf install zlib-devel
This is related to the last error you've got:
configure: error: *** zlib.h missing - please install first or check config.log ***
The warnings you've got would get solved by this also. However, if you have it installed, maybe try reinstalling or updating it.
Bonus: One way to find required development shared libraries on your system is to ask your package manager what package provides a specific file. For example,
dnf provideson Fedora could help you in these situations:$ sudo dnf provides /usr/include/zlib.h ... zlib-devel-1.2.11-30.fc35.x86_64 : Header files and libraries for Zlib development Repo : @System Matched from: Filename : /usr/include/zlib.h ...
Found the solution thanks to this answer.
Probably configure has found a zlib.h for you host arch (/usr/include/zlib.h) and this is not usable for your target arch. See config.log for more details.
You need to build zlib using using the same cross compiler (configure --host=arm CC=arm-hisiv400-linux-g++). Or maybe your distribution provides a zlib devel package matching to your cross compiler.
In case you have zlib already installed to another prefix path you may need to tell configure about that, e.g.
./configure CFLAGS=-I/path/to/include LDFLAGS=-L/path/to/lib ...
or
./configure PKG_CONFIG_PATH=/path/to/lib/pkgconfig ...