Opened 14 years ago

Closed 14 years ago

#1967 closed Bugs (fixed)

bjam bug? iostreams + zlib won't build for VC8 or MinGW with small hack to Jamfile.v2

Reported by: brian.pratt@… Owned by: Vladimir Prus
Milestone: Boost 1.36.0 Component: Building Boost
Version: Boost 1.35.0 Severity: Problem
Keywords: Cc:

Description

In boost_1_35_0\libs\iostreams\build\Jamfile.v2 I find I have to change

if $(NO_COMPRESSION)
$(NO_$(LIB))

to

if $(NO_COMPRESSION) = 1
$(NO_$(LIB)) = 1

to get VC8 or MinGW building with zlib. This is with bjam -v Boost.Jam Version 3.1.16. OS=NT.

Attachments (1)

Jamfile.v2 (4.5 KB ) - added by brian.pratt@… 14 years ago.
hacked iostreams Jamfile.v2 that allows zlib use in VC8 and MinGW

Download all attachments as: .zip

Change History (10)

by brian.pratt@…, 14 years ago

Attachment: Jamfile.v2 added

hacked iostreams Jamfile.v2 that allows zlib use in VC8 and MinGW

comment:1 by Marshall Clow, 14 years ago

Component: NoneBuilding Boost
Owner: set to Vladimir Prus

comment:2 by Vladimir Prus, 14 years ago

Can you provide a little bit more explanations? On NT, we already set NO_$(LIB) to 1 a few lines earlier, unless you provide the path to the zlib source. So, what exactly are you doing, how it works, and how you want it to work.

Also, please provide changes as unified diff against SVN HEAD, if possible.

comment:3 by brian.pratt@…, 14 years ago

I notice a typo in the bug description, I meant to say "without small hack", of course. Oops.

Near as I can tell the problem is that when NO_ZLIB is defined to 0 it still triggers the logic, as if it's an ifdef instead of an if, if you see what I mean.

Here's my change as a unified diff against trunk as requested:

--- Jamfile.orig Tue Jun 3 11:52:46 2008 +++ Jamfile.v2 Thu May 29 07:58:30 2008 @@ -55,7 +55,8 @@

modules.poke : NO_$(LIB) : 1 ;

}

if $(NO_COMPRESSION)
$(NO_$(LIB))

+ # bpratt added the = 1 tests here to get zlib working in MinGW and VC8

+ if $(NO_COMPRESSION) = 1
$(NO_$(LIB)) = 1

{

if $(debug) {

@@ -141,7 +142,6 @@

in reply to:  3 comment:4 by René Rivera, 14 years ago

Replying to brian.pratt@insilicos.com:

Near as I can tell the problem is that when NO_ZLIB is defined to 0 it still triggers the logic, as if it's an ifdef instead of an if, if you see what I mean.

AFAICT, this is intentional in the iostreams Jamfile. And it doesn't set them to "0" anywhere I can see. How are you seeing it being set to "0"?

comment:5 by brian.pratt@…, 14 years ago

Since NO_ZLIB defaults to 1 for VC8 and MinGW, it's necessary to set it to 0 at the bjam commandline (-sNO_ZLIB=0). My experience, though, was that this didn't work, and that the test as written seemed to act more as an "ifdef NO_ZLIB". If the test is rewritten to check explicitly for value "1" it acts as required and the zlib build is enabled. It's as if bjam has forgotten the difference between a boolean (zero vs everything else) and an ifdef (undefined vs everything else).

comment:6 by Vladimir Prus, 14 years ago

By my reading of the code, NO_ZLIB will be set to 1, if you're on Windows, and have not set both ZLIB_SOURCE and ZLIB_INCLUDE. If you set NO_ZLIB=0 on command line and do not set ZLIB_SOURCE and ZLIB_INCLUDE, zlib won't be used anyway. And if you do set ZLIB_SOURCE and ZLIB_INCLUDE, zlib should be used without any other option. So, back to original question -- what exactly are you doing (exact command line), and what effect you see?

comment:7 by brian.pratt@…, 14 years ago

bjam -toolset=msvc "-sNO_ZLIB=0" -sZLIB_SOURCE="/zlib123-dll" --build-type=complete --without-python --without-mpi stage

I tried various permutations of ZLIB_SOURCE, ZLIB_INCLUDE etc (docs are exceedingly murky on this), this commandline together with the patch is the one that results in zlib being enabled. Everything else gave the default no zlib behavior.

comment:8 by alessandro_vergani, 14 years ago

The problem happens also with VC9. I think it is a problem with bjam because if I place in the jamfile.v2 a simple test like:

if 0 {

ECHO "Error" ;

}

the test always succeeds and the error string is diplayed.

Explicitly comparing for equality with 1 solves the problem.

comment:9 by Vladimir Prus, 14 years ago

Resolution: fixed
Status: newclosed

(In [52168]) Check if value of NO_COMPRESSION/NO_ZLIB is 0 or 1.

Originally, only presence of these variables was checked. Unfortunately, iostreams documentation said, incorrectly, that NO_ZLIB and NO_BZIP2 default to 1 on Windows, which caused some users to pass NO_ZLIB=0 explicitly, together with other variables,thereby still disabling zlib.

This match makes Jamfile forgiving of this error.

Fixes #1967.

Note: See TracTickets for help on using tickets.