Opened 5 years ago

Last modified 22 months 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 Changed 5 years ago by anonymous

Same bug in 1.55.0

comment:2 Changed 5 years ago by anonymous

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

comment:3 Changed 5 years ago by Steven Watanabe

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 Changed 4 years ago by anonymous

We also observed this problem when switching to Boost 1.56

comment:5 Changed 4 years ago by anonymous

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 Changed 4 years ago by anonymous

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

comment:7 Changed 4 years ago by anonymous

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 Changed 4 years ago by anonymous

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 Changed 4 years ago by Steven Watanabe

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 Changed 4 years ago by dd0t@…

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 Changed 4 years ago by dd0t@…

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 Changed 3 years ago by dave.lowell@…

Cc: dave.lowell@… added

comment:12 Changed 3 years ago by anonymous

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 Changed 3 years ago by Daniel.Kruegler@…

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 Changed 2 years ago by Daniel.S

Still broken in 1.61. Hoping for 1.62 ...

comment:15 Changed 2 years ago by raad@…

Cc: raad@… added

comment:16 Changed 2 years ago by raad@…

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

comment:17 Changed 22 months ago by blf_sn@…

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.