[Zlib-devel] [zlib-devel] Issues with "make install" in zlib-1.2.5
Nelson H. F. Beebe
beebe at math.utah.edu
Tue Apr 20 13:59:12 EDT 2010
During the zlib-1.2.4.x tests, the recommendation was not to install
the built libraries, so I didn't. However, experience this morning
with the new zlib-1.2.5 shows that to have been a mistake.
On Mac OS X, MirBSD, and OpenSUSE, "make install" fails:
% make install
cp libz.a /usr/local/lib
cp /usr/local/lib
cp: missing destination file operand after `/usr/local/lib'
Try `cp --help' for more information.
I forced it past that point with "make install -i -k".
I noticed after doing the installs on all of my systems that on most,
both libz.a and libz.so.1.2.5 are built and installed. However,
shared libraries are not built on Mac OS X, MirBSD, and OpenSUSE.
The FAQ file notes
13. How can I make a Unix shared library?
make clean
./configure -s
make
I did rebuilds on those systems that -s option, but no libz.so.* or
libz.*dylib files were created.
>From past builds of zlib on Mac OS X, I have these shared zlib
libraries:
Mac OS X Intel:
Mar 11 2008 /usr/local/lib/libz.1.2.3.3.dylib
Mar 11 2008 /usr/local/lib/libz.1.dylib
Apr 20 09:06 /usr/local/lib/libz.a
Mar 11 2008 /usr/local/lib/libz.dylib
Mac OS X PowerPC:
Nov 28 2003 /usr/local/lib/libz.1.2.1.dylib
Jan 10 2005 /usr/local/lib/libz.1.2.2.2.dylib
Oct 26 2004 /usr/local/lib/libz.1.2.2.dylib
Jul 18 2005 /usr/local/lib/libz.1.2.3.dylib
Jul 18 2005 /usr/local/lib/libz.1.dylib
Jul 18 2005 /usr/local/lib/libz.dylib
This creates a problem, because Unix linkers prefer shared libraries
over static ones, and using -lz at link time will now link to those
older libraries, instead of the latest version. One can work around
the problem by explicitly specifying /usr/local/lib/libz.a, but it is
a nuisance to have to do so, particularly considering how many other
packages use that library. The older shared libraries cannot be
removed, because many other executable programs depend on them.
I then looked at the configure output in the build logs, and find on
Mac OS X
Checking for shared library support...
Building shared library libz.1.2.5.dylib with gcc.
However, no such library gets built. I then tried
% make shared
cc -O -o examplesh example.o -L.
Undefined symbols:
"_inflateSetDictionary", referenced from:
_test_dict_inflate in example.o
"_gzputc", referenced from:
_test_gzio in example.o
... many more such errors ...
On OpenSUSE, configure reports
Checking for shared library support...
Tested /usr/bin/cc -w -c -O ztest8549.c
Tested cc -shared -O -o ztest8549.so ztest8549.o
No shared library support; try without defining CC and CFLAGS
Building static library libz.a version 1.2.5 with /usr/bin/cc.
/usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../x86_64-suse-linux/bin/ld:
ztest8549.o: relocation R_X86_64_PC32 against undefined symbol
`getchar@@GLIBC_2.2.5' can not be used when making a shared
object; recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../x86_64-suse-linux/bin/ld:
final link failed: Bad value collect2: ld returned 1 exit
status
I have about 40 shared libraries in /usr/local/lib* on that platform
from other packages, so it is unclear why zlib won't build that way
too.
On MirBSD, configure reports:
Tested /usr/bin/mgcc -shared \
-Wl,-soname,libz.so.1,--version-script,zlib.map \
-I/usr/local/include -fPIC -o ztest20787.so ztest20787.o
No shared library support; try without defining CC and CFLAGS
Building static library libz.a version 1.2.5 with /usr/bin/mgcc.
I have 14 *.so.* files in /usr/local/lib, so shared libraries should
be possible.
Finally, in the "make install" runs that succeeded, I recorded output
like this:
cp libz.a /usr/local/lib
cp libz.so.1.2.5 /usr/local/lib
cd /usr/local/lib; chmod u=rw,go=r libz.a
cp zlib.3 /usr/local/share/man/man3
chmod 644 /usr/local/share/man/man3/zlib.3
cp zlib.pc /usr/local/lib/pkgconfig
chmod 644 /usr/local/lib/pkgconfig/zlib.pc
cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
Notice that three chmod commands have argument 644, while the first
has u=rw,go=r. While the symbolic form is legal, it is unwise to use
it in Makefiles of portable code, since rather old chmod
implementations may not recognize that form. Also, it would be better
to parametrize that argument as a Makefile macro, so I could override
the default with
make install CHMODFLAGS=664
to better suit the conventions at my site (large, and with multiple
staff members, any of whom might build the next version of zlib).
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: beebe at math.utah.edu -
- 155 S 1400 E RM 233 beebe at acm.org beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------
More information about the Zlib-devel
mailing list