LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   zlib problem when installing libpng (https://www.linuxquestions.org/questions/linux-software-2/zlib-problem-when-installing-libpng-531369/)

SpinningCone 02-22-2007 10:21 AM

zlib problem when installing libpng
 
Hi, im new to linux and am currently trying to install Apache/php on a Debian sarge server

right nowim trying to install libpng so i can include png support in php and its been giving me hell for a while now

i downloaded the latest libpng tar (1.2.16) put it in /apps/

i run ./configure --prefix=/apps

and i get the following error

checking for zlibVersion in -lz... no
configure: error: zlib not installed

so i get zlib and install that with --prefix=/apps and it makes fine.

libpng still wont configure , so after some googling I try the following command:

export LDFLAGS="-L /apps/lib"

now libpng will configure i get no errors however when i try to make i get tons of errors like "error: syntax error before '*' token" or "dereferencing pointer to incomplete type"

as far as i can tell the problem lies here:
In file included from png.c:13:
png.h:391:18: zlib.h: No such file or directory

png.h is trying to #include zlib.h and its not finding it for some reason, however as far as i can tell using --prefix=/apps in my configuration should have it pointing at /apps/include for include files and if i look in that directory i see a zlib.h file so i don't know what the problem is.


FYI. i dont have gnome on this only a ssh terminal i cannot use packages or apt-get i can only build from tar files.

any help would be appreciated

berbae 02-22-2007 11:09 AM

Hi SpinningCone
As you installed zlib in a non standard location, the header files for it will not be found.
The command './configure --help' tells :
Quote:

LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>
You should consider using also the CPPFLAGS environment variable :
export CPPFLAGS="-I /apps/include"

Why don't you use the /usr/local location which is more standard and should not result in the problems you have ?

You should read also the INSTALL file which contains other infos about libpng and zlib.
Good luck.

SpinningCone 02-22-2007 11:24 AM

thanks that seems to have taken me a step further. i don't like playing with the environment variables if i don't have to

anyway now i get much further but it kicks out at:

/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make[1]: *** [libpng12.la] Error 1
make[1]: Leaving directory `/apps/libpng-1.2.16'
make: *** [all] Error 2

which im guessing is another case of an environment vaiable problem or somthing to point the right place.. what exactly is -lz?

as for using /usr/local or /usr/ anything its not up to me . i didn't install debian . i dont have root acces and /apps is the only place i have permissions.

the reasoning behind this is for security and ironicly ease of use. if somthing bad happens /apps/ can be wiped out. if it were up to me id be using windows server or at least packages.

berbae 02-22-2007 05:28 PM

Quote:

/usr/bin/ld: cannot find -lz
It means that it doesn't find the archive libz.a in its search path.
Check if you have this file in /apps/lib
If not there is a problem with the zlib installation.
If yes, have you correctly set the two environment variables :
export LDFLAGS="-L /apps/lib"
export CPPFLAGS="-I /apps/include"

I realize that you wrote :
I am currently trying to install Apache/php on a Debian sarge server
and
i dont have root access

I am not convinced that you can do this without root privileges.
So I suggest you ask for the root password and install precompiled packages for Debian sarge.
Or ask the server administrator to install the packages for you with
Apt.

SpinningCone 02-26-2007 07:21 AM

ldflags is pointed at apps/lib and there is a zlib.a in there. not sure why its having trouble with this one. must be somthing else that needs to point there, perhaps i need to reconfigure.

as for installing without root im sudoing to another login with higher permissions but not root permissions this causes problems with .deb files but gives me enough to do what i need. apache itself is already installed its just php that's being a pain in the butt.

gnowak 03-16-2007 08:49 AM

Quote:

Originally Posted by SpinningCone
anyway now i get much further but it kicks out at:

/usr/bin/ld: cannot find -lz

I fixed my compilation problem by installing zlib1g-dev:
apt-get install zlib1g-dev
The above was done on Kubuntu 6.10.

Cheers, Grzegorz

LaylaNahar 06-24-2011 07:27 AM

I found berbae's response very helpful. I was able to get libpng to build successfully by running ./configure without any options - eg using the default settings. It was also useful to look at "./configure --help"

pjoseph 10-21-2011 10:47 AM

Solved by berbae
 
I am compiling libpng-1.5.5 using Mingw on win32. berbae's solution solved my problem related to using non-standard directories. Note, that Mingw did not like the spaces included in CPPFLAGS and LDFLAGS.

Code:

export CPPFLAGS="-I/usr/include"
export LDFLAGS="-L/usr/lib"
./configure --prefix=/usr --disable-shared
make
make install

Since this requires zlib, I had previously compiled zlib-1.2.5:

Code:

export BINARY_PATH="/usr/bin"
export INCLUDE_PATH="/usr/include"
export LIBRARY_PATH="/usr/lib"
make -fwin32/Makefile.gcc
make install

All works fine.


All times are GMT -5. The time now is 09:55 PM.