0

I'm trying to build Boost.test on windows version 1.62.0. I'm building --with-test and my output file is libboost_unit_test_framework-vc140-mt-gd-1_62.lib / dll

Everything goes fine, but when I add the unit_test.hpp header in my project, the linker compains that libboost_thread-vc140-mt-gd-1_62.lib cannot be located.

I'm surprised, I was under the impression that when I build --with-test, using b2, all the dependencies of Boost.test will be built, I mean I see that it build chrono, timer and system, should it have also built thread?

I double and triple checked to see if my project does not bring in the thread.hpp header - it does not. It is set up to auto-link the libs.

I also ran BCP

bcp --boost=b:\temp\boost_1_62_0 --list test

on the boost/test folder, and it does seem to list thread files:

boost\thread.hpp
....
libs\thread\build\has_atomic_flag_l
libs\thread\build\Jamfile.v2
libs\thread\src\future.cpp
libs\thread\src\pthread\once.cpp
libs\thread\src\pthread\once_atomic
libs\thread\src\pthread\thread.cpp
libs\thread\src\tss_null.cpp
libs\thread\src\win32\thread.cpp
libs\thread\src\win32\tss_dll.cpp
libs\thread\src\win32\tss_pe.cpp

I have a feeling I do not fully understand what is going on.

Is Boost.unit dependent on Boost.thread?

If so, why isn't it build automatically by b2. If not where could this be dependency be coming from...

Thanks,

Andrzej

cierech
  • 383
  • 4
  • 14

1 Answers1

1

I was under the impression that when I build --with-test, using b2, all the dependencies of Boost.test will be built...

You were under the wrong impression; --with-test just builds the test library. You clearly need to build boost thread as well.

I'm sorry to say that I don't know if there are any other dependencies, since I always perform a complete build of boost and it performs auto-linking with Visual Studio...

Note: for Visual Studio boost thread must be built with dynamic linking, so add link=shared to the b2 command.

See How do I build boost on Windows? for a more complete description.

Community
  • 1
  • 1
kenba
  • 4,303
  • 1
  • 23
  • 40
  • 1
    Thanks Kenba, I was under that impression, because --with-test also builds chrono, system and timer, as I see the libs generated in bin.v2 folder. Since I have not chosen to build those, but specified just --with-test, I'm assuming that these are Boost.test dependencies that have been brought in. If my understanding is correct, why hasn't Boost.thread been brought in? – cierech Dec 21 '16 at 14:32
  • Sorry @clerech, I wasn't aware that `--with-test` built the other dependencies. It might not have included `thread` because of the `dynamic linking` issue. However, that's pure supposition on my part, I just build the whole of `boost` and everything works... – kenba Dec 21 '16 at 20:09
  • Yeah, that's what I ended up doing, I was hoping to understand what was going on. – cierech Dec 22 '16 at 04:01