Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boost iostreams with bzip2 built from source on windows

Recently, I spent some time working on getting boost version 1.44.0 built on windows with both iostreams support for both zlib & bzip2 compression filters. For a variety of reasons, it was decided to allow boost to build both zlib & bzip2 libraries from source. For what it's worth, but I don't think it matters, the version of MSVC I'm using is VC9 (VS2008). Also note that from my superficial examination, this issue should apply to any version of boost with iostreams built against bzip2 on windows.

Boost built cleanly by specifying -sZLIB_SOURCE=<PATH> and -sBZIP2_SOURCE=<PATH>. However, it was noticed that the boost_iostreams*.dll libs depended on libbz2.dll (instead of boost_bzip2*.dll), which did not exist. Boost, did however successfully build boost_bzip2*.dll. Note that I'm using the wildcard as a placeholder for the all of the build variant information.

Problem: Somewhere a hard-coded dependency to libbz2.dll exists.

like image 924
Nathan Ernst Avatar asked Jan 04 '11 01:01

Nathan Ernst


1 Answers

The simplest solution I found, was to modify libbz2.def included with the bzip2 source. Namely, delete the line (as of bzip2 v1.0.6, it is line 1):

LIBRARY   LIBBZ2

Removing this line eliminates the hard-coded dependency to a DLL named "libbz2.dll". This then allows the boost-built libs named boost_bzip2*.dll and generated *.lib and *.exp files to properly resolve to the corresponding DLL, as well as export all necessary functions.

like image 114
Nathan Ernst Avatar answered Nov 11 '22 06:11

Nathan Ernst