python: Compile problems when trying to link to 1.67.0 python library

I decided to give the RC2 a spin and ran into just one issue in my project. We have a DLL which links with the python .lib in windows, and when the MSVC 2017 compiler attempted to parse the library name headers in detail/config.hpp at line 108:

#define BOOST_LIB_NAME boost_python##PY_MAJOR_VERSION##PY_MINOR_VERSION

…it resulted in a linker error looking for boost_pythonPY_MAJOR_VERSIONPY_MINOR_VERSION-vc141-mt-x64-1_67.lib.

I had to modify the header to something like this in order to link properly:

#define _BPYCONCAT(A, B) A ## B
#define BPYCONCAT(A, B) _BPYCONCAT(A, B)
#define BOOST_LIB_NAME BPYCONCAT(boost_python, BPYCONCAT(PY_MAJOR_VERSION, PY_MINOR_VERSION))

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Can you please try out this fix: https://github.com/boostorg/python/commit/24313709a78c694af4ae29116cd06ea86585aa95 ? With a bit of luck we can still get this into the release, but unfortunately I’m unable to test it myself. Thanks !

@anton-matosov Apparently the way to achieve this is to define BOOST_ALL_NO_LIB, which will disable the autolink logic. For the rest, I suppose that depends on what build system you are using…