zlib not recognized by libpng (zlib not installed)

I know there are allot of posts on the web about this but I'm wondering if someone could give me a tip as to what I could do to make libpng recognise zlib.

I am using windows xp, MingW compiler, I also have MSYS installed.

I've tried building libpng directly using the makefile.gcc in the scripts folder by using the command prompt but I still get an error.

So I'm now using MSYS to configure (./configure) libpng. It works fine up to a point.
The problem is MSYS during the configure process can't find zlib and tells me it isn't installed. I've read the installation instructions in the libpng directory but it doesn't help.

Was wondering if anyone has been through this process before. I've tried placing zlib in the same directory as libpng. I've also tried putting the zlib.h and zconf.h files into the same directory as libpng. I've also arranged the directory the same way the install file explains..... still no luck.
There's probably a setting in one of the files in the libpng directory but I'm not sure what it could be.

Could anyone suggest a course of action here. Thanks.
Build systems will usually check dependencies on conventionally used locations like the following:

... etc

Put the zlib headers and library files in these then re-run the configure script.

Also, good build systems allows for specifying install locations of external dependencies. Try issuing the command:
$ ./configure --help
You should be able to see how to specify the install locations.
/usr/ == linux
/usr/ == linux

I am using windows xp, MingW compiler, I also have MSYS installed.

You must build zlib first using MSYS (do not build it other way).
As far as I was aware, I was only building it once. I have built zlib. Then I wanted to build Libpng. Libpng can't see zlib...

Last edited on
Did you actually install it with make install, or did you just make it and went "eh, it's built" once it was finished?
you can't use make install in windows XP command prompt. Thats a MSYS command.

I used Win XP command prompt:
mingw32-make -f win32\Makefile.gcc to build zlib.

helios.. this is frustrating enough.. Do you have something you would like to contribute or are you just badgering me?? You clearly know something about this so why hold back.

This is not about zlib, its about libpng.. Libpng cannot find zlib when I use the MSYS ./configure command.

I would go through the configure process first './configure then I would use make install. On the ./configure process of libpng in MSYS, the MSYS command screen tells me that it can't find zlib.

Now... If I completely avoid using MSYS and try to use the Windows XP command prompt and I enter mingw32-make -f scripts\makefile.gcc (this is using the makefile.gcc file provided in the scripts directory), I get an error. The error is:

C:\libpng>mingw32-make -f scripts\makefile.gcc
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
process_begin: CreateProcess(NULL, cp scripts/pnglibconf.h.prebuilt pnglibconf.h
, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: *** [pnglibconf.h] Error 2
Last edited on
I am not very well versed in MinGW, but I am pretty sure the configure scripts of both zlib and libpng should allow some customizations.

People have already told you what the issue is if you built zlib yourself. I also mentioned to invoke the help command on your configure script - try to read and understand what the help says. It will teach you many things.

Here's what one would normally do if their system/environment is not following conventions.

# go inside zlib directory to build zlib as libpng dependency
# again, always issue "./configure --help" to check for valid options
$ ./configure --prefix="install_zlib_at_this_location"
$ make
$ sudo make install
# zlib should be built and installed at the location specified above
# now, go inside libpng directory
$ ./configure --prefix="install_libpng_at_this_location" --with-zlib-prefix="install_zlib_at_this_location"
$ make
$ sudo make install

Replace the make command with the particular make program you are using. Even if you cannot use the make install command, the option --with-zlib-prefix should tell libpng's configure script where to locate this dependency.

As I said earlier (and I want to re-iterate this again), read and understand what the command ./configure --help is saying. It has saved countless hours and will continue to do so!
helios.. this is frustrating enough.. Do you have something you would like to contribute or are you just badgering me??
Don't be so sensitive.
Topic archived. No new replies allowed.