Opened 9 years ago

Last modified 6 years ago

#9156 new Bugs

1.54 broke NO_ZLIB=1 and NO_COMPRESSION=1

Reported by: Warren Togami <wtogami@…> Owned by: Jonathan Turkanis
Milestone: Boost 1.55.0 Component: iostreams
Version: Boost 1.55.0 Severity: Regression
Keywords: zlib iostreams /zlib/zlib Cc: swatanabe, dave.lowell@…, raad@…

Description

https://github.com/boostorg/iostreams/commit/dfb1f61c26b77556a1cca0654d08847cf87d26ae This commit broke the ability to build boost with without zlib. The following bjam succeeds if you remove these two lines added by this patch. Please fix for 1.55?

+      [ ac.check-library /zlib//zlib : <library>/zlib//zlib
+        <source>zlib.cpp <source>gzip.cpp ]
./bjam toolset=gcc target-os=windows threadapi=win32 threading=multi variant=release link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix=/home/ubuntu/out/staging/boost -j2 install
Performing configuration checks

    - 32-bit                   : yes
    - arm                      : no
    - mips1                    : no
    - power                    : no
    - sparc                    : no
    - x86                      : yes
    - has_icu builds           : no
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
error: at /home/ubuntu/build/boost_1_54_0/tools/build/v2/kernel/modules.jam:107
error: Unable to find file or target named
error:     '/zlib//zlib'
error: referred to from project at
error:     'libs/iostreams/build'
error: could not resolve project reference '/zlib'

Change History (18)

comment:1 by anonymous, 9 years ago

Same bug in 1.55.0

comment:2 by anonymous, 9 years ago

Keywords: zlib iostreams /zlib/zlib added
Version: Boost 1.54.0Boost 1.55.0

comment:3 by Steven Watanabe, 9 years ago

If you don't have zlib installed, you can just remove NO_ZLIB. The autodetection of zlib is improved by this same commit. I will fix this, but it may not make it into 1.56.

comment:4 by anonymous, 8 years ago

We also observed this problem when switching to Boost 1.56

comment:5 by anonymous, 8 years ago

On Boost 1.56 (current release), building without NO_ZLIB also fails if zlib is not available.

It appears to me it is impossible to build iostreams without zlib support as it is.

comment:6 by anonymous, 8 years ago

Same problem observed with building Boost 1.57 with NO_COMPRESSION or NO_ZLIB.

comment:7 by anonymous, 8 years ago

Boost 1.57 works for me if I remove the NO_ZLIB flag and let it autodetect (lack of) zlib.

I still consider it a bug that explicitly passing NO_ZLIB breaks the build, though.

comment:8 by anonymous, 8 years ago

Under Ubuntu 14.04.1 LTS, this is the output of trying to build Boost 1.57 iostreams without zlib and WITHOUT specifying NO_COMPRESSION or NO_ZLIB:

Performing configuration checks

    - zlib                     : no  (cached)
    - zlib                     : no  (cached)

Component configuration:

    - atomic                   : not building
    - chrono                   : not building
    - container                : not building
    - context                  : not building
    - coroutine                : not building
    - date_time                : not building
    - exception                : not building
    - filesystem               : not building
    - graph                    : not building
    - graph_parallel           : not building
    - iostreams                : building
    - locale                   : not building
    - log                      : not building
    - math                     : not building
    - mpi                      : not building
    - program_options          : not building
    - python                   : not building
    - random                   : not building
    - regex                    : not building
    - serialization            : not building
    - signals                  : not building
    - system                   : not building
    - test                     : not building
    - thread                   : not building
    - timer                    : not building
    - wave                     : not building

...patience...
...found 22554 targets...
...updating 8 targets...
gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.8/release/threading-multi/bzip2.o
libs/iostreams/src/bzip2.cpp:20:56: fatal error: bzlib.h: No such file or directory
 #include "bzlib.h"  // Julian Seward's "bzip.h" header.
                                                        ^
compilation terminated.

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread -fPIC  -DBOOST_ALL_NO_LIB=1 -DBOOST_IOSTREAMS_DYN_LINK=1 -DBOOST_IOSTREAMS_USE_DEPRECATED -DNDEBUG  -I"." -c -o "bin.v2/libs/iostreams/build/gcc-4.8/release/threading-multi/bzip2.o" "libs/iostreams/src/bzip2.cpp"

...failed gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.8/release/threading-multi/bzip2.o...
...skipped <pbin.v2/libs/iostreams/build/gcc-4.8/release/threading-multi>libboost_iostreams.so.1.57.0 for lack of <pbin.v2/libs/iostreams/build/gcc-4.8/release/threading-multi>bzip2.o...
...skipped <p~/projects/icam/tmp/boost_install/lib>libboost_iostreams.so.1.57.0 for lack of <pbin.v2/libs/iostreams/build/gcc-4.8/release/threading-multi>libboost_iostreams.so.1.57.0...
...skipped <p~/projects/icam/tmp/boost_install/lib>libboost_iostreams.so for lack of <p~/projects/icam/tmp/boost_install/lib>libboost_iostreams.so.1.57.0...
gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.8/release/link-static/threading-multi/bzip2.o
libs/iostreams/src/bzip2.cpp:20:56: fatal error: bzlib.h: No such file or directory
 #include "bzlib.h"  // Julian Seward's "bzip.h" header.
                                                        ^
