7

I am compiling a program which requires boost-thread-mt library. I have installed libboost-all-dev using sudo apt-get install libboost-all-dev but compiler says that it cannot find boost-thread-mt library. Is this library in some other package? Please guide me what i need to install for this.

  • Do you have libboost-thread-dev installed? – Cornelius Jun 20 '14 at 15:47
  • There are no -mt libraries in the main Boost package. See also this unresolved question. – saiarcot895 Jun 20 '14 at 15:50
  • How can I install -mt libraries? – Muhammad Omer Jun 20 '14 at 15:50
12

The -mt suffix had been removed. The installed Boost libraries are multi-threading safe.

You can compile your program versus libboost-thread. Either by changing the source to use non -mt libs or by making symbolic links libboost_thread.alibboost_thread-mt.a. Same thing if you need shared libs .so.

  • 2
    So... any advice on doing cross-platform development given that Ubuntu in its wisdom decided to do things differently from everyone else? – Pseudonym Jul 9 '15 at 2:30
  • @Pseudonym, if you are using GNU autotools, see Autotconf: AC_CHECK_LIB – user.dz Oct 23 '15 at 12:43
  • 1
    Autoconf is overkill for many projects, especially if you're using Boost.Build. – Pseudonym Oct 24 '15 at 0:03
  • @Pseudonym, I'm not so familiar with boost but check-target-builds seems to offer same functionality of autoconf for boost.build. – user.dz Oct 24 '15 at 5:28
0

If your project uses CMake, this following switch provided in FindBoost module has to turned off: -DBoost_USE_MULTITHREADED=OFF

0

This link is related to this question.

You may as well try compiling boost from source rather than using the apt-get version.

The arguments --layout, threading and build-type will help.

--layout=<layout>     Determines whether to choose library names
                      and header locations such that multiple
                      versions of Boost or multiple compilers can
                      be used on the same system.

                      versioned - Names of boost binaries
                      include the Boost version number, name and
                      version of the compiler and encoded build
                      properties.  Boost headers are installed in a
                      subdirectory of <HDRDIR> whose name contains
                      the Boost version number.

                      tagged -- Names of boost binaries include the
                      encoded build properties such as variant and
                      threading, but do not including compiler name
                      and version, or Boost version. This option is
                      useful if you build several variants of Boost,
                      using the same compiler.

                      system - Binaries names do not include the
                      Boost version number or the name and version
                      number of the compiler.  Boost headers are
                      installed directly into <HDRDIR>.  This option
                      is intended for system integrators who are
                      building distribution packages.

                  The default value is 'versioned' on Windows, and
                  'system' on Unix.

So, try this command to install boost, after bootstrap.sh --prefix=/path/of/yours:

./b2 install -j16 threading=multi --layout=tagged --build-type=complete

Then you'll get all the -mt libraries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.