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: | 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
$(NO_$(LIB)) |
to
$(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)
Change History (10)
by , 14 years ago
Attachment: | Jamfile.v2 added |
---|
comment:1 by , 14 years ago
Component: | None → Building Boost |
---|---|
Owner: | set to |
comment:2 by , 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.
follow-up: 4 comment:3 by , 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 ;
}
$(NO_$(LIB)) |
+ # bpratt added the = 1 tests here to get zlib working in MinGW and VC8
$(NO_$(LIB)) = 1 |
{
if $(debug) {
@@ -141,7 +142,6 @@
comment:4 by , 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 , 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 , 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 , 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 , 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 , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(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.
hacked iostreams Jamfile.v2 that allows zlib use in VC8 and MinGW