While making my program on Redhat based linux (amd64), I get this error:
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
Searching internet reveals that I have t install zlib 32bit version. A quick search shows that I have that package
[root@localhost trunk]# find / -name libz*
/lib64/libz.so.1
/lib64/libz.so.1.2.3
/lib/libz.so.1
/lib/libz.so.1.2.3
/usr/lib64/libz.so
/usr/lib64/purple-2/libzephyr.so
/usr/lib64/libzip.so.1.0.0
/usr/lib64/libzip.so.1
As you can see both /lib
and /lib64
contain the libz file. Next I tried to find the ldd search path and it shows that both 32 bit and 64 bit folders are included
[root@localhost trunk]# ldconfig -v | grep -v ^$'\t'
/usr/lib64/ctapi:
/usr/lib64/mysql:
/usr/lib64/tcl8.5/tclx8.4:
/usr/lib64/xulrunner-2:
/lib:
/lib64:
/usr/lib:
/usr/lib64:
/lib/i686: (hwcap: 0x0008000000000000)
/lib64/tls: (hwcap: 0x8000000000000000)
/usr/lib64/tls: (hwcap: 0x8000000000000000)
/usr/lib64/sse2: (hwcap: 0x0000000004000000)
/lib/i686/nosegneg: (hwcap: 0x0028000000000000)
SO I wonder why still I get that error!!!!
UPDATE
I installed zlib-devel
(both i686 and x86_64) and here is the confirmation
[root@localhost trunk]# yum list zlib-devel
Installed Packages
zlib-devel.i686 1.2.3-27.el6 @sl
zlib-devel.x86_64 1.2.3-27.el6 @sl
However still I get the same error.
UPDATE 2
After fixing the incorrect symbolic link, I now have
[root@localhost trunk]# ls -l /lib/libz.so*
lrwxrwxrwx. 1 root root 18 Feb 23 22:58 /lib/libz.so -> /usr/lib64/libz.so
lrwxrwxrwx. 1 root root 13 Feb 18 12:06 /lib/libz.so.1 -> libz.so.1.2.3
-rwxr-xr-x. 1 root root 75332 Dec 10 2011 /lib/libz.so.1.2.3
But error still exists
SOLUTION
SOLUTION
I found that I have to install static libraries. Don't know why Makefile searches for static libraries! Please refer to my comments for the name of packages.
Thanks fuero for help