I'm trying to cross-compile openSSH for ARMs but it seems that i'm unsuccessful:

Here're my configure parameters:

./configure --host=arm CC=arm-hisiv400-linux-g++ --prefix=/home/aa/Hi3536_SDK_V2.0.4.0/openSSH --with-zlib=/usr/include

checking zlib.h presence... yes
configure: WARNING: zlib.h: present but cannot be compiled
configure: WARNING: zlib.h:     check for missing prerequisite headers?
configure: WARNING: zlib.h: see the Autoconf documentation
configure: WARNING: zlib.h:     section "Present But Cannot Be Compiled"
configure: WARNING: zlib.h: proceeding with the compiler's result
configure: WARNING:     ## ------------------------------------------- ##
configure: WARNING:     ## Report this to [email protected] ##
configure: WARNING:     ## ------------------------------------------- ##
checking for zlib.h... no
configure: error: *** zlib.h missing - please install first or check config.log ***

Could anyone advise why although zlib.h is present but unable to compile?

2 Answers 2


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 provides on 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 ...


./configure PKG_CONFIG_PATH=/path/to/lib/pkgconfig ...

  • actually I did use the same CC to build the sources. somehow when building openSSH it can't find the zlib. Btw, where may I find config.log file?
    – rainfrost
    Oct 11, 2016 at 9:04
  • config.log should be in the build directory where you run ./configure. I've updated my answer regarding custom include paths.
    – rudimeier
    Oct 11, 2016 at 9:24
  • btw, how do we verify if zlib is usable / suitable for my target arch?
    – rainfrost
    Oct 11, 2016 at 9:57
  • @emddev just compile a minimal test file bla.c which has #include "zlib.h". gcc -c bla.c -o bla.o. The compiler will give you error or success. That's basically the same what configure` is doing. The config.log should show you the test code and gcc command verbosely.
    – rudimeier
    Oct 11, 2016 at 10:07
  • thanks for the guidance, I think it's because zlib.h wasn't configured properly for my target arch. When I re-build zlib again and then rebuild openssh again, I was able to build openssh but new problems surfaced when I try to make
    – rainfrost
    Oct 12, 2016 at 3:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .