Opened 5 years ago
Closed 4 years ago
#13527 closed Bugs (obsolete)
Boost 1.67.0 - Cannot link to boost_pythonPY_MAJOR_VERSIONPY_MINOR_VERSION...
Reported by: | Owned by: | ||
---|---|---|---|
Milestone: | To Be Determined | Component: | None |
Version: | Boost 1.67.0 | Severity: | Problem |
Keywords: | python, link | Cc: |
Description
Cannot link to boost_python correctly. Using MSVC 2015 Update 3, boost_1_67_0\boost\python\detail\config.hpp line 108 does not expand as intended:
(line 108) #define BOOST_LIB_NAME boost_python##PY_MAJOR_VERSION##PY_MINOR_VERSION
This line expands to "boost_pythonPY_MAJOR_VERSIONPY_MINOR_VERSION(...).lib", which results in a linking error since the library is named "boost_python36(...).lib"
My Python distribution is Anaconda 5.1 and patchlevel.h has:
(line 19) #define PY_MAJOR_VERSION 3
(line 20) #define PY_MINOR_VERSION 6
Similarly, one will have difficulty with boost_1_67_0\boost\python\numpy\config.hpp line 64.
I tried repeatedly to make the preprocessor directives work as intended but I cannot quite figure it out. I wish I could find where the library name is generated for the build, not just the link.
Change History (3)
comment:1 by , 5 years ago
comment:2 by , 4 years ago
There is a bug boost lib. Still waiting for a bugfix. you have to change python/detail/config.hpp.
-#define BOOST_LIB_NAME boost_python##PY_MAJOR_VERSION##PY_MINOR_VERSION +#define _BOOST_PYTHON_CONCAT(N, M, m) N ## M ## m +#define BOOST_PYTHON_CONCAT(N, M, m) _BOOST_PYTHON_CONCAT(N, M, m) +#define BOOST_LIB_NAME BOOST_PYTHON_CONCAT(boost_python, PY_MAJOR_VERSION, PY_MINOR_VERSION)
and after
#include <boost/config/auto_link.hpp> #endif auto-linking disabled
add
+#undef BOOST_PYTHON_CONCAT +#undef _BOOST_PYTHON_CONCAT +
comment:3 by , 4 years ago
Resolution: | → obsolete |
---|---|
Status: | new → closed |
I see a similar problem - we use CMake with VS2017 - I see a link error; fatal error LNK1104: cannot open file 'boost_pythonPY_MAJOR_VERSIONPY_MINOR_VERSION-vc141-mt-x64-1_67.lib'
Andy