0

My application that is developed using CMake and boost library on Linux (openSUSE-Leap-42.2) needs libboost_log-mt.so (1.62) while linking. But the problem is that CMake cannot find this library (with -mt suffix) in my lib directory even when I use the related switches with the b2 tool.

$ ./b2 link=static,shared threading=single,multi

After searching for some time, I found that the -mt suffix of boost libraries has been removed and all the created libraries are thread-safe (check here) and my problem could be fixed by a simple soft link to non-mt libraries. I created the link and everything works fine.

Now the question is that, are the -mt version of boost libraries are removed officially? and if yes, why does cmake tries to link them to my binary then?

Community
  • 1
  • 1
TonySalimi
  • 8,257
  • 4
  • 33
  • 62
  • 1
    "why the linker tries to link them to my binary then?" Perhaps because your makefile has them specified with `-mt`? – The Quantum Physicist Mar 20 '17 at 12:29
  • @The Quantum Physicist i am using cmake and I have not even mentioned it in my cmake file. Is it true that -mt suffixes have been removed? – TonySalimi Mar 20 '17 at 12:41
  • 1
    I don't know, but this is an issue related to cmake, not to boost itself. Cmake has a package for finding boost, and it's locating the wrong library. That's your issue. Your question, "why the linker tries to link..." is the wrong one. Your question should be "why does cmake locate the wrong library", and the answer is: probably because it still is not aware of the change that removed `-mt`, and the new versions will be. Solution: use your own `FindBoost.cmake` in your project, where you this problem fixed. – The Quantum Physicist Mar 20 '17 at 12:44
  • @The Quantum Physicist You are right ! I changed my question. Do you confirm that both libraries (with/without -mt suffix) are the same and both are thread-safe? – TonySalimi Mar 20 '17 at 12:50
  • Sorry, I don't know about that. I can't confirm. – The Quantum Physicist Mar 20 '17 at 12:50
  • http://stackoverflow.com/questions/2293962/boost-libraries-in-multithreading-aware-mode and http://askubuntu.com/questions/486006/cannot-find-boost-thread-mt-library are relevant. – John Zwinck Mar 20 '17 at 14:11
  • @JohnZwinck This is exactly the link I have provided in my Q :D – TonySalimi Mar 20 '17 at 15:36

0 Answers0