Boost logo

Boost :

Subject: Re: [boost] [iostreams][gzip][zlib] zlib vs gzip, and linking against external libraries
From: Petr Machata (pmachata_at_[hidden])
Date: 2015-01-18 17:53:05

Aaron Levy <aaron.levy_at_[hidden]> writes:

> 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/ | grep NEEDED
  NEEDED Shared library: []
  NEEDED Shared library: []

The dependencies in libboost_iostreams are satisfied by its DT_NEEDED

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.)


Boost list run by bdawes at, gregod at, cpdaniel at, john at