8

I'm trying to build Boost C++ libraries version 1.65.1 on Windows with zlib support. I'm using zlib library from Conan package with zlib which I built previously. I'm trying to understand the right steps for building boost with zlib support to use them for creating Conan recipe for boost. I tried to follow the instructions from the official boost documentation. I set the environment variables ZLIB_LIBRARY_PATH, ZLIB_NAME, and ZLIB_INCLUDE the following way:

set ZLIB_LIBRARY_PATH=C:\Users\ivan.bobev\.conan\data\zlib\1.2.11\igsoft\stable\package\63da998e3642b50bee33f4449826b2d623661505\lib
set ZLIB_NAME=zlibstat
set ZLIB_INCLUDE=C:\Users\ivan.bobev\.conan\data\zlib\1.2.11\igsoft\stable\package\63da998e3642b50bee33f4449826b2d623661505\include

and the build command is:

.\b2.exe -j8 --prefix="C:\work\test_builds\boost\install\x64_shared_release" --build-dir="C:\work\test_builds\boost\build\x64_shared_release" --layout=system architecture=x86 address-model=64 toolset=msvc variant=release debug-symbols=on link=shared threading=multi runtime-link=shared install

The result was:

 - zlib                     : no  (cached)

I also tried to clear boost build cash between runs.

After this I tried to set the environment variables directly from the b2 build command:

.\b2.exe -j8 -sZLIB_LIBRARY_PATH="C:\Users\ivan.bobev\.conan\data\zlib\1.2.11\igsoft\stable\package\63da998e3642b50bee33f4449826b2d623661505\lib"-sZLIB_NAME="zlibstat" -sZLIB_INCLUDE="C:\Users\ivan.bobev\.conan\data\zlib\1.2.11\igsoft\stable\package\63da998e3642b50bee33f4449826b2d623661505\include" --prefix="C:\work\test_builds\boost\install\x64_shared_release" --build-dir="C:\work\test_builds\boost\build\x64_shared_release" --layout=system architecture=x86 address-model=64 toolset=msvc variant=release debug-symbols=on link=shared threading=multi runtime-link=shared install

The result was the same.

Finally I tried adding the options into project-config.jam file the following way:

using zlib : 1.2.11 : <search>C:\Users\ivan.bobev\.conan\data\zlib\1.2.11\igsoft\stable\package\63da998e3642b50bee33f4449826b2d623661505\lib <name>zlibstat <include>C:\Users\ivan.bobev\.conan\data\zlib\1.2.11\igsoft\stable\package\63da998e3642b50bee33f4449826b2d623661505\include ;

Again I have no success.

In the zlib include folder there is subfolder zlib. I also tried the 3 variants from above setting the path as "../include/zlib". No success again.

How to build Boost with zlib support using my pre-built Conan package with zlib?

bobeff
  • 3,543
  • 3
  • 34
  • 62
  • Who maintains the boost conan package? Most likely you should directly ask them whether `zlib` support is a feature (or check docs) – sehe Sep 15 '17 at 13:15
  • @seha I'm trying to create my own Conan package with Boost. In the official Boost Conan package GitHub repository there is open [issue](https://github.com/lasote/conan-boost/issues/42) because currently the support for zlib is not implemented properly. – bobeff Sep 15 '17 at 13:19
  • 1
    Okay. So really what you want is to know how to build boost with zlib from your system. That has nothing to do with Conan (except you happened to have installed/built zlib from the conan package) – sehe Sep 15 '17 at 13:20
  • Yes. I will remove Conan tag from the question. – bobeff Sep 15 '17 at 13:21
  • Is the library you get from Conan actually named `zlibstat`? – llonesmiz Sep 15 '17 at 15:30
  • @llonesmiz I'm using my Conan recipe for the zlib library and this is the name which I use and which is in the corresponding `ZLIB_LIBRARY_PATH` directory. – bobeff Sep 15 '17 at 15:34
  • 2
    It seems that patching the project-config.jam and injecting the paths to the dependencies works. Take a look to the modified recipe for 1.64.0: https://github.com/lasote/conan-boost/blob/testing/1.64.0/conanfile.py And let me know if it works. (Method: patch_project_jam) – lasote Sep 15 '17 at 15:55
  • 1
    With the project-config.jam It seems to work on Linux/OSX but not in Windows where zlib keeps deactivated. In Linux/OSX the include dir passed to the compiler looks good. (pointing to the zlib/bzip2 packages). I assume you are trying with Windows. Right? – lasote Sep 15 '17 at 16:10
  • @lasote Yes, I'm trying it with Windows. I will try the solution in your answer. – bobeff Sep 16 '17 at 16:01

1 Answers1

3

The project-config.jam patch is ok, and actually, is working in Linux and OSX. In Windows you need to replace the "\" characters (escape char in jam language) with "/".

You can see my updated Conan recipe for Boost 1.64.0 here

lasote
  • 591
  • 2
  • 12