LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-22-2007, 11:21 AM   #1
SpinningCone
LQ Newbie
 
Registered: Jul 2006
Posts: 19

Rep: Reputation: 0
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
 
Old 02-22-2007, 12:09 PM   #2
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
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.
 
1 members found this post helpful.
Old 02-22-2007, 12:24 PM   #3
SpinningCone
LQ Newbie
 
Registered: Jul 2006
Posts: 19

Original Poster
Rep: Reputation: 0
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.
 
Old 02-22-2007, 06:28 PM   #4
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
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.
 
Old 02-26-2007, 08:21 AM   #5
SpinningCone
LQ Newbie
 
Registered: Jul 2006
Posts: 19

Original Poster
Rep: Reputation: 0
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.
 
Old 03-16-2007, 09:49 AM   #6
gnowak
LQ Newbie
 
Registered: Jan 2007
Posts: 7

Rep: Reputation: 0
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
 
Old 06-24-2011, 08:27 AM   #7
LaylaNahar
LQ Newbie
 
Registered: Oct 2006
Posts: 4

Rep: Reputation: 0
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"
 
Old 10-21-2011, 11:47 AM   #8
pjoseph
LQ Newbie
 
Registered: Oct 2011
Posts: 1

Rep: Reputation: Disabled
Thumbs up 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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error while loading shared libraries: libpng.so.2: [I reinstalled libPNG!] Shioni Linux - Software 1 09-09-2006 08:21 PM
no matching comp found: client zlib none, zlib@openssh.com lost connection jorge_ivan Linux - Networking 0 08-14-2006 08:09 PM
Installing Software Problem. Easy for you, impossible for me (libpng) tyleradam Linux - Software 7 10-14-2004 02:08 PM
Slackware 9.1, zlib and libpng-dev...???? ansemax Slackware 2 11-17-2003 01:21 PM
installing libpng problem yocompia Linux - Newbie 1 06-14-2003 10:41 PM


All times are GMT -5. The time now is 08:48 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration