简体   繁体   中英

Visual Studio 2017, “Mixing a dll boost library with a static runtime”, when linking python_boost.lib

I am trying to build the BGSLibrary for Windows 10, cmake 3.9, with python support, built with opencv 3.1 and boost 1.64.0 with Visual Studio Community 2017.

I built boost with python libraries (.lib) and a STATIC runtime (link=static).

b2 -j%cores% toolset=%msvcver% address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/x64 --with-python

but CMAKE was having trouble finding them. It wanted something in the form of python_boost.lib. So I copied a .lib to a new folder and pointed it in PATH. See my last question. https://stackoverflow.com/questions/45002215/point-findboost-cmake-to-boost-python-windows-10-vs-2017/45002971#45002971

Now I get the much debated

1>C:\Program Files\boost_1_64_0\boost/config/auto_link.hpp(370): fatal error C1189: #error:  "Mixing a dll boost library with a static runtime is a really bad idea..."

Can someone unpack this for me. I find it confusing.

  1. The boost library is not a shared .dll, it is boost_python.lib! Mixing a dll boost library? its not a dll boost library. CMAKE clearly sees it, from Cmake output

    Boost library status:

    version: 106400

    libraries: C:/Program Files/boost_1_64_0/stage/lib/boost_python.lib

    include path: C:/Program Files/boost_1_64_0

  2. Plus, the Visual Studio runtime is not static? When I look at the runtime, there is no static option.

在此处输入图片说明

Is it that I renamed the wrong .lib from boost boostrap? Here were my options (64 bit is there too, in a different folder)

Specifically, which of these files should I rename python_boost? And what should the extension be? I went back and remade with .dll support in bootstrap just in case, but cmake won't take .dll to generate. I feel like i'm missing something obviously here.

在此处输入图片说明

EDIT:

Visual Studio properties for libbgs, clearly trying to make a .so static library, why does it complain that its dynamic?

在此处输入图片说明

我能够通过构建boost.python这样来解决此错误

b2 -j%cores% toolset=%msvcver% address-model=32 architecture=x86 link=static threading=multi runtime-link=static --build-type=complete stage --with-python

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM