Tuesday, August 20, 2013

Boost at nuget.org

It's unofficial but it works https://www.nuget.org/packages/boost/. For Visual Studio 2012, supported platforms: Win32 and x64.

It's huge 235Mb and takes about half an hour to install.

  1. Open your C++ project. Or create a new one.
  2. Open Tools | Library Package Manager | Manage NuGet Packages for Solution....
  3. Search for "boost" in Online | NuGet Official Package Source (Include Prerelease).
  4. Press the Install button.
  5. Wait for about 10 minutes.
  6. Select your C++ project and press Ok.
  7. Wait for another 10 minutes.
  8. Close the dialogs.
  9. Include some boost header files. For example: #include <boost/atomic.hpp>
  10. Build the project.


The updated boost package doesn't contain compiled libraries (.lib/.dll) any more. Now it's only 15Mb. I've created separate packages for the boost compiled libraries:


  1. Класс !
    А официальная поддержка от разработчиков не планируется ?

    1. Честно говоря, не знаю. Если интересно, исходники здесь http://citylizard.codeplex.com/SourceControl/latest#boost/

    2. Не хватает более обширного спектра компиляторов :)
      2008 и 2015 =)

    3. Boost 1.58 for Visual Studio 2015 RC: https://getboost.codeplex.com/releases/view/614815

  2. This didn't work for me. This was also my first attempt to use nuget (C++ or native).

    I was able to get zlib to install with "Install-Package zlib".
    When I ran "Install-Package boost -Pre", memory usage spiked from ~70MB to ~2GB, and then I got on out of memory exception in my nuget console output.

    For reference, installing zlib "only" made my memory usage go from ~70MB to ~150MB.

    1. I have now tried this on a second machine, and it worked there. I'm not sure what the relevant differences are.

      I noticed that you only package the multi-threaded staticlib versions of the boost libraries (debug and release). People are likely to request the static C-runtime variants, and DLL variants.

    2. Thank you, Ben, for testing the package. Did you run it on Windows 32bit the first time? I think, I should split the package to several Boost libraries but there is no official support for this from Boost community.

      How should I build the DLLs? Currently I run these commands to build the Boost framework:

      bjam msvc architecture=x86 stage --stagedir=stage_x86
      bjam msvc architecture=x86 address-model=64 stage --stagedir=stage_x86_64


    3. My failing attempt was on a Win7 x64 machine. My good attempt was on a Win8 x64 machine.

      To answer the question you asked, you can build both the DLLs and the libs by adding link=static,shared to your build lines. That's not the right question to ask though :)

      The right question (or at least closer to the right question) is "Which variants of the boost libraries should go in the package?" That's a much harder question.

      You could build with "--build-type=complete". This will generate most (but not all) variants. It is also way bigger than you probably want. The 32-bit complete build is 4.32 GB, and it doesn't even include PDBs for the DLLs.

      I would argue that the single threaded CRT builds could be discarded, that halves the size.

      I've got plenty more to talk about with regards to Boost. If you want to chat more, my email address is in my profile.

    4. Ok, I was trying to split Boost to libraries but it is so hard. So I found a workaround. Package boost contains only headers (about 15 Mb zipped). And then we have pre-compiled packages, such as boost_atomic, boost_context, etc.

      1. Install "boost" package and use it.
      2. If you have a linker error ">LINK : fatal error LNK1104: cannot open file 'boost_{NAME_OF_LIBRARY}-vc110-mt-1_54.lib'" then install "boost_{NAME_OF_LIBRARY}" package, for example "boost_atomic" or "boost_wserialization".
      3. If you use shared Boost DLLs then copy them from packages/boost_{NAME_OF_LIBRARY}/stage_{PLATFORM}/ folder.

  3. This comment has been removed by the author.

  4. Спасибо большое за nupkg.
    Надеюсь поддержка не прекратится.

  5. Если boost не будет радикально менять структуру, то существующая программа должна достаточно легко генерировать новые пакеты.

  6. can you provide some boost_all-vc120, which would depend on all other vc120 packages?

    1. That may be a good idea. I will investigate it. The biggest problem will be download time.

    2. https://getboost.codeplex.com/workitem/6