0

I am trying to build dependencies for a project, currently based on VS2013, with VS2015.
Most of them are building without problems, either as they are or with some patch, but I am totally at a loss with OpenImageIO 1.4.12.
I am passing parameters to cmake and msbuild that set up use of VS2015 for everything, and indeed the generated solution files indicate "vc140_xp" as the chosen toolset.
But at link time I receive error like this one, indicating that somewhere there is a reference to boost libraries built with VS2013:

LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc120-mt-1_56.lib' [F:\...\deps\x64\oiio-Release-1.4.12\build\src\libOpenImageIO\OpenImageIO.vcxproj]

Of course I have a bunch of libboost_xxx-vc140-mt-1_56.lib in another place, since I've built them also with VS2015. Also dependencies set up in solution file correctly refer to libboost_xxx-vc140-mt-1_56.lib files and to the correct path, and by doing a FINDSTR in all OpenImageIO build tree I'm not able to find any reference to the older VS version.
But the same command lists a lot of .obj files containing those references, such as (put on multiple lines for better readability):

 build\src\libOpenImageIO\OpenImageIO.dir\Release\xmp.obj:/FAILIFMISMATCH:"_CRT_STDIO_ISO_WIDE_SPECIFIERS=0"
 libboost_regex-vc120-mt-1_56.lib
 libboost_thread-vc120-mt-1_56.lib
 libboost_date_time-vc120-mt-1_56.lib
 libboost_system-vc120-mt-1_56.lib
 libboost_chrono-vc120-mt-1_56.lib

Is it because of these references that link fails looking for different versions of boost libs? Where can these references come from? And how can I get rid of them, since apparently they are nowhere to be found in my configuration?

acasta69
  • 121
  • 1
  • 7
  • It's because your building a version of boost that predates VS2015. The answer her should help: [visual studio asks for wrong boost libraries](http://stackoverflow.com/questions/20024998/visual-studio-2013-vs120-asks-for-wrong-boost-libraries) – kenba Nov 13 '16 at 14:58
  • That's indeed the reason and the solution to my problem. I had not realized that the source of my problem could be in boost itself instead of the library I was building. – acasta69 Nov 13 '16 at 15:08

1 Answers1

1

This problem is in boost itself, not in OpenImageIO, and is caused by the used version of boost being released before VS2015.

As pointed out by kenba in his comment, this answer points to the solution: Visual Studio 2013 (vs120) asks for wrong boost libraries.
The full explanation, related to an older version of boost and VS, can be found here: How do I specify, which version of boost library to link to?.

In the case of VS2015, here is how the corresponding lines of code in boost/config/auto_link.hpp should appear:

#  elif defined(BOOST_MSVC) && (BOOST_MSVC < 1800)

     // vc11:
#    define BOOST_LIB_TOOLSET "vc110"

#  elif defined(BOOST_MSVC) && (BOOST_MSVC < 1900)

     // vc12:
#    define BOOST_LIB_TOOLSET "vc120"

#  elif defined(BOOST_MSVC)

     // vc14:
#    define BOOST_LIB_TOOLSET "vc140"

Implementing these lines solved my problem.

Community
  • 1
  • 1
acasta69
  • 121
  • 1
  • 7