[iostreams][gzip][zlib] zlib vs gzip, and linking against external libraries
What is the difference in functionality between gzip and zlib compression? I built Boost iostreams library on Linux after exporting ZLIB_SOURCE and BZIP2_SOURCE environment variables. However when I build a sample program using gzip / bzip2 with IOStreams, I do not need to link to libzlib or libbz2. Is the zlib / bz2 code built into libboost_iostreams in this case? For reference, this is the command line I used to build the iostreams library. ./b2 --with-iostreams --build-dir=../build threading=multi variant=release link=shared runtime-link=shared -- Aaron Levy aaron.levy@yandex.com
What is the difference in functionality between gzip and zlib compression?
I think gzip and zlib are two different variants of the DEFLATE algorithm and they differ in their header information.
I built Boost iostreams library on Linux after exporting ZLIB_SOURCE and BZIP2_SOURCE environment variables. However when I build a sample program using gzip / bzip2 with IOStreams, I do not need to link to libzlib or libbz2. Is the zlib / bz2 code built into libboost_iostreams in this case?
For reference, this is the command line I used to build the iostreams library.
./b2 --with-iostreams --build-dir=../build threading=multi variant=release link=shared runtime-link=shared
The following page lists build settings for iostreams. http://www.boost.org/doc/libs/1_57_0/libs/iostreams/doc/installation.html Gives me the impression that you can build against source or against pre-built libraries for zlib / bzip2. I guess if you built against source, then you don't need to separately link against zlib / bzip2 libraries. Arindam
Aaron Levy
I built Boost iostreams library on Linux after exporting ZLIB_SOURCE and BZIP2_SOURCE environment variables. However when I build a sample program using gzip / bzip2 with IOStreams, I do not need to link to libzlib or libbz2. Is the zlib / bz2 code built into libboost_iostreams in this case?
The boost_iostreams DSO depends on these libraries: $ eu-readelf -a ./lib64/libboost_iostreams.so.1.55.0 | grep NEEDED NEEDED Shared library: [libz.so.1] NEEDED Shared library: [libbz2.so.1] [...] The dependencies in libboost_iostreams are satisfied by its DT_NEEDED entries. Only if you used, say, libbz2 directly in your program would you need to link to libbz2. (Actually, it depends on the program linker. The older linkers would satisfy undefined symbols in your objects also from the DT_NEEDED of shared libraries that you spell out on the command line. Modern linkers only consider the libraries themselves.) Thanks, Petr
participants (3)
-
Aaron Levy
-
Arindam Mukherjee
-
Petr Machata