compilation terminated.

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread  -DBOOST_ALL_NO_LIB=1 -DBOOST_IOSTREAMS_USE_DEPRECATED -DNDEBUG  -I"." -c -o "bin.v2/libs/iostreams/build/gcc-4.8/release/link-static/threading-multi/bzip2.o" "libs/iostreams/src/bzip2.cpp"

...failed gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.8/release/link-static/threading-multi/bzip2.o...
...skipped <pbin.v2/libs/iostreams/build/gcc-4.8/release/link-static/threading-multi>libboost_iostreams.a(clean) for lack of <pbin.v2/libs/iostreams/build/gcc-4.8/release/link-static/threading-multi>bzip2.o...
...skipped <pbin.v2/libs/iostreams/build/gcc-4.8/release/link-static/threading-multi>libboost_iostreams.a for lack of <pbin.v2/libs/iostreams/build/gcc-4.8/release/link-static/threading-multi>bzip2.o...
...skipped <p~/projects/icam/tmp/boost_install/lib>libboost_iostreams.a for lack of <pbin.v2/libs/iostreams/build/gcc-4.8/release/link-static/threading-multi>libboost_iostreams.a...
...failed updating 2 targets...
...skipped 6 targets...

comment:9 by Steven Watanabe, 8 years ago

The workaround is to allow autodetection for zlib but specify -sNO_BZIP2. I never got around to implementing auto-detection for bzip2. I'll fix the problems with NO_ZLIB tonight.

comment:10 by dd0t@…, 7 years ago

The very same commit you identified seems to also break manual configuration of an external zlib in boost 1.58.0 (and earlier I guess) as described by the documentation (http://www.boost.org/doc/libs/1_58_0/libs/iostreams/doc/installation.html). Setting ZLIB_BINARY, ZLIB_INCLUDE and ZLIB_LIBPATH previously allowed to specify an externally compiled version of zlib with custom binary name. These options seem to no longer have any effect on the build configuration resulting in zlib not being found and disabled. Looking at the jamfile it seems like the previously used create-library rule had all the handling for that while the new ac.check-library probably isn't even aware of these parameters. Reverting the changes to the Jam files allows using the custom zlib version again.

Unless the auto-detection can be made aware of those configuration options I don't think it is a viable replacement. For my use-case the whole application and dependencies (including boost) are statically linked so I have to prevent trying to link multiple versions of it when zlib is used elsewhere. Also this external zlib has a non-standard name (libzlib.a under linux instead of libz.a).

In any case the documentation doesn't seem to properly reflect the current library behavior. Or maybe I'm just completely misunderstanding it which is always possible.

comment:10 by dd0t@…, 7 years ago

The very same commit you identified seems to also break manual configuration of an external zlib in boost 1.58.0 (and earlier I guess) as described by the documentation (http://www.boost.org/doc/libs/1_58_0/libs/iostreams/doc/installation.html). Setting ZLIB_BINARY, ZLIB_INCLUDE and ZLIB_LIBPATH previously allowed to specify an externally compiled version of zlib with custom binary name. These options seem to no longer have any effect on the build configuration resulting in zlib not being found and disabled. Looking at the jamfile it seems like the previously used create-library rule had all the handling for that while the new ac.check-library probably isn't even aware of these parameters. Reverting the changes to the Jam files allows using the custom zlib version again.

Unless the auto-detection can be made aware of those configuration options I don't think it is a viable replacement. For my use-case the whole application and dependencies (including boost) are statically linked so I have to prevent trying to link multiple versions of it when zlib is used elsewhere. Also this external zlib has a non-standard name (libzlib.a under linux instead of libz.a).

In any case the documentation doesn't seem to properly reflect the current library behavior. Or maybe I'm just completely misunderstanding it which is always possible.

comment:11 by dave.lowell@…, 7 years ago

Cc: dave.lowell@… added

comment:12 by anonymous, 7 years ago

Hello, what is the status of this issue?

I am using boost 1.59. I supply ZLIB_INCLUDE & ZLIB_LIBPATH, but not ZLIB_SOURCE (along with -s NO_COMPRESSION=0 -s NO_ZLIB=0 -s NO_BZIP2=1). I see the following in the build log.

notice: [zlib] Using pre-installed library
notice: [zlib] Condition
notice: iostreams: not using bzip2 compression 
notice: iostreams: not using bzip2 compression

But in the end, there is no libboost_zlib library being produced. There is also no obvious error message.

Thanks,

Qingning

comment:13 by Daniel.Kruegler@…, 7 years ago

We noticed the same problem while building Boost 1.60 with NO_COMPRESSION, NO_ZLIB, and NO_BZIP2 using toolset gcc on linux.

comment:14 by Daniel.S, 6 years ago

Still broken in 1.61. Hoping for 1.62 ...

comment:15 by raad@…, 6 years ago

Cc: raad@… added

comment:16 by raad@…, 6 years ago

This has been fixed here: https://github.com/boostorg/iostreams/commit/95515196ce2bed1a06067fc9bbfbed39337d74e2 But unfortunately never been merged to master.

comment:17 by blf_sn@…, 6 years ago

This resolve my issue (boost-1.57..0) ./b2 --with-iostreams -s ZLIB_INCLUDE=/home/user/build/zlib-1.2.8 -s ZLIB_LIBPATH=/home/user/build/zlib-1.2.8 s ZLIB_SOURCE=home/user/build/zlib-1.2.8

Note: See TracTickets for help on using tickets.