1

I've been trying this for over 5 days and I have no idea how to get this to work. I had successfully installed boost once, then I got my computer re-imaged and now it's just not happening. I have Windows 7 Enterprise, and 64-bit operating system.

I downloaded boost from here sourceforge

unzipped it into program files.

I then went to the VS 2013 Native Command prompt. Changed directory to boost tools/build

Ran bootstrap.bat

I then ran ./b2 address-model=64 

but it did not give me directories for the compiler and the linker like last time.

I then ran ./b2 --prefix=C:\ProgramFiles\boost_1_58_0

but again nothing happens. I get the following errors:

Warning: No Toolsets were configured.
Warning: Configuring default toolset ""msvc"
Warning: If the default is wrong, your build may not work correctly
warning: Use the "toolset=xxxxx" option to overrride out guess
warning: for more configuration please consult

I have no idea why this worked the first time I had done this and why this isn't working now. Can someone please help me out. I know nothing about Unix but I need to install this so I can use the libraries.

Amatya
  • 1,203
  • 6
  • 32
  • 52
  • What platform are you using? Most Linux and *BSD distributions have a package to install Boost. – wkl Apr 27 '15 at 15:41
  • He's clearly using Win32 if he's using vs 2013 –  Apr 27 '15 at 15:42
  • I have a windows 7 Enterprise, 64 bit operating system – Amatya Apr 27 '15 at 16:00
  • 1
    Oh sorry, I read he 'knew nothing about unix' and took it from that. You typically don't have to compile your own on Windows: http://sourceforge.net/projects/boost/files/boost-binaries/1.58.0/ – wkl Apr 27 '15 at 16:06
  • @birryree if I simply run the exe file that you linked to, will it give me the directories of the linker and the compiler? My next step is to install Quantlib and the last time I had done it, I'd needed those paths. – Amatya Apr 27 '15 at 17:21
  • 1
    @Amatya if you install from the binary package, you just need to configure your Visual Studio project to point to the installed libraries and headers directories. You pick where it gets installed. – wkl Apr 27 '15 at 17:35

1 Answers1

2

I compile boost with both mingw (64 bit) and msvc 2013 pro. I have never in my life used the vs command prompt to build boost with msvc. Here are my commands to build 64 bit binaries on both toolchains.

First go into the boost folder and just double click bootstrap.bat. This should run and build bjam/b2. Nothing special required and doesn't matter what compiler this gets built with.

Then simply run, in a normal command prompt:

bjam.exe -a -j8 --toolset=msvc --layout=system optimization=speed link=shared threading=multi address-model=64 --stagedir=stage\MSVC-X64 release stage

Where -a forces rebuild all, -j8 means for the build to use 8 cores (adjust this based on your processor capabilities), toolset is obvious, layout means how to structure the naming of the output files, address-model is obvious, stagedir is where to output the built binaries (either relative or absolute path) and release stage is the type of build the system. See more here.

Same thing but using 64 bit mingw.

bjam.exe -j8 --toolset=gcc --layout=system optimization=speed link=shared threading=multi address-model=64 --stagedir=stage\x64 release stage

You can even go on to build additional libraries with a second pass tweaking your arguments. For example, after I've built the core libs with the above command, I run the following command to build in zlib and gzip support.

bjam.exe -a -j8 --toolset=msvc --layout=system optimization=speed link=shared threading=multi address-model=64 --stagedir=stage\MSVC-X64 --with-iostreams -s BZIP2_SOURCE=C:\dev\libraries\cpp\bzip2-1.0.6 -s ZLIB_SOURCE=C:\dev\libraries\cpp\zlib-1.2.8 release stage

Anyway that's just as an example. I linked to the full docs for the build system. Try building using these commands NOT inside a vs command prompt. If you still have problems then please post specific errors.

A note about MSVC
So, msvc compiler + boost supports a type of linking where it will automatically include additional libraries that it knows it needs. I believe boost does this by using the #pragma directive in headers. For example you might use boost::asio configured in such a way that it needs boost::system (for error codes and such). Even if you don't explicitly add boost::system library to the linker options, msvc will "figure out" that it needs this library and automatically try to link against it.

Now an issue arises here because you're using layout=system. The libraries are named simply "boost_" + the lib name, like "boost_system.dll". However, unless you specify a preprocessor define, this auto linking will try and link to a name like "boost_system_msvc_mt_1_58.lib". That's not exact as I can't recall the exact name, but you get the idea. You specifically told boost to name your libraries with the system layout (boost_thread, boost_system) etc instead of the default, which includes the boost version, "MT" if multithreaded, the compiler version, and lots of other stuff in the name. So that's why the auto linking feature goes looking for such a crazy weird name and fails. To fix this, add "BOOST_AUTO_LINK_NOMANGLE" in the Preprocessor section of your C++ settings in visual studio.

More on that here. Note that the answer here gives you a different preprocessor definition to solve this problem. I believe I ended up using BOOST_AUTO_LINK_NOMANGLE instead (which ended up working for me) because the ALL_DYN_LINK macro turned out to be designed as an "internal" define that boost controls and sets itself. Not sure as it's been some time since I had this issue, but the define I provide seems to solve the same root issue anyway.

Community
  • 1
  • 1
  • Thanks. I am running into a different set of problems now, LNK1104. I have posted about it here http://stackoverflow.com/questions/30060166/quantlib-build-error I don't know if this new issue is related to the only you provided a solution for. I'd love it if you could take a look. – Amatya May 05 '15 at 18:08